@ensnode/ensnode-sdk 0.0.0-next-20260210061727 → 0.0.0-next-20260210145458
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.cjs +352 -316
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +138 -98
- package/dist/index.d.ts +138 -98
- package/dist/index.js +348 -312
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -256,6 +256,7 @@ __export(index_exports, {
|
|
|
256
256
|
translateDefaultableChainIdToChainId: () => translateDefaultableChainIdToChainId,
|
|
257
257
|
uint256ToHex32: () => uint256ToHex32,
|
|
258
258
|
uniq: () => uniq,
|
|
259
|
+
validateChainIndexingStatusSnapshot: () => validateChainIndexingStatusSnapshot,
|
|
259
260
|
validateSupportedLabelSetAndVersion: () => validateSupportedLabelSetAndVersion
|
|
260
261
|
});
|
|
261
262
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1032,11 +1033,110 @@ function serializeENSIndexerPublicConfig(config) {
|
|
|
1032
1033
|
};
|
|
1033
1034
|
}
|
|
1034
1035
|
|
|
1036
|
+
// src/ensindexer/indexing-status/chain-indexing-status-snapshot.ts
|
|
1037
|
+
var ChainIndexingConfigTypeIds = {
|
|
1038
|
+
/**
|
|
1039
|
+
* Represents that indexing of the chain should be performed for an indefinite range.
|
|
1040
|
+
*/
|
|
1041
|
+
Indefinite: "indefinite",
|
|
1042
|
+
/**
|
|
1043
|
+
* Represents that indexing of the chain should be performed for a definite range.
|
|
1044
|
+
*/
|
|
1045
|
+
Definite: "definite"
|
|
1046
|
+
};
|
|
1047
|
+
var ChainIndexingStatusIds = {
|
|
1048
|
+
/**
|
|
1049
|
+
* Represents that indexing of the chain is not ready to begin yet because:
|
|
1050
|
+
* - ENSIndexer is in its initialization phase and the data to build a
|
|
1051
|
+
* "true" {@link ChainIndexingStatusSnapshot} for the chain is still being loaded; or
|
|
1052
|
+
* - ENSIndexer is using an omnichain indexing strategy and the
|
|
1053
|
+
* `omnichainIndexingCursor` is <= `config.startBlock.timestamp` for the chain's
|
|
1054
|
+
* {@link ChainIndexingStatusSnapshot}.
|
|
1055
|
+
*/
|
|
1056
|
+
Queued: "chain-queued",
|
|
1057
|
+
/**
|
|
1058
|
+
* Represents that indexing of the chain is in progress and under a special
|
|
1059
|
+
* "backfill" phase that optimizes for accelerated indexing until reaching the
|
|
1060
|
+
* "fixed target" `backfillEndBlock`.
|
|
1061
|
+
*/
|
|
1062
|
+
Backfill: "chain-backfill",
|
|
1063
|
+
/**
|
|
1064
|
+
* Represents that the "backfill" phase of indexing the chain is completed
|
|
1065
|
+
* and that the chain is configured to be indexed for an indefinite range.
|
|
1066
|
+
* Therefore, indexing of the chain remains indefinitely in progress where
|
|
1067
|
+
* ENSIndexer will continuously work to discover and index new blocks as they
|
|
1068
|
+
* are added to the chain across time.
|
|
1069
|
+
*/
|
|
1070
|
+
Following: "chain-following",
|
|
1071
|
+
/**
|
|
1072
|
+
* Represents that indexing of the chain is completed as the chain is configured
|
|
1073
|
+
* to be indexed for a definite range and the indexing of all blocks through
|
|
1074
|
+
* that definite range is completed.
|
|
1075
|
+
*/
|
|
1076
|
+
Completed: "chain-completed"
|
|
1077
|
+
};
|
|
1078
|
+
function createIndexingConfig(startBlock, endBlock) {
|
|
1079
|
+
if (endBlock) {
|
|
1080
|
+
return {
|
|
1081
|
+
configType: ChainIndexingConfigTypeIds.Definite,
|
|
1082
|
+
startBlock,
|
|
1083
|
+
endBlock
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
return {
|
|
1087
|
+
configType: ChainIndexingConfigTypeIds.Indefinite,
|
|
1088
|
+
startBlock
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
function getTimestampForLowestOmnichainStartBlock(chains) {
|
|
1092
|
+
const earliestKnownBlockTimestamps = chains.map(
|
|
1093
|
+
(chain) => chain.config.startBlock.timestamp
|
|
1094
|
+
);
|
|
1095
|
+
if (earliestKnownBlockTimestamps.length === 0) {
|
|
1096
|
+
throw new Error(
|
|
1097
|
+
"Invariant violation: at least one chain is required to determine the lowest omnichain start block timestamp"
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1100
|
+
return Math.min(...earliestKnownBlockTimestamps);
|
|
1101
|
+
}
|
|
1102
|
+
function getTimestampForHighestOmnichainKnownBlock(chains) {
|
|
1103
|
+
const latestKnownBlockTimestamps = [];
|
|
1104
|
+
for (const chain of chains) {
|
|
1105
|
+
switch (chain.chainStatus) {
|
|
1106
|
+
case ChainIndexingStatusIds.Queued:
|
|
1107
|
+
if (chain.config.configType === ChainIndexingConfigTypeIds.Definite) {
|
|
1108
|
+
latestKnownBlockTimestamps.push(chain.config.endBlock.timestamp);
|
|
1109
|
+
}
|
|
1110
|
+
break;
|
|
1111
|
+
case ChainIndexingStatusIds.Backfill:
|
|
1112
|
+
latestKnownBlockTimestamps.push(chain.backfillEndBlock.timestamp);
|
|
1113
|
+
break;
|
|
1114
|
+
case ChainIndexingStatusIds.Completed:
|
|
1115
|
+
latestKnownBlockTimestamps.push(chain.latestIndexedBlock.timestamp);
|
|
1116
|
+
break;
|
|
1117
|
+
case ChainIndexingStatusIds.Following:
|
|
1118
|
+
latestKnownBlockTimestamps.push(chain.latestKnownBlock.timestamp);
|
|
1119
|
+
break;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
if (latestKnownBlockTimestamps.length === 0) {
|
|
1123
|
+
throw new Error(
|
|
1124
|
+
"Invariant: at least one chain must contribute a known block timestamp to determine the highest omnichain known block timestamp"
|
|
1125
|
+
);
|
|
1126
|
+
}
|
|
1127
|
+
return Math.max(...latestKnownBlockTimestamps);
|
|
1128
|
+
}
|
|
1129
|
+
function sortChainStatusesByStartBlockAsc(chains) {
|
|
1130
|
+
return [...chains].sort(
|
|
1131
|
+
([, chainA], [, chainB]) => chainA.config.startBlock.timestamp - chainB.config.startBlock.timestamp
|
|
1132
|
+
);
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1035
1135
|
// src/ensindexer/indexing-status/deserialize.ts
|
|
1036
|
-
var
|
|
1136
|
+
var import_v410 = require("zod/v4");
|
|
1037
1137
|
|
|
1038
1138
|
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1039
|
-
var
|
|
1139
|
+
var import_v49 = require("zod/v4");
|
|
1040
1140
|
|
|
1041
1141
|
// src/shared/deserialize.ts
|
|
1042
1142
|
var import_v47 = require("zod/v4");
|
|
@@ -1162,47 +1262,6 @@ ${(0, import_v47.prettifyError)(parsed.error)}
|
|
|
1162
1262
|
}
|
|
1163
1263
|
|
|
1164
1264
|
// src/ensindexer/indexing-status/types.ts
|
|
1165
|
-
var ChainIndexingConfigTypeIds = {
|
|
1166
|
-
/**
|
|
1167
|
-
* Represents that indexing of the chain should be performed for an indefinite range.
|
|
1168
|
-
*/
|
|
1169
|
-
Indefinite: "indefinite",
|
|
1170
|
-
/**
|
|
1171
|
-
* Represents that indexing of the chain should be performed for a definite range.
|
|
1172
|
-
*/
|
|
1173
|
-
Definite: "definite"
|
|
1174
|
-
};
|
|
1175
|
-
var ChainIndexingStatusIds = {
|
|
1176
|
-
/**
|
|
1177
|
-
* Represents that indexing of the chain is not ready to begin yet because:
|
|
1178
|
-
* - ENSIndexer is in its initialization phase and the data to build a
|
|
1179
|
-
* "true" {@link ChainIndexingSnapshot} for the chain is still being loaded; or
|
|
1180
|
-
* - ENSIndexer is using an omnichain indexing strategy and the
|
|
1181
|
-
* `omnichainIndexingCursor` is <= `config.startBlock.timestamp` for the chain's
|
|
1182
|
-
* {@link ChainIndexingSnapshot}.
|
|
1183
|
-
*/
|
|
1184
|
-
Queued: "chain-queued",
|
|
1185
|
-
/**
|
|
1186
|
-
* Represents that indexing of the chain is in progress and under a special
|
|
1187
|
-
* "backfill" phase that optimizes for accelerated indexing until reaching the
|
|
1188
|
-
* "fixed target" `backfillEndBlock`.
|
|
1189
|
-
*/
|
|
1190
|
-
Backfill: "chain-backfill",
|
|
1191
|
-
/**
|
|
1192
|
-
* Represents that the "backfill" phase of indexing the chain is completed
|
|
1193
|
-
* and that the chain is configured to be indexed for an indefinite range.
|
|
1194
|
-
* Therefore, indexing of the chain remains indefinitely in progress where
|
|
1195
|
-
* ENSIndexer will continuously work to discover and index new blocks as they
|
|
1196
|
-
* are added to the chain across time.
|
|
1197
|
-
*/
|
|
1198
|
-
Following: "chain-following",
|
|
1199
|
-
/**
|
|
1200
|
-
* Represents that indexing of the chain is completed as the chain is configured
|
|
1201
|
-
* to be indexed for a definite range and the indexing of all blocks through
|
|
1202
|
-
* that definite range is completed.
|
|
1203
|
-
*/
|
|
1204
|
-
Completed: "chain-completed"
|
|
1205
|
-
};
|
|
1206
1265
|
var OmnichainIndexingStatusIds = {
|
|
1207
1266
|
/**
|
|
1208
1267
|
* Represents that omnichain indexing is not ready to begin yet because
|
|
@@ -1247,17 +1306,6 @@ var CrossChainIndexingStrategyIds = {
|
|
|
1247
1306
|
Omnichain: "omnichain"
|
|
1248
1307
|
};
|
|
1249
1308
|
|
|
1250
|
-
// src/shared/block-ref.ts
|
|
1251
|
-
function isBefore(blockA, blockB) {
|
|
1252
|
-
return blockA.number < blockB.number && blockA.timestamp < blockB.timestamp;
|
|
1253
|
-
}
|
|
1254
|
-
function isEqualTo(blockA, blockB) {
|
|
1255
|
-
return blockA.number === blockB.number && blockA.timestamp === blockB.timestamp;
|
|
1256
|
-
}
|
|
1257
|
-
function isBeforeOrEqualTo(blockA, blockB) {
|
|
1258
|
-
return isBefore(blockA, blockB) || isEqualTo(blockA, blockB);
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
1309
|
// src/ensindexer/indexing-status/helpers.ts
|
|
1262
1310
|
function getOmnichainIndexingStatus(chains) {
|
|
1263
1311
|
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains)) {
|
|
@@ -1274,34 +1322,6 @@ function getOmnichainIndexingStatus(chains) {
|
|
|
1274
1322
|
}
|
|
1275
1323
|
throw new Error(`Unable to determine omnichain indexing status for provided chains.`);
|
|
1276
1324
|
}
|
|
1277
|
-
function getTimestampForLowestOmnichainStartBlock(chains) {
|
|
1278
|
-
const earliestKnownBlockTimestamps = chains.map(
|
|
1279
|
-
(chain) => chain.config.startBlock.timestamp
|
|
1280
|
-
);
|
|
1281
|
-
return Math.min(...earliestKnownBlockTimestamps);
|
|
1282
|
-
}
|
|
1283
|
-
function getTimestampForHighestOmnichainKnownBlock(chains) {
|
|
1284
|
-
const latestKnownBlockTimestamps = [];
|
|
1285
|
-
for (const chain of chains) {
|
|
1286
|
-
switch (chain.chainStatus) {
|
|
1287
|
-
case ChainIndexingStatusIds.Queued:
|
|
1288
|
-
if (chain.config.configType === ChainIndexingConfigTypeIds.Definite && chain.config.endBlock) {
|
|
1289
|
-
latestKnownBlockTimestamps.push(chain.config.endBlock.timestamp);
|
|
1290
|
-
}
|
|
1291
|
-
break;
|
|
1292
|
-
case ChainIndexingStatusIds.Backfill:
|
|
1293
|
-
latestKnownBlockTimestamps.push(chain.backfillEndBlock.timestamp);
|
|
1294
|
-
break;
|
|
1295
|
-
case ChainIndexingStatusIds.Completed:
|
|
1296
|
-
latestKnownBlockTimestamps.push(chain.latestIndexedBlock.timestamp);
|
|
1297
|
-
break;
|
|
1298
|
-
case ChainIndexingStatusIds.Following:
|
|
1299
|
-
latestKnownBlockTimestamps.push(chain.latestKnownBlock.timestamp);
|
|
1300
|
-
break;
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
return Math.max(...latestKnownBlockTimestamps);
|
|
1304
|
-
}
|
|
1305
1325
|
function getOmnichainIndexingCursor(chains) {
|
|
1306
1326
|
if (chains.length === 0) {
|
|
1307
1327
|
throw new Error(`Unable to determine omnichain indexing cursor when no chains were provided.`);
|
|
@@ -1316,19 +1336,6 @@ function getOmnichainIndexingCursor(chains) {
|
|
|
1316
1336
|
}
|
|
1317
1337
|
return Math.max(...latestIndexedBlockTimestamps);
|
|
1318
1338
|
}
|
|
1319
|
-
function createIndexingConfig(startBlock, endBlock) {
|
|
1320
|
-
if (endBlock) {
|
|
1321
|
-
return {
|
|
1322
|
-
configType: ChainIndexingConfigTypeIds.Definite,
|
|
1323
|
-
startBlock,
|
|
1324
|
-
endBlock
|
|
1325
|
-
};
|
|
1326
|
-
}
|
|
1327
|
-
return {
|
|
1328
|
-
configType: ChainIndexingConfigTypeIds.Indefinite,
|
|
1329
|
-
startBlock
|
|
1330
|
-
};
|
|
1331
|
-
}
|
|
1332
1339
|
function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains) {
|
|
1333
1340
|
return chains.every((chain) => chain.chainStatus === ChainIndexingStatusIds.Queued);
|
|
1334
1341
|
}
|
|
@@ -1353,12 +1360,6 @@ function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(ch
|
|
|
1353
1360
|
);
|
|
1354
1361
|
return allChainsHaveValidStatuses;
|
|
1355
1362
|
}
|
|
1356
|
-
function sortChainStatusesByStartBlockAsc(chains) {
|
|
1357
|
-
chains.sort(
|
|
1358
|
-
([, chainA], [, chainB]) => chainA.config.startBlock.timestamp - chainB.config.startBlock.timestamp
|
|
1359
|
-
);
|
|
1360
|
-
return chains;
|
|
1361
|
-
}
|
|
1362
1363
|
function getLatestIndexedBlockRef(indexingStatus, chainId) {
|
|
1363
1364
|
const chainIndexingStatus = indexingStatus.omnichainSnapshot.chains.get(chainId);
|
|
1364
1365
|
if (chainIndexingStatus === void 0) {
|
|
@@ -1371,80 +1372,6 @@ function getLatestIndexedBlockRef(indexingStatus, chainId) {
|
|
|
1371
1372
|
}
|
|
1372
1373
|
|
|
1373
1374
|
// src/ensindexer/indexing-status/validations.ts
|
|
1374
|
-
function invariant_chainSnapshotQueuedBlocks(ctx) {
|
|
1375
|
-
const { config } = ctx.value;
|
|
1376
|
-
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1377
|
-
return;
|
|
1378
|
-
}
|
|
1379
|
-
if (config.endBlock && isBeforeOrEqualTo(config.startBlock, config.endBlock) === false) {
|
|
1380
|
-
ctx.issues.push({
|
|
1381
|
-
code: "custom",
|
|
1382
|
-
input: ctx.value,
|
|
1383
|
-
message: "`config.startBlock` must be before or same as `config.endBlock`."
|
|
1384
|
-
});
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
function invariant_chainSnapshotBackfillBlocks(ctx) {
|
|
1388
|
-
const { config, latestIndexedBlock, backfillEndBlock } = ctx.value;
|
|
1389
|
-
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1390
|
-
ctx.issues.push({
|
|
1391
|
-
code: "custom",
|
|
1392
|
-
input: ctx.value,
|
|
1393
|
-
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1394
|
-
});
|
|
1395
|
-
}
|
|
1396
|
-
if (isBeforeOrEqualTo(latestIndexedBlock, backfillEndBlock) === false) {
|
|
1397
|
-
ctx.issues.push({
|
|
1398
|
-
code: "custom",
|
|
1399
|
-
input: ctx.value,
|
|
1400
|
-
message: "`latestIndexedBlock` must be before or same as `backfillEndBlock`."
|
|
1401
|
-
});
|
|
1402
|
-
}
|
|
1403
|
-
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1404
|
-
return;
|
|
1405
|
-
}
|
|
1406
|
-
if (config.endBlock && isEqualTo(backfillEndBlock, config.endBlock) === false) {
|
|
1407
|
-
ctx.issues.push({
|
|
1408
|
-
code: "custom",
|
|
1409
|
-
input: ctx.value,
|
|
1410
|
-
message: "`backfillEndBlock` must be the same as `config.endBlock`."
|
|
1411
|
-
});
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
function invariant_chainSnapshotCompletedBlocks(ctx) {
|
|
1415
|
-
const { config, latestIndexedBlock } = ctx.value;
|
|
1416
|
-
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1417
|
-
ctx.issues.push({
|
|
1418
|
-
code: "custom",
|
|
1419
|
-
input: ctx.value,
|
|
1420
|
-
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1423
|
-
if (isBeforeOrEqualTo(latestIndexedBlock, config.endBlock) === false) {
|
|
1424
|
-
ctx.issues.push({
|
|
1425
|
-
code: "custom",
|
|
1426
|
-
input: ctx.value,
|
|
1427
|
-
message: "`latestIndexedBlock` must be before or same as `config.endBlock`."
|
|
1428
|
-
});
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
function invariant_chainSnapshotFollowingBlocks(ctx) {
|
|
1432
|
-
const { config, latestIndexedBlock, latestKnownBlock } = ctx.value;
|
|
1433
|
-
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1434
|
-
ctx.issues.push({
|
|
1435
|
-
code: "custom",
|
|
1436
|
-
input: ctx.value,
|
|
1437
|
-
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1438
|
-
});
|
|
1439
|
-
}
|
|
1440
|
-
if (isBeforeOrEqualTo(latestIndexedBlock, latestKnownBlock) === false) {
|
|
1441
|
-
ctx.issues.push({
|
|
1442
|
-
code: "custom",
|
|
1443
|
-
input: ctx.value,
|
|
1444
|
-
message: "`latestIndexedBlock` must be before or same as `latestKnownBlock`."
|
|
1445
|
-
});
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
1375
|
function invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot(ctx) {
|
|
1449
1376
|
const snapshot = ctx.value;
|
|
1450
1377
|
const chains = Array.from(snapshot.chains.values());
|
|
@@ -1614,40 +1541,128 @@ function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ct
|
|
|
1614
1541
|
}
|
|
1615
1542
|
}
|
|
1616
1543
|
|
|
1617
|
-
// src/ensindexer/indexing-status/zod-
|
|
1544
|
+
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1545
|
+
var import_v48 = require("zod/v4");
|
|
1546
|
+
|
|
1547
|
+
// src/shared/block-ref.ts
|
|
1548
|
+
function isBefore(blockA, blockB) {
|
|
1549
|
+
return blockA.number < blockB.number && blockA.timestamp < blockB.timestamp;
|
|
1550
|
+
}
|
|
1551
|
+
function isEqualTo(blockA, blockB) {
|
|
1552
|
+
return blockA.number === blockB.number && blockA.timestamp === blockB.timestamp;
|
|
1553
|
+
}
|
|
1554
|
+
function isBeforeOrEqualTo(blockA, blockB) {
|
|
1555
|
+
return isBefore(blockA, blockB) || isEqualTo(blockA, blockB);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1559
|
+
function invariant_chainSnapshotQueuedBlocks(ctx) {
|
|
1560
|
+
const { config } = ctx.value;
|
|
1561
|
+
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1564
|
+
if (isBeforeOrEqualTo(config.startBlock, config.endBlock) === false) {
|
|
1565
|
+
ctx.issues.push({
|
|
1566
|
+
code: "custom",
|
|
1567
|
+
input: ctx.value,
|
|
1568
|
+
message: "`config.startBlock` must be before or same as `config.endBlock`."
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
function invariant_chainSnapshotBackfillBlocks(ctx) {
|
|
1573
|
+
const { config, latestIndexedBlock, backfillEndBlock } = ctx.value;
|
|
1574
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1575
|
+
ctx.issues.push({
|
|
1576
|
+
code: "custom",
|
|
1577
|
+
input: ctx.value,
|
|
1578
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, backfillEndBlock) === false) {
|
|
1582
|
+
ctx.issues.push({
|
|
1583
|
+
code: "custom",
|
|
1584
|
+
input: ctx.value,
|
|
1585
|
+
message: "`latestIndexedBlock` must be before or same as `backfillEndBlock`."
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1589
|
+
return;
|
|
1590
|
+
}
|
|
1591
|
+
if (isEqualTo(backfillEndBlock, config.endBlock) === false) {
|
|
1592
|
+
ctx.issues.push({
|
|
1593
|
+
code: "custom",
|
|
1594
|
+
input: ctx.value,
|
|
1595
|
+
message: "`backfillEndBlock` must be the same as `config.endBlock`."
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
function invariant_chainSnapshotCompletedBlocks(ctx) {
|
|
1600
|
+
const { config, latestIndexedBlock } = ctx.value;
|
|
1601
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1602
|
+
ctx.issues.push({
|
|
1603
|
+
code: "custom",
|
|
1604
|
+
input: ctx.value,
|
|
1605
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, config.endBlock) === false) {
|
|
1609
|
+
ctx.issues.push({
|
|
1610
|
+
code: "custom",
|
|
1611
|
+
input: ctx.value,
|
|
1612
|
+
message: "`latestIndexedBlock` must be before or same as `config.endBlock`."
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
function invariant_chainSnapshotFollowingBlocks(ctx) {
|
|
1617
|
+
const { config, latestIndexedBlock, latestKnownBlock } = ctx.value;
|
|
1618
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1619
|
+
ctx.issues.push({
|
|
1620
|
+
code: "custom",
|
|
1621
|
+
input: ctx.value,
|
|
1622
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1623
|
+
});
|
|
1624
|
+
}
|
|
1625
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, latestKnownBlock) === false) {
|
|
1626
|
+
ctx.issues.push({
|
|
1627
|
+
code: "custom",
|
|
1628
|
+
input: ctx.value,
|
|
1629
|
+
message: "`latestIndexedBlock` must be before or same as `latestKnownBlock`."
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1618
1633
|
var makeChainIndexingConfigSchema = (valueLabel = "Value") => import_v48.z.discriminatedUnion("configType", [
|
|
1619
|
-
import_v48.z.
|
|
1634
|
+
import_v48.z.object({
|
|
1620
1635
|
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1621
1636
|
startBlock: makeBlockRefSchema(valueLabel)
|
|
1622
1637
|
}),
|
|
1623
|
-
import_v48.z.
|
|
1638
|
+
import_v48.z.object({
|
|
1624
1639
|
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1625
1640
|
startBlock: makeBlockRefSchema(valueLabel),
|
|
1626
1641
|
endBlock: makeBlockRefSchema(valueLabel)
|
|
1627
1642
|
})
|
|
1628
1643
|
]);
|
|
1629
|
-
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => import_v48.z.
|
|
1644
|
+
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1630
1645
|
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Queued),
|
|
1631
1646
|
config: makeChainIndexingConfigSchema(valueLabel)
|
|
1632
1647
|
}).check(invariant_chainSnapshotQueuedBlocks);
|
|
1633
|
-
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => import_v48.z.
|
|
1648
|
+
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1634
1649
|
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Backfill),
|
|
1635
1650
|
config: makeChainIndexingConfigSchema(valueLabel),
|
|
1636
1651
|
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1637
1652
|
backfillEndBlock: makeBlockRefSchema(valueLabel)
|
|
1638
1653
|
}).check(invariant_chainSnapshotBackfillBlocks);
|
|
1639
|
-
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => import_v48.z.
|
|
1654
|
+
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1640
1655
|
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Completed),
|
|
1641
|
-
config: import_v48.z.
|
|
1656
|
+
config: import_v48.z.object({
|
|
1642
1657
|
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1643
1658
|
startBlock: makeBlockRefSchema(valueLabel),
|
|
1644
1659
|
endBlock: makeBlockRefSchema(valueLabel)
|
|
1645
1660
|
}),
|
|
1646
1661
|
latestIndexedBlock: makeBlockRefSchema(valueLabel)
|
|
1647
1662
|
}).check(invariant_chainSnapshotCompletedBlocks);
|
|
1648
|
-
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => import_v48.z.
|
|
1663
|
+
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1649
1664
|
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Following),
|
|
1650
|
-
config: import_v48.z.
|
|
1665
|
+
config: import_v48.z.object({
|
|
1651
1666
|
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1652
1667
|
startBlock: makeBlockRefSchema(valueLabel)
|
|
1653
1668
|
}),
|
|
@@ -1660,7 +1675,10 @@ var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v48
|
|
|
1660
1675
|
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
1661
1676
|
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
|
|
1662
1677
|
]);
|
|
1663
|
-
var
|
|
1678
|
+
var makeSerializedChainIndexingStatusSnapshotSchema = makeChainIndexingStatusSnapshotSchema;
|
|
1679
|
+
|
|
1680
|
+
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1681
|
+
var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v49.z.record(makeChainIdStringSchema(), makeChainIndexingStatusSnapshotSchema(valueLabel), {
|
|
1664
1682
|
error: "Chains indexing statuses must be an object mapping valid chain IDs to their indexing status snapshots."
|
|
1665
1683
|
}).transform((serializedChainsIndexingStatus) => {
|
|
1666
1684
|
const chainsIndexingStatus = /* @__PURE__ */ new Map();
|
|
@@ -1669,29 +1687,29 @@ var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v48.z.rec
|
|
|
1669
1687
|
}
|
|
1670
1688
|
return chainsIndexingStatus;
|
|
1671
1689
|
});
|
|
1672
|
-
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) =>
|
|
1673
|
-
omnichainStatus:
|
|
1690
|
+
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v49.z.strictObject({
|
|
1691
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Unstarted),
|
|
1674
1692
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainSnapshotUnstartedHasValidChains).transform((chains) => chains),
|
|
1675
1693
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1676
1694
|
});
|
|
1677
|
-
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =>
|
|
1678
|
-
omnichainStatus:
|
|
1695
|
+
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v49.z.strictObject({
|
|
1696
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Backfill),
|
|
1679
1697
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotBackfillHasValidChains).transform(
|
|
1680
1698
|
(chains) => chains
|
|
1681
1699
|
),
|
|
1682
1700
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1683
1701
|
});
|
|
1684
|
-
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) =>
|
|
1685
|
-
omnichainStatus:
|
|
1702
|
+
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v49.z.strictObject({
|
|
1703
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Completed),
|
|
1686
1704
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotCompletedHasValidChains).transform((chains) => chains),
|
|
1687
1705
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1688
1706
|
});
|
|
1689
|
-
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) =>
|
|
1690
|
-
omnichainStatus:
|
|
1707
|
+
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v49.z.strictObject({
|
|
1708
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Following),
|
|
1691
1709
|
chains: makeChainIndexingStatusesSchema(valueLabel),
|
|
1692
1710
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1693
1711
|
});
|
|
1694
|
-
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") =>
|
|
1712
|
+
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => import_v49.z.discriminatedUnion("omnichainStatus", [
|
|
1695
1713
|
makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
|
|
1696
1714
|
makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1697
1715
|
makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
@@ -1699,41 +1717,29 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
|
|
|
1699
1717
|
]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
|
|
1700
1718
|
invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
|
|
1701
1719
|
).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
|
|
1702
|
-
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") =>
|
|
1703
|
-
strategy:
|
|
1720
|
+
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => import_v49.z.strictObject({
|
|
1721
|
+
strategy: import_v49.z.literal(CrossChainIndexingStrategyIds.Omnichain),
|
|
1704
1722
|
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1705
1723
|
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1706
1724
|
omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
1707
1725
|
}).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
|
|
1708
|
-
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") =>
|
|
1726
|
+
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => import_v49.z.discriminatedUnion("strategy", [
|
|
1709
1727
|
makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
|
|
1710
1728
|
]);
|
|
1711
|
-
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") =>
|
|
1729
|
+
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v49.z.strictObject({
|
|
1712
1730
|
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1713
1731
|
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1714
1732
|
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
1715
1733
|
}).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
|
|
1716
1734
|
|
|
1717
1735
|
// src/ensindexer/indexing-status/deserialize.ts
|
|
1718
|
-
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1719
|
-
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1720
|
-
const parsed = schema.safeParse(maybeSnapshot);
|
|
1721
|
-
if (parsed.error) {
|
|
1722
|
-
throw new Error(
|
|
1723
|
-
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
1724
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1725
|
-
`
|
|
1726
|
-
);
|
|
1727
|
-
}
|
|
1728
|
-
return parsed.data;
|
|
1729
|
-
}
|
|
1730
1736
|
function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1731
1737
|
const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
|
|
1732
1738
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
1733
1739
|
if (parsed.error) {
|
|
1734
1740
|
throw new Error(
|
|
1735
1741
|
`Cannot deserialize into OmnichainIndexingStatusSnapshot:
|
|
1736
|
-
${(0,
|
|
1742
|
+
${(0, import_v410.prettifyError)(parsed.error)}
|
|
1737
1743
|
`
|
|
1738
1744
|
);
|
|
1739
1745
|
}
|
|
@@ -1745,7 +1751,7 @@ function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel)
|
|
|
1745
1751
|
if (parsed.error) {
|
|
1746
1752
|
throw new Error(
|
|
1747
1753
|
`Cannot deserialize into CrossChainIndexingStatusSnapshot:
|
|
1748
|
-
${(0,
|
|
1754
|
+
${(0, import_v410.prettifyError)(parsed.error)}
|
|
1749
1755
|
`
|
|
1750
1756
|
);
|
|
1751
1757
|
}
|
|
@@ -1757,7 +1763,22 @@ function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel
|
|
|
1757
1763
|
if (parsed.error) {
|
|
1758
1764
|
throw new Error(
|
|
1759
1765
|
`Cannot deserialize into RealtimeIndexingStatusProjection:
|
|
1760
|
-
${(0,
|
|
1766
|
+
${(0, import_v410.prettifyError)(parsed.error)}
|
|
1767
|
+
`
|
|
1768
|
+
);
|
|
1769
|
+
}
|
|
1770
|
+
return parsed.data;
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
// src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
1774
|
+
var import_v411 = require("zod/v4");
|
|
1775
|
+
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1776
|
+
const schema = makeSerializedChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1777
|
+
const parsed = schema.safeParse(maybeSnapshot);
|
|
1778
|
+
if (parsed.error) {
|
|
1779
|
+
throw new Error(
|
|
1780
|
+
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
1781
|
+
${(0, import_v411.prettifyError)(parsed.error)}
|
|
1761
1782
|
`
|
|
1762
1783
|
);
|
|
1763
1784
|
}
|
|
@@ -1818,6 +1839,15 @@ function formatAssetId({
|
|
|
1818
1839
|
}).toLowerCase();
|
|
1819
1840
|
}
|
|
1820
1841
|
|
|
1842
|
+
// src/ensindexer/indexing-status/serialize/chain-indexing-status-snapshot.ts
|
|
1843
|
+
function serializeChainIndexingSnapshots(chains) {
|
|
1844
|
+
const serializedSnapshots = {};
|
|
1845
|
+
for (const [chainId, snapshot] of chains.entries()) {
|
|
1846
|
+
serializedSnapshots[serializeChainId(chainId)] = snapshot;
|
|
1847
|
+
}
|
|
1848
|
+
return serializedSnapshots;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1821
1851
|
// src/ensindexer/indexing-status/serialize.ts
|
|
1822
1852
|
function serializeCrossChainIndexingStatusSnapshotOmnichain({
|
|
1823
1853
|
strategy,
|
|
@@ -1839,13 +1869,6 @@ function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
|
1839
1869
|
snapshot: serializeCrossChainIndexingStatusSnapshotOmnichain(indexingProjection.snapshot)
|
|
1840
1870
|
};
|
|
1841
1871
|
}
|
|
1842
|
-
function serializeChainIndexingSnapshots(chains) {
|
|
1843
|
-
const serializedSnapshots = {};
|
|
1844
|
-
for (const [chainId, snapshot] of chains.entries()) {
|
|
1845
|
-
serializedSnapshots[serializeChainId(chainId)] = snapshot;
|
|
1846
|
-
}
|
|
1847
|
-
return serializedSnapshots;
|
|
1848
|
-
}
|
|
1849
1872
|
function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
|
|
1850
1873
|
switch (indexingStatus.omnichainStatus) {
|
|
1851
1874
|
case OmnichainIndexingStatusIds.Unstarted:
|
|
@@ -1876,6 +1899,19 @@ function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
|
|
|
1876
1899
|
}
|
|
1877
1900
|
}
|
|
1878
1901
|
|
|
1902
|
+
// src/ensindexer/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
1903
|
+
var import_v412 = require("zod/v4");
|
|
1904
|
+
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
1905
|
+
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1906
|
+
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
1907
|
+
if (parsed.error) {
|
|
1908
|
+
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
1909
|
+
${(0, import_v412.prettifyError)(parsed.error)}
|
|
1910
|
+
`);
|
|
1911
|
+
}
|
|
1912
|
+
return parsed.data;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1879
1915
|
// src/ensapi/config/serialize.ts
|
|
1880
1916
|
function serializeENSApiPublicConfig(config) {
|
|
1881
1917
|
const { version, theGraphFallback, ensIndexerPublicConfig } = config;
|
|
@@ -1897,10 +1933,10 @@ function serializeConfigResponse(response) {
|
|
|
1897
1933
|
}
|
|
1898
1934
|
|
|
1899
1935
|
// src/api/indexing-status/deserialize.ts
|
|
1900
|
-
var
|
|
1936
|
+
var import_v414 = require("zod/v4");
|
|
1901
1937
|
|
|
1902
1938
|
// src/api/indexing-status/zod-schemas.ts
|
|
1903
|
-
var
|
|
1939
|
+
var import_v413 = require("zod/v4");
|
|
1904
1940
|
|
|
1905
1941
|
// src/api/indexing-status/response.ts
|
|
1906
1942
|
var IndexingStatusResponseCodes = {
|
|
@@ -1915,14 +1951,14 @@ var IndexingStatusResponseCodes = {
|
|
|
1915
1951
|
};
|
|
1916
1952
|
|
|
1917
1953
|
// src/api/indexing-status/zod-schemas.ts
|
|
1918
|
-
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") =>
|
|
1919
|
-
responseCode:
|
|
1954
|
+
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v413.z.strictObject({
|
|
1955
|
+
responseCode: import_v413.z.literal(IndexingStatusResponseCodes.Ok),
|
|
1920
1956
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1921
1957
|
});
|
|
1922
|
-
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") =>
|
|
1923
|
-
responseCode:
|
|
1958
|
+
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v413.z.strictObject({
|
|
1959
|
+
responseCode: import_v413.z.literal(IndexingStatusResponseCodes.Error)
|
|
1924
1960
|
});
|
|
1925
|
-
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") =>
|
|
1961
|
+
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v413.z.discriminatedUnion("responseCode", [
|
|
1926
1962
|
makeIndexingStatusResponseOkSchema(valueLabel),
|
|
1927
1963
|
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
1928
1964
|
]);
|
|
@@ -1932,7 +1968,7 @@ function deserializeIndexingStatusResponse(maybeResponse) {
|
|
|
1932
1968
|
const parsed = makeIndexingStatusResponseSchema().safeParse(maybeResponse);
|
|
1933
1969
|
if (parsed.error) {
|
|
1934
1970
|
throw new Error(`Cannot deserialize IndexingStatusResponse:
|
|
1935
|
-
${(0,
|
|
1971
|
+
${(0, import_v414.prettifyError)(parsed.error)}
|
|
1936
1972
|
`);
|
|
1937
1973
|
}
|
|
1938
1974
|
return parsed.data;
|
|
@@ -1952,20 +1988,20 @@ function serializeIndexingStatusResponse(response) {
|
|
|
1952
1988
|
}
|
|
1953
1989
|
|
|
1954
1990
|
// src/api/name-tokens/deserialize.ts
|
|
1955
|
-
var
|
|
1991
|
+
var import_v419 = require("zod/v4");
|
|
1956
1992
|
|
|
1957
1993
|
// src/api/name-tokens/zod-schemas.ts
|
|
1958
1994
|
var import_viem14 = require("viem");
|
|
1959
|
-
var
|
|
1995
|
+
var import_v418 = require("zod/v4");
|
|
1960
1996
|
|
|
1961
1997
|
// src/tokenscope/assets.ts
|
|
1962
1998
|
var import_viem13 = require("viem");
|
|
1963
|
-
var
|
|
1999
|
+
var import_v416 = require("zod/v4");
|
|
1964
2000
|
|
|
1965
2001
|
// src/tokenscope/zod-schemas.ts
|
|
1966
2002
|
var import_caip3 = require("caip");
|
|
1967
2003
|
var import_viem12 = require("viem");
|
|
1968
|
-
var
|
|
2004
|
+
var import_v415 = require("zod/v4");
|
|
1969
2005
|
|
|
1970
2006
|
// src/shared/types.ts
|
|
1971
2007
|
var AssetNamespaces = {
|
|
@@ -2088,10 +2124,10 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2088
2124
|
}
|
|
2089
2125
|
|
|
2090
2126
|
// src/tokenscope/zod-schemas.ts
|
|
2091
|
-
var tokenIdSchemaSerializable =
|
|
2092
|
-
var tokenIdSchemaNative =
|
|
2127
|
+
var tokenIdSchemaSerializable = import_v415.z.string();
|
|
2128
|
+
var tokenIdSchemaNative = import_v415.z.preprocess(
|
|
2093
2129
|
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2094
|
-
|
|
2130
|
+
import_v415.z.bigint().positive()
|
|
2095
2131
|
);
|
|
2096
2132
|
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2097
2133
|
if (serializable) {
|
|
@@ -2101,13 +2137,13 @@ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false
|
|
|
2101
2137
|
}
|
|
2102
2138
|
}
|
|
2103
2139
|
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2104
|
-
return
|
|
2105
|
-
assetNamespace:
|
|
2140
|
+
return import_v415.z.object({
|
|
2141
|
+
assetNamespace: import_v415.z.enum(AssetNamespaces),
|
|
2106
2142
|
contract: makeAccountIdSchema(valueLabel),
|
|
2107
2143
|
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2108
2144
|
});
|
|
2109
2145
|
};
|
|
2110
|
-
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") =>
|
|
2146
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v415.z.preprocess((v) => {
|
|
2111
2147
|
if (typeof v === "string") {
|
|
2112
2148
|
const result = new import_caip3.AssetId(v);
|
|
2113
2149
|
return {
|
|
@@ -2131,20 +2167,20 @@ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
|
2131
2167
|
});
|
|
2132
2168
|
}
|
|
2133
2169
|
}
|
|
2134
|
-
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") =>
|
|
2135
|
-
ownershipType:
|
|
2170
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v415.z.object({
|
|
2171
|
+
ownershipType: import_v415.z.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2136
2172
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2137
2173
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2138
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") =>
|
|
2139
|
-
ownershipType:
|
|
2174
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v415.z.object({
|
|
2175
|
+
ownershipType: import_v415.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2140
2176
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2141
2177
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2142
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") =>
|
|
2143
|
-
ownershipType:
|
|
2178
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v415.z.object({
|
|
2179
|
+
ownershipType: import_v415.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2144
2180
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2145
2181
|
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2146
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") =>
|
|
2147
|
-
ownershipType:
|
|
2182
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v415.z.object({
|
|
2183
|
+
ownershipType: import_v415.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2148
2184
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2149
2185
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2150
2186
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
@@ -2157,16 +2193,16 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
|
2157
2193
|
});
|
|
2158
2194
|
}
|
|
2159
2195
|
}
|
|
2160
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") =>
|
|
2196
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v415.z.discriminatedUnion("ownershipType", [
|
|
2161
2197
|
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2162
2198
|
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2163
2199
|
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2164
2200
|
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2165
2201
|
]);
|
|
2166
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) =>
|
|
2202
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v415.z.object({
|
|
2167
2203
|
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2168
2204
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2169
|
-
mintStatus:
|
|
2205
|
+
mintStatus: import_v415.z.enum(NFTMintStatuses)
|
|
2170
2206
|
});
|
|
2171
2207
|
|
|
2172
2208
|
// src/tokenscope/assets.ts
|
|
@@ -2182,7 +2218,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2182
2218
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2183
2219
|
if (parsed.error) {
|
|
2184
2220
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2185
|
-
${(0,
|
|
2221
|
+
${(0, import_v416.prettifyError)(parsed.error)}
|
|
2186
2222
|
`);
|
|
2187
2223
|
}
|
|
2188
2224
|
return parsed.data;
|
|
@@ -2192,7 +2228,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
2192
2228
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2193
2229
|
if (parsed.error) {
|
|
2194
2230
|
throw new RangeError(`Cannot parse AssetId:
|
|
2195
|
-
${(0,
|
|
2231
|
+
${(0, import_v416.prettifyError)(parsed.error)}
|
|
2196
2232
|
`);
|
|
2197
2233
|
}
|
|
2198
2234
|
return parsed.data;
|
|
@@ -2414,10 +2450,10 @@ ${formatNFTTransferEventMetadata(metadata)}`
|
|
|
2414
2450
|
};
|
|
2415
2451
|
|
|
2416
2452
|
// src/api/shared/errors/zod-schemas.ts
|
|
2417
|
-
var
|
|
2418
|
-
var ErrorResponseSchema =
|
|
2419
|
-
message:
|
|
2420
|
-
details:
|
|
2453
|
+
var import_v417 = require("zod/v4");
|
|
2454
|
+
var ErrorResponseSchema = import_v417.z.object({
|
|
2455
|
+
message: import_v417.z.string(),
|
|
2456
|
+
details: import_v417.z.optional(import_v417.z.unknown())
|
|
2421
2457
|
});
|
|
2422
2458
|
|
|
2423
2459
|
// src/api/name-tokens/response.ts
|
|
@@ -2456,10 +2492,10 @@ var NameTokensResponseErrorCodes = {
|
|
|
2456
2492
|
};
|
|
2457
2493
|
|
|
2458
2494
|
// src/api/name-tokens/zod-schemas.ts
|
|
2459
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) =>
|
|
2495
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v418.z.object({
|
|
2460
2496
|
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2461
2497
|
name: makeReinterpretedNameSchema(valueLabel),
|
|
2462
|
-
tokens:
|
|
2498
|
+
tokens: import_v418.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2463
2499
|
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2464
2500
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2465
2501
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
@@ -2501,32 +2537,32 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2501
2537
|
});
|
|
2502
2538
|
}
|
|
2503
2539
|
});
|
|
2504
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) =>
|
|
2505
|
-
responseCode:
|
|
2540
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v418.z.strictObject({
|
|
2541
|
+
responseCode: import_v418.z.literal(NameTokensResponseCodes.Ok),
|
|
2506
2542
|
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2507
2543
|
});
|
|
2508
|
-
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") =>
|
|
2509
|
-
responseCode:
|
|
2510
|
-
errorCode:
|
|
2544
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v418.z.strictObject({
|
|
2545
|
+
responseCode: import_v418.z.literal(NameTokensResponseCodes.Error),
|
|
2546
|
+
errorCode: import_v418.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2511
2547
|
error: ErrorResponseSchema
|
|
2512
2548
|
});
|
|
2513
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2514
|
-
responseCode:
|
|
2515
|
-
errorCode:
|
|
2549
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v418.z.strictObject({
|
|
2550
|
+
responseCode: import_v418.z.literal(NameTokensResponseCodes.Error),
|
|
2551
|
+
errorCode: import_v418.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2516
2552
|
error: ErrorResponseSchema
|
|
2517
2553
|
});
|
|
2518
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2519
|
-
responseCode:
|
|
2520
|
-
errorCode:
|
|
2554
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v418.z.strictObject({
|
|
2555
|
+
responseCode: import_v418.z.literal(NameTokensResponseCodes.Error),
|
|
2556
|
+
errorCode: import_v418.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2521
2557
|
error: ErrorResponseSchema
|
|
2522
2558
|
});
|
|
2523
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2559
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v418.z.discriminatedUnion("errorCode", [
|
|
2524
2560
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2525
2561
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2526
2562
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2527
2563
|
]);
|
|
2528
2564
|
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2529
|
-
return
|
|
2565
|
+
return import_v418.z.discriminatedUnion("responseCode", [
|
|
2530
2566
|
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2531
2567
|
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2532
2568
|
]);
|
|
@@ -2539,7 +2575,7 @@ function deserializedNameTokensResponse(maybeResponse) {
|
|
|
2539
2575
|
);
|
|
2540
2576
|
if (parsed.error) {
|
|
2541
2577
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2542
|
-
${(0,
|
|
2578
|
+
${(0, import_v419.prettifyError)(parsed.error)}
|
|
2543
2579
|
`);
|
|
2544
2580
|
}
|
|
2545
2581
|
return parsed.data;
|
|
@@ -2613,14 +2649,14 @@ function serializeNameTokensResponse(response) {
|
|
|
2613
2649
|
}
|
|
2614
2650
|
|
|
2615
2651
|
// src/api/registrar-actions/deserialize.ts
|
|
2616
|
-
var
|
|
2652
|
+
var import_v423 = require("zod/v4");
|
|
2617
2653
|
|
|
2618
2654
|
// src/api/registrar-actions/zod-schemas.ts
|
|
2619
2655
|
var import_ens7 = require("viem/ens");
|
|
2620
|
-
var
|
|
2656
|
+
var import_v422 = require("zod/v4");
|
|
2621
2657
|
|
|
2622
2658
|
// src/registrars/zod-schemas.ts
|
|
2623
|
-
var
|
|
2659
|
+
var import_v420 = require("zod/v4");
|
|
2624
2660
|
|
|
2625
2661
|
// src/registrars/encoded-referrer.ts
|
|
2626
2662
|
var import_viem15 = require("viem");
|
|
@@ -2695,11 +2731,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
2695
2731
|
}
|
|
2696
2732
|
|
|
2697
2733
|
// src/registrars/zod-schemas.ts
|
|
2698
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
2734
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v420.z.object({
|
|
2699
2735
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
2700
2736
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
2701
2737
|
});
|
|
2702
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
2738
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v420.z.object({
|
|
2703
2739
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
2704
2740
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
2705
2741
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -2715,18 +2751,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
2715
2751
|
});
|
|
2716
2752
|
}
|
|
2717
2753
|
}
|
|
2718
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
2754
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v420.z.union([
|
|
2719
2755
|
// pricing available
|
|
2720
|
-
|
|
2756
|
+
import_v420.z.object({
|
|
2721
2757
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
2722
2758
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
2723
2759
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
2724
2760
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
2725
2761
|
// pricing unknown
|
|
2726
|
-
|
|
2727
|
-
baseCost:
|
|
2728
|
-
premium:
|
|
2729
|
-
total:
|
|
2762
|
+
import_v420.z.object({
|
|
2763
|
+
baseCost: import_v420.z.null(),
|
|
2764
|
+
premium: import_v420.z.null(),
|
|
2765
|
+
total: import_v420.z.null()
|
|
2730
2766
|
}).transform((v) => v)
|
|
2731
2767
|
]);
|
|
2732
2768
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -2749,9 +2785,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
2749
2785
|
});
|
|
2750
2786
|
}
|
|
2751
2787
|
}
|
|
2752
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
2788
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v420.z.union([
|
|
2753
2789
|
// referral available
|
|
2754
|
-
|
|
2790
|
+
import_v420.z.object({
|
|
2755
2791
|
encodedReferrer: makeHexStringSchema(
|
|
2756
2792
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
2757
2793
|
`${valueLabel} Encoded Referrer`
|
|
@@ -2759,9 +2795,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
2759
2795
|
decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
2760
2796
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
2761
2797
|
// referral not applicable
|
|
2762
|
-
|
|
2763
|
-
encodedReferrer:
|
|
2764
|
-
decodedReferrer:
|
|
2798
|
+
import_v420.z.object({
|
|
2799
|
+
encodedReferrer: import_v420.z.null(),
|
|
2800
|
+
decodedReferrer: import_v420.z.null()
|
|
2765
2801
|
})
|
|
2766
2802
|
]);
|
|
2767
2803
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -2774,9 +2810,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
2774
2810
|
});
|
|
2775
2811
|
}
|
|
2776
2812
|
}
|
|
2777
|
-
var EventIdSchema =
|
|
2778
|
-
var EventIdsSchema =
|
|
2779
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
2813
|
+
var EventIdSchema = import_v420.z.string().nonempty();
|
|
2814
|
+
var EventIdsSchema = import_v420.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
2815
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v420.z.object({
|
|
2780
2816
|
id: EventIdSchema,
|
|
2781
2817
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
2782
2818
|
registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2790,38 +2826,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => im
|
|
|
2790
2826
|
eventIds: EventIdsSchema
|
|
2791
2827
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2792
2828
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2793
|
-
type:
|
|
2829
|
+
type: import_v420.z.literal(RegistrarActionTypes.Registration)
|
|
2794
2830
|
});
|
|
2795
2831
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2796
|
-
type:
|
|
2832
|
+
type: import_v420.z.literal(RegistrarActionTypes.Renewal)
|
|
2797
2833
|
});
|
|
2798
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
2834
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v420.z.discriminatedUnion("type", [
|
|
2799
2835
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2800
2836
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2801
2837
|
]);
|
|
2802
2838
|
|
|
2803
2839
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2804
|
-
var
|
|
2840
|
+
var import_v421 = require("zod/v4");
|
|
2805
2841
|
|
|
2806
2842
|
// src/api/shared/pagination/request.ts
|
|
2807
2843
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2808
2844
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
2809
2845
|
|
|
2810
2846
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2811
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
2847
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v421.z.object({
|
|
2812
2848
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2813
2849
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
2814
2850
|
RECORDS_PER_PAGE_MAX,
|
|
2815
2851
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
2816
2852
|
)
|
|
2817
2853
|
});
|
|
2818
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
2819
|
-
totalRecords:
|
|
2820
|
-
totalPages:
|
|
2821
|
-
hasNext:
|
|
2822
|
-
hasPrev:
|
|
2823
|
-
startIndex:
|
|
2824
|
-
endIndex:
|
|
2854
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v421.z.object({
|
|
2855
|
+
totalRecords: import_v421.z.literal(0),
|
|
2856
|
+
totalPages: import_v421.z.literal(1),
|
|
2857
|
+
hasNext: import_v421.z.literal(false),
|
|
2858
|
+
hasPrev: import_v421.z.literal(false),
|
|
2859
|
+
startIndex: import_v421.z.undefined(),
|
|
2860
|
+
endIndex: import_v421.z.undefined()
|
|
2825
2861
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
2826
2862
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
2827
2863
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -2856,15 +2892,15 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
2856
2892
|
});
|
|
2857
2893
|
}
|
|
2858
2894
|
}
|
|
2859
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
2895
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v421.z.object({
|
|
2860
2896
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2861
2897
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2862
|
-
hasNext:
|
|
2863
|
-
hasPrev:
|
|
2898
|
+
hasNext: import_v421.z.boolean(),
|
|
2899
|
+
hasPrev: import_v421.z.boolean(),
|
|
2864
2900
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
2865
2901
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
2866
2902
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
2867
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
2903
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v421.z.union([
|
|
2868
2904
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
2869
2905
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
2870
2906
|
]);
|
|
@@ -2894,21 +2930,21 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
2894
2930
|
});
|
|
2895
2931
|
}
|
|
2896
2932
|
}
|
|
2897
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
2933
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v422.z.object({
|
|
2898
2934
|
action: makeRegistrarActionSchema(valueLabel),
|
|
2899
2935
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
2900
2936
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2901
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
2902
|
-
responseCode:
|
|
2903
|
-
registrarActions:
|
|
2937
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v422.z.object({
|
|
2938
|
+
responseCode: import_v422.z.literal(RegistrarActionsResponseCodes.Ok),
|
|
2939
|
+
registrarActions: import_v422.z.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
2904
2940
|
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
2905
2941
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
|
|
2906
2942
|
});
|
|
2907
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
2908
|
-
responseCode:
|
|
2943
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v422.z.strictObject({
|
|
2944
|
+
responseCode: import_v422.z.literal(RegistrarActionsResponseCodes.Error),
|
|
2909
2945
|
error: ErrorResponseSchema
|
|
2910
2946
|
});
|
|
2911
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
2947
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v422.z.discriminatedUnion("responseCode", [
|
|
2912
2948
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2913
2949
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2914
2950
|
]);
|
|
@@ -2919,7 +2955,7 @@ function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
|
2919
2955
|
if (parsed.error) {
|
|
2920
2956
|
throw new Error(
|
|
2921
2957
|
`Cannot deserialize RegistrarActionsResponse:
|
|
2922
|
-
${(0,
|
|
2958
|
+
${(0, import_v423.prettifyError)(parsed.error)}
|
|
2923
2959
|
`
|
|
2924
2960
|
);
|
|
2925
2961
|
}
|
|
@@ -3167,12 +3203,12 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3167
3203
|
}
|
|
3168
3204
|
|
|
3169
3205
|
// src/api/shared/errors/deserialize.ts
|
|
3170
|
-
var
|
|
3206
|
+
var import_v424 = require("zod/v4");
|
|
3171
3207
|
function deserializeErrorResponse(maybeErrorResponse) {
|
|
3172
3208
|
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
3173
3209
|
if (parsed.error) {
|
|
3174
3210
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3175
|
-
${(0,
|
|
3211
|
+
${(0, import_v424.prettifyError)(parsed.error)}
|
|
3176
3212
|
`);
|
|
3177
3213
|
}
|
|
3178
3214
|
return parsed.data;
|