@ensnode/ensnode-sdk 0.0.0-next-20260210145458 → 0.0.0-next-20260211153531
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 +377 -365
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -89
- package/dist/index.d.ts +92 -89
- package/dist/index.js +371 -359
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1133,9 +1133,93 @@ function sortChainStatusesByStartBlockAsc(chains) {
|
|
|
1133
1133
|
}
|
|
1134
1134
|
|
|
1135
1135
|
// src/ensindexer/indexing-status/deserialize.ts
|
|
1136
|
-
var
|
|
1136
|
+
var import_v411 = require("zod/v4");
|
|
1137
1137
|
|
|
1138
1138
|
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1139
|
+
var import_v410 = require("zod/v4");
|
|
1140
|
+
|
|
1141
|
+
// src/ensindexer/indexing-status/types.ts
|
|
1142
|
+
var CrossChainIndexingStrategyIds = {
|
|
1143
|
+
/**
|
|
1144
|
+
* Represents that the indexing of events across all indexed chains will
|
|
1145
|
+
* proceed in a deterministic "omnichain" ordering by block timestamp, chain ID,
|
|
1146
|
+
* and block number.
|
|
1147
|
+
*
|
|
1148
|
+
* This strategy is "deterministic" in that the order of processing cross-chain indexed
|
|
1149
|
+
* events and each resulting indexed data state transition recorded in ENSDb is always
|
|
1150
|
+
* the same for each ENSIndexer instance operating with an equivalent
|
|
1151
|
+
* `ENSIndexerConfig` and ENSIndexer version. However it also has the drawbacks of:
|
|
1152
|
+
* - increased indexing latency that must wait for the slowest indexed chain to
|
|
1153
|
+
* add new blocks or to discover new blocks through the configured RPCs.
|
|
1154
|
+
* - if any indexed chain gets "stuck" due to chain or RPC failures, all indexed chains
|
|
1155
|
+
* will be affected.
|
|
1156
|
+
*/
|
|
1157
|
+
Omnichain: "omnichain"
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1160
|
+
// src/ensindexer/indexing-status/validations.ts
|
|
1161
|
+
function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
|
|
1162
|
+
const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
|
|
1163
|
+
const { omnichainIndexingCursor } = omnichainSnapshot;
|
|
1164
|
+
if (slowestChainIndexingCursor !== omnichainIndexingCursor) {
|
|
1165
|
+
console.log("invariant_slowestChainEqualsToOmnichainSnapshotTime", {
|
|
1166
|
+
slowestChainIndexingCursor,
|
|
1167
|
+
omnichainIndexingCursor
|
|
1168
|
+
});
|
|
1169
|
+
ctx.issues.push({
|
|
1170
|
+
code: "custom",
|
|
1171
|
+
input: ctx.value,
|
|
1172
|
+
message: `'slowestChainIndexingCursor' must be equal to 'omnichainSnapshot.omnichainIndexingCursor'`
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
1177
|
+
const { snapshotTime, omnichainSnapshot } = ctx.value;
|
|
1178
|
+
const chains = Array.from(omnichainSnapshot.chains.values());
|
|
1179
|
+
const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1180
|
+
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.configType === ChainIndexingConfigTypeIds.Definite).map((chainConfig) => chainConfig.endBlock.timestamp);
|
|
1181
|
+
const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
|
|
1182
|
+
const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
|
|
1183
|
+
const highestKnownBlockTimestamp = Math.max(
|
|
1184
|
+
...startBlockTimestamps,
|
|
1185
|
+
...endBlockTimestamps,
|
|
1186
|
+
...backfillEndBlockTimestamps,
|
|
1187
|
+
...latestKnownBlockTimestamps
|
|
1188
|
+
);
|
|
1189
|
+
if (snapshotTime < highestKnownBlockTimestamp) {
|
|
1190
|
+
ctx.issues.push({
|
|
1191
|
+
code: "custom",
|
|
1192
|
+
input: ctx.value,
|
|
1193
|
+
message: `'snapshotTime' (${snapshotTime}) must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
|
|
1198
|
+
const projection = ctx.value;
|
|
1199
|
+
const { snapshot, projectedAt } = projection;
|
|
1200
|
+
if (snapshot.snapshotTime > projectedAt) {
|
|
1201
|
+
ctx.issues.push({
|
|
1202
|
+
code: "custom",
|
|
1203
|
+
input: projection,
|
|
1204
|
+
message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ctx) {
|
|
1209
|
+
const projection = ctx.value;
|
|
1210
|
+
const { projectedAt, snapshot, worstCaseDistance } = projection;
|
|
1211
|
+
const { omnichainSnapshot } = snapshot;
|
|
1212
|
+
const expectedWorstCaseDistance = projectedAt - omnichainSnapshot.omnichainIndexingCursor;
|
|
1213
|
+
if (worstCaseDistance !== expectedWorstCaseDistance) {
|
|
1214
|
+
ctx.issues.push({
|
|
1215
|
+
code: "custom",
|
|
1216
|
+
input: projection,
|
|
1217
|
+
message: "`worstCaseDistance` must be the exact difference between `projectedAt` and `snapshot.omnichainIndexingCursor`."
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1139
1223
|
var import_v49 = require("zod/v4");
|
|
1140
1224
|
|
|
1141
1225
|
// src/shared/deserialize.ts
|
|
@@ -1261,7 +1345,7 @@ ${(0, import_v47.prettifyError)(parsed.error)}
|
|
|
1261
1345
|
return parsed.data;
|
|
1262
1346
|
}
|
|
1263
1347
|
|
|
1264
|
-
// src/ensindexer/indexing-status/
|
|
1348
|
+
// src/ensindexer/indexing-status/omnichain-indexing-status-snapshot.ts
|
|
1265
1349
|
var OmnichainIndexingStatusIds = {
|
|
1266
1350
|
/**
|
|
1267
1351
|
* Represents that omnichain indexing is not ready to begin yet because
|
|
@@ -1288,54 +1372,6 @@ var OmnichainIndexingStatusIds = {
|
|
|
1288
1372
|
*/
|
|
1289
1373
|
Completed: "omnichain-completed"
|
|
1290
1374
|
};
|
|
1291
|
-
var CrossChainIndexingStrategyIds = {
|
|
1292
|
-
/**
|
|
1293
|
-
* Represents that the indexing of events across all indexed chains will
|
|
1294
|
-
* proceed in a deterministic "omnichain" ordering by block timestamp, chain ID,
|
|
1295
|
-
* and block number.
|
|
1296
|
-
*
|
|
1297
|
-
* This strategy is "deterministic" in that the order of processing cross-chain indexed
|
|
1298
|
-
* events and each resulting indexed data state transition recorded in ENSDb is always
|
|
1299
|
-
* the same for each ENSIndexer instance operating with an equivalent
|
|
1300
|
-
* `ENSIndexerConfig` and ENSIndexer version. However it also has the drawbacks of:
|
|
1301
|
-
* - increased indexing latency that must wait for the slowest indexed chain to
|
|
1302
|
-
* add new blocks or to discover new blocks through the configured RPCs.
|
|
1303
|
-
* - if any indexed chain gets "stuck" due to chain or RPC failures, all indexed chains
|
|
1304
|
-
* will be affected.
|
|
1305
|
-
*/
|
|
1306
|
-
Omnichain: "omnichain"
|
|
1307
|
-
};
|
|
1308
|
-
|
|
1309
|
-
// src/ensindexer/indexing-status/helpers.ts
|
|
1310
|
-
function getOmnichainIndexingStatus(chains) {
|
|
1311
|
-
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains)) {
|
|
1312
|
-
return OmnichainIndexingStatusIds.Following;
|
|
1313
|
-
}
|
|
1314
|
-
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains)) {
|
|
1315
|
-
return OmnichainIndexingStatusIds.Backfill;
|
|
1316
|
-
}
|
|
1317
|
-
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains)) {
|
|
1318
|
-
return OmnichainIndexingStatusIds.Unstarted;
|
|
1319
|
-
}
|
|
1320
|
-
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains)) {
|
|
1321
|
-
return OmnichainIndexingStatusIds.Completed;
|
|
1322
|
-
}
|
|
1323
|
-
throw new Error(`Unable to determine omnichain indexing status for provided chains.`);
|
|
1324
|
-
}
|
|
1325
|
-
function getOmnichainIndexingCursor(chains) {
|
|
1326
|
-
if (chains.length === 0) {
|
|
1327
|
-
throw new Error(`Unable to determine omnichain indexing cursor when no chains were provided.`);
|
|
1328
|
-
}
|
|
1329
|
-
if (getOmnichainIndexingStatus(chains) === OmnichainIndexingStatusIds.Unstarted) {
|
|
1330
|
-
const earliestStartBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1331
|
-
return Math.min(...earliestStartBlockTimestamps) - 1;
|
|
1332
|
-
}
|
|
1333
|
-
const latestIndexedBlockTimestamps = chains.filter((chain) => chain.chainStatus !== ChainIndexingStatusIds.Queued).map((chain) => chain.latestIndexedBlock.timestamp);
|
|
1334
|
-
if (latestIndexedBlockTimestamps.length < 1) {
|
|
1335
|
-
throw new Error("latestIndexedBlockTimestamps array must include at least one element");
|
|
1336
|
-
}
|
|
1337
|
-
return Math.max(...latestIndexedBlockTimestamps);
|
|
1338
|
-
}
|
|
1339
1375
|
function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains) {
|
|
1340
1376
|
return chains.every((chain) => chain.chainStatus === ChainIndexingStatusIds.Queued);
|
|
1341
1377
|
}
|
|
@@ -1360,185 +1396,34 @@ function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(ch
|
|
|
1360
1396
|
);
|
|
1361
1397
|
return allChainsHaveValidStatuses;
|
|
1362
1398
|
}
|
|
1363
|
-
function
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
return null;
|
|
1367
|
-
}
|
|
1368
|
-
if (chainIndexingStatus.chainStatus === ChainIndexingStatusIds.Queued) {
|
|
1369
|
-
return null;
|
|
1370
|
-
}
|
|
1371
|
-
return chainIndexingStatus.latestIndexedBlock;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
// src/ensindexer/indexing-status/validations.ts
|
|
1375
|
-
function invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot(ctx) {
|
|
1376
|
-
const snapshot = ctx.value;
|
|
1377
|
-
const chains = Array.from(snapshot.chains.values());
|
|
1378
|
-
const expectedOmnichainStatus = getOmnichainIndexingStatus(chains);
|
|
1379
|
-
const actualOmnichainStatus = snapshot.omnichainStatus;
|
|
1380
|
-
if (expectedOmnichainStatus !== actualOmnichainStatus) {
|
|
1381
|
-
ctx.issues.push({
|
|
1382
|
-
code: "custom",
|
|
1383
|
-
input: snapshot,
|
|
1384
|
-
message: `'${actualOmnichainStatus}' is an invalid omnichainStatus. Expected '${expectedOmnichainStatus}' based on the statuses of individual chains.`
|
|
1385
|
-
});
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
function invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains(ctx) {
|
|
1389
|
-
const snapshot = ctx.value;
|
|
1390
|
-
const queuedChains = Array.from(snapshot.chains.values()).filter(
|
|
1391
|
-
(chain) => chain.chainStatus === ChainIndexingStatusIds.Queued
|
|
1392
|
-
);
|
|
1393
|
-
if (queuedChains.length === 0) {
|
|
1394
|
-
return;
|
|
1395
|
-
}
|
|
1396
|
-
const queuedChainStartBlocks = queuedChains.map((chain) => chain.config.startBlock.timestamp);
|
|
1397
|
-
const queuedChainEarliestStartBlock = Math.min(...queuedChainStartBlocks);
|
|
1398
|
-
if (snapshot.omnichainIndexingCursor >= queuedChainEarliestStartBlock) {
|
|
1399
|
-
ctx.issues.push({
|
|
1400
|
-
code: "custom",
|
|
1401
|
-
input: snapshot,
|
|
1402
|
-
message: "`omnichainIndexingCursor` must be lower than the earliest start block across all queued chains."
|
|
1403
|
-
});
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
function invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains(ctx) {
|
|
1407
|
-
const snapshot = ctx.value;
|
|
1408
|
-
const backfillChains = Array.from(snapshot.chains.values()).filter(
|
|
1409
|
-
(chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
|
|
1410
|
-
);
|
|
1411
|
-
if (backfillChains.length === 0) {
|
|
1412
|
-
return;
|
|
1413
|
-
}
|
|
1414
|
-
const backfillEndBlocks = backfillChains.map((chain) => chain.backfillEndBlock.timestamp);
|
|
1415
|
-
const highestBackfillEndBlock = Math.max(...backfillEndBlocks);
|
|
1416
|
-
if (snapshot.omnichainIndexingCursor > highestBackfillEndBlock) {
|
|
1417
|
-
ctx.issues.push({
|
|
1418
|
-
code: "custom",
|
|
1419
|
-
input: snapshot,
|
|
1420
|
-
message: "`omnichainIndexingCursor` must be lower than or equal to the highest `backfillEndBlock` across all backfill chains."
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
function invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain(ctx) {
|
|
1425
|
-
const snapshot = ctx.value;
|
|
1426
|
-
const indexedChains = Array.from(snapshot.chains.values()).filter(
|
|
1427
|
-
(chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed || chain.chainStatus === ChainIndexingStatusIds.Following
|
|
1428
|
-
);
|
|
1429
|
-
if (indexedChains.length === 0) {
|
|
1430
|
-
return;
|
|
1431
|
-
}
|
|
1432
|
-
const indexedChainLatestIndexedBlocks = indexedChains.map(
|
|
1433
|
-
(chain) => chain.latestIndexedBlock.timestamp
|
|
1434
|
-
);
|
|
1435
|
-
const indexedChainHighestLatestIndexedBlock = Math.max(...indexedChainLatestIndexedBlocks);
|
|
1436
|
-
if (snapshot.omnichainIndexingCursor !== indexedChainHighestLatestIndexedBlock) {
|
|
1437
|
-
ctx.issues.push({
|
|
1438
|
-
code: "custom",
|
|
1439
|
-
input: snapshot,
|
|
1440
|
-
message: "`omnichainIndexingCursor` must be same as the highest `latestIndexedBlock` across all indexed chains."
|
|
1441
|
-
});
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
function invariant_omnichainSnapshotUnstartedHasValidChains(ctx) {
|
|
1445
|
-
const chains = ctx.value;
|
|
1446
|
-
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(
|
|
1447
|
-
Array.from(chains.values())
|
|
1448
|
-
);
|
|
1449
|
-
if (hasValidChains === false) {
|
|
1450
|
-
ctx.issues.push({
|
|
1451
|
-
code: "custom",
|
|
1452
|
-
input: chains,
|
|
1453
|
-
message: `For omnichain status snapshot 'unstarted', all chains must have "queued" status.`
|
|
1454
|
-
});
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
function invariant_omnichainStatusSnapshotBackfillHasValidChains(ctx) {
|
|
1458
|
-
const chains = ctx.value;
|
|
1459
|
-
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(
|
|
1460
|
-
Array.from(chains.values())
|
|
1461
|
-
);
|
|
1462
|
-
if (hasValidChains === false) {
|
|
1463
|
-
ctx.issues.push({
|
|
1464
|
-
code: "custom",
|
|
1465
|
-
input: chains,
|
|
1466
|
-
message: `For omnichain status snapshot 'backfill', at least one chain must be in "backfill" status and each chain has to have a status of either "queued", "backfill" or "completed".`
|
|
1467
|
-
});
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
function invariant_omnichainStatusSnapshotCompletedHasValidChains(ctx) {
|
|
1471
|
-
const chains = ctx.value;
|
|
1472
|
-
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(
|
|
1473
|
-
Array.from(chains.values())
|
|
1474
|
-
);
|
|
1475
|
-
if (hasValidChains === false) {
|
|
1476
|
-
ctx.issues.push({
|
|
1477
|
-
code: "custom",
|
|
1478
|
-
input: chains,
|
|
1479
|
-
message: `For omnichain status snapshot 'completed', all chains must have "completed" status.`
|
|
1480
|
-
});
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
|
|
1484
|
-
const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
|
|
1485
|
-
const { omnichainIndexingCursor } = omnichainSnapshot;
|
|
1486
|
-
if (slowestChainIndexingCursor !== omnichainIndexingCursor) {
|
|
1487
|
-
console.log("invariant_slowestChainEqualsToOmnichainSnapshotTime", {
|
|
1488
|
-
slowestChainIndexingCursor,
|
|
1489
|
-
omnichainIndexingCursor
|
|
1490
|
-
});
|
|
1491
|
-
ctx.issues.push({
|
|
1492
|
-
code: "custom",
|
|
1493
|
-
input: ctx.value,
|
|
1494
|
-
message: `'slowestChainIndexingCursor' must be equal to 'omnichainSnapshot.omnichainIndexingCursor'`
|
|
1495
|
-
});
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
1499
|
-
const { snapshotTime, omnichainSnapshot } = ctx.value;
|
|
1500
|
-
const chains = Array.from(omnichainSnapshot.chains.values());
|
|
1501
|
-
const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1502
|
-
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.configType === ChainIndexingConfigTypeIds.Definite).map((chainConfig) => chainConfig.endBlock.timestamp);
|
|
1503
|
-
const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
|
|
1504
|
-
const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
|
|
1505
|
-
const highestKnownBlockTimestamp = Math.max(
|
|
1506
|
-
...startBlockTimestamps,
|
|
1507
|
-
...endBlockTimestamps,
|
|
1508
|
-
...backfillEndBlockTimestamps,
|
|
1509
|
-
...latestKnownBlockTimestamps
|
|
1510
|
-
);
|
|
1511
|
-
if (snapshotTime < highestKnownBlockTimestamp) {
|
|
1512
|
-
ctx.issues.push({
|
|
1513
|
-
code: "custom",
|
|
1514
|
-
input: ctx.value,
|
|
1515
|
-
message: `'snapshotTime' (${snapshotTime}) must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
|
|
1516
|
-
});
|
|
1399
|
+
function getOmnichainIndexingStatus(chains) {
|
|
1400
|
+
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains)) {
|
|
1401
|
+
return OmnichainIndexingStatusIds.Following;
|
|
1517
1402
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
const projection = ctx.value;
|
|
1521
|
-
const { snapshot, projectedAt } = projection;
|
|
1522
|
-
if (snapshot.snapshotTime > projectedAt) {
|
|
1523
|
-
ctx.issues.push({
|
|
1524
|
-
code: "custom",
|
|
1525
|
-
input: projection,
|
|
1526
|
-
message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
|
|
1527
|
-
});
|
|
1403
|
+
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains)) {
|
|
1404
|
+
return OmnichainIndexingStatusIds.Backfill;
|
|
1528
1405
|
}
|
|
1406
|
+
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains)) {
|
|
1407
|
+
return OmnichainIndexingStatusIds.Unstarted;
|
|
1408
|
+
}
|
|
1409
|
+
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains)) {
|
|
1410
|
+
return OmnichainIndexingStatusIds.Completed;
|
|
1411
|
+
}
|
|
1412
|
+
throw new Error(`Unable to determine omnichain indexing status for provided chains.`);
|
|
1529
1413
|
}
|
|
1530
|
-
function
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1414
|
+
function getOmnichainIndexingCursor(chains) {
|
|
1415
|
+
if (chains.length === 0) {
|
|
1416
|
+
throw new Error(`Unable to determine omnichain indexing cursor when no chains were provided.`);
|
|
1417
|
+
}
|
|
1418
|
+
if (getOmnichainIndexingStatus(chains) === OmnichainIndexingStatusIds.Unstarted) {
|
|
1419
|
+
const earliestStartBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1420
|
+
return Math.min(...earliestStartBlockTimestamps) - 1;
|
|
1421
|
+
}
|
|
1422
|
+
const latestIndexedBlockTimestamps = chains.filter((chain) => chain.chainStatus !== ChainIndexingStatusIds.Queued).map((chain) => chain.latestIndexedBlock.timestamp);
|
|
1423
|
+
if (latestIndexedBlockTimestamps.length < 1) {
|
|
1424
|
+
throw new Error("latestIndexedBlockTimestamps array must include at least one element");
|
|
1541
1425
|
}
|
|
1426
|
+
return Math.max(...latestIndexedBlockTimestamps);
|
|
1542
1427
|
}
|
|
1543
1428
|
|
|
1544
1429
|
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
@@ -1677,7 +1562,115 @@ var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v48
|
|
|
1677
1562
|
]);
|
|
1678
1563
|
var makeSerializedChainIndexingStatusSnapshotSchema = makeChainIndexingStatusSnapshotSchema;
|
|
1679
1564
|
|
|
1680
|
-
// src/ensindexer/indexing-status/zod-
|
|
1565
|
+
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1566
|
+
function invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot(ctx) {
|
|
1567
|
+
const snapshot = ctx.value;
|
|
1568
|
+
const chains = Array.from(snapshot.chains.values());
|
|
1569
|
+
const expectedOmnichainStatus = getOmnichainIndexingStatus(chains);
|
|
1570
|
+
const actualOmnichainStatus = snapshot.omnichainStatus;
|
|
1571
|
+
if (expectedOmnichainStatus !== actualOmnichainStatus) {
|
|
1572
|
+
ctx.issues.push({
|
|
1573
|
+
code: "custom",
|
|
1574
|
+
input: snapshot,
|
|
1575
|
+
message: `'${actualOmnichainStatus}' is an invalid omnichainStatus. Expected '${expectedOmnichainStatus}' based on the statuses of individual chains.`
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
function invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains(ctx) {
|
|
1580
|
+
const snapshot = ctx.value;
|
|
1581
|
+
const queuedChains = Array.from(snapshot.chains.values()).filter(
|
|
1582
|
+
(chain) => chain.chainStatus === ChainIndexingStatusIds.Queued
|
|
1583
|
+
);
|
|
1584
|
+
if (queuedChains.length === 0) {
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
const queuedChainStartBlocks = queuedChains.map((chain) => chain.config.startBlock.timestamp);
|
|
1588
|
+
const queuedChainEarliestStartBlock = Math.min(...queuedChainStartBlocks);
|
|
1589
|
+
if (snapshot.omnichainIndexingCursor >= queuedChainEarliestStartBlock) {
|
|
1590
|
+
ctx.issues.push({
|
|
1591
|
+
code: "custom",
|
|
1592
|
+
input: snapshot,
|
|
1593
|
+
message: "`omnichainIndexingCursor` must be lower than the earliest start block across all queued chains."
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
function invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains(ctx) {
|
|
1598
|
+
const snapshot = ctx.value;
|
|
1599
|
+
const backfillChains = Array.from(snapshot.chains.values()).filter(
|
|
1600
|
+
(chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
|
|
1601
|
+
);
|
|
1602
|
+
if (backfillChains.length === 0) {
|
|
1603
|
+
return;
|
|
1604
|
+
}
|
|
1605
|
+
const backfillEndBlocks = backfillChains.map((chain) => chain.backfillEndBlock.timestamp);
|
|
1606
|
+
const highestBackfillEndBlock = Math.max(...backfillEndBlocks);
|
|
1607
|
+
if (snapshot.omnichainIndexingCursor > highestBackfillEndBlock) {
|
|
1608
|
+
ctx.issues.push({
|
|
1609
|
+
code: "custom",
|
|
1610
|
+
input: snapshot,
|
|
1611
|
+
message: "`omnichainIndexingCursor` must be lower than or equal to the highest `backfillEndBlock` across all backfill chains."
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
function invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain(ctx) {
|
|
1616
|
+
const snapshot = ctx.value;
|
|
1617
|
+
const indexedChains = Array.from(snapshot.chains.values()).filter(
|
|
1618
|
+
(chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed || chain.chainStatus === ChainIndexingStatusIds.Following
|
|
1619
|
+
);
|
|
1620
|
+
if (indexedChains.length === 0) {
|
|
1621
|
+
return;
|
|
1622
|
+
}
|
|
1623
|
+
const indexedChainLatestIndexedBlocks = indexedChains.map(
|
|
1624
|
+
(chain) => chain.latestIndexedBlock.timestamp
|
|
1625
|
+
);
|
|
1626
|
+
const indexedChainHighestLatestIndexedBlock = Math.max(...indexedChainLatestIndexedBlocks);
|
|
1627
|
+
if (snapshot.omnichainIndexingCursor !== indexedChainHighestLatestIndexedBlock) {
|
|
1628
|
+
ctx.issues.push({
|
|
1629
|
+
code: "custom",
|
|
1630
|
+
input: snapshot,
|
|
1631
|
+
message: "`omnichainIndexingCursor` must be same as the highest `latestIndexedBlock` across all indexed chains."
|
|
1632
|
+
});
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
function invariant_omnichainSnapshotUnstartedHasValidChains(ctx) {
|
|
1636
|
+
const chains = ctx.value;
|
|
1637
|
+
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(
|
|
1638
|
+
Array.from(chains.values())
|
|
1639
|
+
);
|
|
1640
|
+
if (hasValidChains === false) {
|
|
1641
|
+
ctx.issues.push({
|
|
1642
|
+
code: "custom",
|
|
1643
|
+
input: chains,
|
|
1644
|
+
message: `For omnichain status snapshot 'unstarted', all chains must have "queued" status.`
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
function invariant_omnichainStatusSnapshotBackfillHasValidChains(ctx) {
|
|
1649
|
+
const chains = ctx.value;
|
|
1650
|
+
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(
|
|
1651
|
+
Array.from(chains.values())
|
|
1652
|
+
);
|
|
1653
|
+
if (hasValidChains === false) {
|
|
1654
|
+
ctx.issues.push({
|
|
1655
|
+
code: "custom",
|
|
1656
|
+
input: chains,
|
|
1657
|
+
message: `For omnichain status snapshot 'backfill', at least one chain must be in "backfill" status and each chain has to have a status of either "queued", "backfill" or "completed".`
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
function invariant_omnichainStatusSnapshotCompletedHasValidChains(ctx) {
|
|
1662
|
+
const chains = ctx.value;
|
|
1663
|
+
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(
|
|
1664
|
+
Array.from(chains.values())
|
|
1665
|
+
);
|
|
1666
|
+
if (hasValidChains === false) {
|
|
1667
|
+
ctx.issues.push({
|
|
1668
|
+
code: "custom",
|
|
1669
|
+
input: chains,
|
|
1670
|
+
message: `For omnichain status snapshot 'completed', all chains must have "completed" status.`
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1681
1674
|
var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v49.z.record(makeChainIdStringSchema(), makeChainIndexingStatusSnapshotSchema(valueLabel), {
|
|
1682
1675
|
error: "Chains indexing statuses must be an object mapping valid chain IDs to their indexing status snapshots."
|
|
1683
1676
|
}).transform((serializedChainsIndexingStatus) => {
|
|
@@ -1717,41 +1710,31 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
|
|
|
1717
1710
|
]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
|
|
1718
1711
|
invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
|
|
1719
1712
|
).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
|
|
1720
|
-
|
|
1721
|
-
|
|
1713
|
+
|
|
1714
|
+
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1715
|
+
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => import_v410.z.strictObject({
|
|
1716
|
+
strategy: import_v410.z.literal(CrossChainIndexingStrategyIds.Omnichain),
|
|
1722
1717
|
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1723
1718
|
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1724
1719
|
omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
1725
1720
|
}).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
|
|
1726
|
-
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") =>
|
|
1721
|
+
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => import_v410.z.discriminatedUnion("strategy", [
|
|
1727
1722
|
makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
|
|
1728
1723
|
]);
|
|
1729
|
-
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") =>
|
|
1724
|
+
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v410.z.strictObject({
|
|
1730
1725
|
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1731
1726
|
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1732
1727
|
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
1733
1728
|
}).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
|
|
1734
1729
|
|
|
1735
1730
|
// src/ensindexer/indexing-status/deserialize.ts
|
|
1736
|
-
function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1737
|
-
const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
|
|
1738
|
-
const parsed = schema.safeParse(maybeSnapshot);
|
|
1739
|
-
if (parsed.error) {
|
|
1740
|
-
throw new Error(
|
|
1741
|
-
`Cannot deserialize into OmnichainIndexingStatusSnapshot:
|
|
1742
|
-
${(0, import_v410.prettifyError)(parsed.error)}
|
|
1743
|
-
`
|
|
1744
|
-
);
|
|
1745
|
-
}
|
|
1746
|
-
return parsed.data;
|
|
1747
|
-
}
|
|
1748
1731
|
function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1749
1732
|
const schema = makeCrossChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1750
1733
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
1751
1734
|
if (parsed.error) {
|
|
1752
1735
|
throw new Error(
|
|
1753
1736
|
`Cannot deserialize into CrossChainIndexingStatusSnapshot:
|
|
1754
|
-
${(0,
|
|
1737
|
+
${(0, import_v411.prettifyError)(parsed.error)}
|
|
1755
1738
|
`
|
|
1756
1739
|
);
|
|
1757
1740
|
}
|
|
@@ -1763,7 +1746,7 @@ function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel
|
|
|
1763
1746
|
if (parsed.error) {
|
|
1764
1747
|
throw new Error(
|
|
1765
1748
|
`Cannot deserialize into RealtimeIndexingStatusProjection:
|
|
1766
|
-
${(0,
|
|
1749
|
+
${(0, import_v411.prettifyError)(parsed.error)}
|
|
1767
1750
|
`
|
|
1768
1751
|
);
|
|
1769
1752
|
}
|
|
@@ -1771,20 +1754,47 @@ ${(0, import_v410.prettifyError)(parsed.error)}
|
|
|
1771
1754
|
}
|
|
1772
1755
|
|
|
1773
1756
|
// src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
1774
|
-
var
|
|
1757
|
+
var import_v412 = require("zod/v4");
|
|
1775
1758
|
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1776
1759
|
const schema = makeSerializedChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1777
1760
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
1778
1761
|
if (parsed.error) {
|
|
1779
1762
|
throw new Error(
|
|
1780
1763
|
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
1781
|
-
${(0,
|
|
1764
|
+
${(0, import_v412.prettifyError)(parsed.error)}
|
|
1765
|
+
`
|
|
1766
|
+
);
|
|
1767
|
+
}
|
|
1768
|
+
return parsed.data;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
// src/ensindexer/indexing-status/deserialize/omnichain-indexing-status-snapshot.ts
|
|
1772
|
+
var import_v413 = require("zod/v4");
|
|
1773
|
+
function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1774
|
+
const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
|
|
1775
|
+
const parsed = schema.safeParse(maybeSnapshot);
|
|
1776
|
+
if (parsed.error) {
|
|
1777
|
+
throw new Error(
|
|
1778
|
+
`Cannot deserialize into OmnichainIndexingStatusSnapshot:
|
|
1779
|
+
${(0, import_v413.prettifyError)(parsed.error)}
|
|
1782
1780
|
`
|
|
1783
1781
|
);
|
|
1784
1782
|
}
|
|
1785
1783
|
return parsed.data;
|
|
1786
1784
|
}
|
|
1787
1785
|
|
|
1786
|
+
// src/ensindexer/indexing-status/helpers.ts
|
|
1787
|
+
function getLatestIndexedBlockRef(indexingStatus, chainId) {
|
|
1788
|
+
const chainIndexingStatus = indexingStatus.omnichainSnapshot.chains.get(chainId);
|
|
1789
|
+
if (chainIndexingStatus === void 0) {
|
|
1790
|
+
return null;
|
|
1791
|
+
}
|
|
1792
|
+
if (chainIndexingStatus.chainStatus === ChainIndexingStatusIds.Queued) {
|
|
1793
|
+
return null;
|
|
1794
|
+
}
|
|
1795
|
+
return chainIndexingStatus.latestIndexedBlock;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1788
1798
|
// src/ensindexer/indexing-status/projection.ts
|
|
1789
1799
|
function createRealtimeIndexingStatusProjection(snapshot, now) {
|
|
1790
1800
|
const projectedAt = Math.max(now, snapshot.snapshotTime);
|
|
@@ -1848,27 +1858,7 @@ function serializeChainIndexingSnapshots(chains) {
|
|
|
1848
1858
|
return serializedSnapshots;
|
|
1849
1859
|
}
|
|
1850
1860
|
|
|
1851
|
-
// src/ensindexer/indexing-status/serialize.ts
|
|
1852
|
-
function serializeCrossChainIndexingStatusSnapshotOmnichain({
|
|
1853
|
-
strategy,
|
|
1854
|
-
slowestChainIndexingCursor,
|
|
1855
|
-
snapshotTime,
|
|
1856
|
-
omnichainSnapshot
|
|
1857
|
-
}) {
|
|
1858
|
-
return {
|
|
1859
|
-
strategy,
|
|
1860
|
-
slowestChainIndexingCursor,
|
|
1861
|
-
snapshotTime,
|
|
1862
|
-
omnichainSnapshot: serializeOmnichainIndexingStatusSnapshot(omnichainSnapshot)
|
|
1863
|
-
};
|
|
1864
|
-
}
|
|
1865
|
-
function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
1866
|
-
return {
|
|
1867
|
-
projectedAt: indexingProjection.projectedAt,
|
|
1868
|
-
worstCaseDistance: indexingProjection.worstCaseDistance,
|
|
1869
|
-
snapshot: serializeCrossChainIndexingStatusSnapshotOmnichain(indexingProjection.snapshot)
|
|
1870
|
-
};
|
|
1871
|
-
}
|
|
1861
|
+
// src/ensindexer/indexing-status/serialize/omnichain-indexing-status-snapshot.ts
|
|
1872
1862
|
function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
|
|
1873
1863
|
switch (indexingStatus.omnichainStatus) {
|
|
1874
1864
|
case OmnichainIndexingStatusIds.Unstarted:
|
|
@@ -1899,14 +1889,36 @@ function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
|
|
|
1899
1889
|
}
|
|
1900
1890
|
}
|
|
1901
1891
|
|
|
1892
|
+
// src/ensindexer/indexing-status/serialize.ts
|
|
1893
|
+
function serializeCrossChainIndexingStatusSnapshotOmnichain({
|
|
1894
|
+
strategy,
|
|
1895
|
+
slowestChainIndexingCursor,
|
|
1896
|
+
snapshotTime,
|
|
1897
|
+
omnichainSnapshot
|
|
1898
|
+
}) {
|
|
1899
|
+
return {
|
|
1900
|
+
strategy,
|
|
1901
|
+
slowestChainIndexingCursor,
|
|
1902
|
+
snapshotTime,
|
|
1903
|
+
omnichainSnapshot: serializeOmnichainIndexingStatusSnapshot(omnichainSnapshot)
|
|
1904
|
+
};
|
|
1905
|
+
}
|
|
1906
|
+
function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
1907
|
+
return {
|
|
1908
|
+
projectedAt: indexingProjection.projectedAt,
|
|
1909
|
+
worstCaseDistance: indexingProjection.worstCaseDistance,
|
|
1910
|
+
snapshot: serializeCrossChainIndexingStatusSnapshotOmnichain(indexingProjection.snapshot)
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1902
1914
|
// src/ensindexer/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
1903
|
-
var
|
|
1915
|
+
var import_v414 = require("zod/v4");
|
|
1904
1916
|
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
1905
1917
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1906
1918
|
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
1907
1919
|
if (parsed.error) {
|
|
1908
1920
|
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
1909
|
-
${(0,
|
|
1921
|
+
${(0, import_v414.prettifyError)(parsed.error)}
|
|
1910
1922
|
`);
|
|
1911
1923
|
}
|
|
1912
1924
|
return parsed.data;
|
|
@@ -1933,10 +1945,10 @@ function serializeConfigResponse(response) {
|
|
|
1933
1945
|
}
|
|
1934
1946
|
|
|
1935
1947
|
// src/api/indexing-status/deserialize.ts
|
|
1936
|
-
var
|
|
1948
|
+
var import_v416 = require("zod/v4");
|
|
1937
1949
|
|
|
1938
1950
|
// src/api/indexing-status/zod-schemas.ts
|
|
1939
|
-
var
|
|
1951
|
+
var import_v415 = require("zod/v4");
|
|
1940
1952
|
|
|
1941
1953
|
// src/api/indexing-status/response.ts
|
|
1942
1954
|
var IndexingStatusResponseCodes = {
|
|
@@ -1951,14 +1963,14 @@ var IndexingStatusResponseCodes = {
|
|
|
1951
1963
|
};
|
|
1952
1964
|
|
|
1953
1965
|
// src/api/indexing-status/zod-schemas.ts
|
|
1954
|
-
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") =>
|
|
1955
|
-
responseCode:
|
|
1966
|
+
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v415.z.strictObject({
|
|
1967
|
+
responseCode: import_v415.z.literal(IndexingStatusResponseCodes.Ok),
|
|
1956
1968
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1957
1969
|
});
|
|
1958
|
-
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") =>
|
|
1959
|
-
responseCode:
|
|
1970
|
+
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v415.z.strictObject({
|
|
1971
|
+
responseCode: import_v415.z.literal(IndexingStatusResponseCodes.Error)
|
|
1960
1972
|
});
|
|
1961
|
-
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") =>
|
|
1973
|
+
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v415.z.discriminatedUnion("responseCode", [
|
|
1962
1974
|
makeIndexingStatusResponseOkSchema(valueLabel),
|
|
1963
1975
|
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
1964
1976
|
]);
|
|
@@ -1968,7 +1980,7 @@ function deserializeIndexingStatusResponse(maybeResponse) {
|
|
|
1968
1980
|
const parsed = makeIndexingStatusResponseSchema().safeParse(maybeResponse);
|
|
1969
1981
|
if (parsed.error) {
|
|
1970
1982
|
throw new Error(`Cannot deserialize IndexingStatusResponse:
|
|
1971
|
-
${(0,
|
|
1983
|
+
${(0, import_v416.prettifyError)(parsed.error)}
|
|
1972
1984
|
`);
|
|
1973
1985
|
}
|
|
1974
1986
|
return parsed.data;
|
|
@@ -1988,20 +2000,20 @@ function serializeIndexingStatusResponse(response) {
|
|
|
1988
2000
|
}
|
|
1989
2001
|
|
|
1990
2002
|
// src/api/name-tokens/deserialize.ts
|
|
1991
|
-
var
|
|
2003
|
+
var import_v421 = require("zod/v4");
|
|
1992
2004
|
|
|
1993
2005
|
// src/api/name-tokens/zod-schemas.ts
|
|
1994
2006
|
var import_viem14 = require("viem");
|
|
1995
|
-
var
|
|
2007
|
+
var import_v420 = require("zod/v4");
|
|
1996
2008
|
|
|
1997
2009
|
// src/tokenscope/assets.ts
|
|
1998
2010
|
var import_viem13 = require("viem");
|
|
1999
|
-
var
|
|
2011
|
+
var import_v418 = require("zod/v4");
|
|
2000
2012
|
|
|
2001
2013
|
// src/tokenscope/zod-schemas.ts
|
|
2002
2014
|
var import_caip3 = require("caip");
|
|
2003
2015
|
var import_viem12 = require("viem");
|
|
2004
|
-
var
|
|
2016
|
+
var import_v417 = require("zod/v4");
|
|
2005
2017
|
|
|
2006
2018
|
// src/shared/types.ts
|
|
2007
2019
|
var AssetNamespaces = {
|
|
@@ -2124,10 +2136,10 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2124
2136
|
}
|
|
2125
2137
|
|
|
2126
2138
|
// src/tokenscope/zod-schemas.ts
|
|
2127
|
-
var tokenIdSchemaSerializable =
|
|
2128
|
-
var tokenIdSchemaNative =
|
|
2139
|
+
var tokenIdSchemaSerializable = import_v417.z.string();
|
|
2140
|
+
var tokenIdSchemaNative = import_v417.z.preprocess(
|
|
2129
2141
|
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2130
|
-
|
|
2142
|
+
import_v417.z.bigint().positive()
|
|
2131
2143
|
);
|
|
2132
2144
|
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2133
2145
|
if (serializable) {
|
|
@@ -2137,13 +2149,13 @@ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false
|
|
|
2137
2149
|
}
|
|
2138
2150
|
}
|
|
2139
2151
|
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2140
|
-
return
|
|
2141
|
-
assetNamespace:
|
|
2152
|
+
return import_v417.z.object({
|
|
2153
|
+
assetNamespace: import_v417.z.enum(AssetNamespaces),
|
|
2142
2154
|
contract: makeAccountIdSchema(valueLabel),
|
|
2143
2155
|
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2144
2156
|
});
|
|
2145
2157
|
};
|
|
2146
|
-
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") =>
|
|
2158
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v417.z.preprocess((v) => {
|
|
2147
2159
|
if (typeof v === "string") {
|
|
2148
2160
|
const result = new import_caip3.AssetId(v);
|
|
2149
2161
|
return {
|
|
@@ -2167,20 +2179,20 @@ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
|
2167
2179
|
});
|
|
2168
2180
|
}
|
|
2169
2181
|
}
|
|
2170
|
-
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") =>
|
|
2171
|
-
ownershipType:
|
|
2182
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v417.z.object({
|
|
2183
|
+
ownershipType: import_v417.z.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2172
2184
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2173
2185
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2174
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") =>
|
|
2175
|
-
ownershipType:
|
|
2186
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v417.z.object({
|
|
2187
|
+
ownershipType: import_v417.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2176
2188
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2177
2189
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2178
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") =>
|
|
2179
|
-
ownershipType:
|
|
2190
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v417.z.object({
|
|
2191
|
+
ownershipType: import_v417.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2180
2192
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2181
2193
|
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2182
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") =>
|
|
2183
|
-
ownershipType:
|
|
2194
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v417.z.object({
|
|
2195
|
+
ownershipType: import_v417.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2184
2196
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2185
2197
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2186
2198
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
@@ -2193,16 +2205,16 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
|
2193
2205
|
});
|
|
2194
2206
|
}
|
|
2195
2207
|
}
|
|
2196
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") =>
|
|
2208
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v417.z.discriminatedUnion("ownershipType", [
|
|
2197
2209
|
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2198
2210
|
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2199
2211
|
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2200
2212
|
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2201
2213
|
]);
|
|
2202
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) =>
|
|
2214
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v417.z.object({
|
|
2203
2215
|
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2204
2216
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2205
|
-
mintStatus:
|
|
2217
|
+
mintStatus: import_v417.z.enum(NFTMintStatuses)
|
|
2206
2218
|
});
|
|
2207
2219
|
|
|
2208
2220
|
// src/tokenscope/assets.ts
|
|
@@ -2218,7 +2230,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2218
2230
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2219
2231
|
if (parsed.error) {
|
|
2220
2232
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2221
|
-
${(0,
|
|
2233
|
+
${(0, import_v418.prettifyError)(parsed.error)}
|
|
2222
2234
|
`);
|
|
2223
2235
|
}
|
|
2224
2236
|
return parsed.data;
|
|
@@ -2228,7 +2240,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
2228
2240
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2229
2241
|
if (parsed.error) {
|
|
2230
2242
|
throw new RangeError(`Cannot parse AssetId:
|
|
2231
|
-
${(0,
|
|
2243
|
+
${(0, import_v418.prettifyError)(parsed.error)}
|
|
2232
2244
|
`);
|
|
2233
2245
|
}
|
|
2234
2246
|
return parsed.data;
|
|
@@ -2450,10 +2462,10 @@ ${formatNFTTransferEventMetadata(metadata)}`
|
|
|
2450
2462
|
};
|
|
2451
2463
|
|
|
2452
2464
|
// src/api/shared/errors/zod-schemas.ts
|
|
2453
|
-
var
|
|
2454
|
-
var ErrorResponseSchema =
|
|
2455
|
-
message:
|
|
2456
|
-
details:
|
|
2465
|
+
var import_v419 = require("zod/v4");
|
|
2466
|
+
var ErrorResponseSchema = import_v419.z.object({
|
|
2467
|
+
message: import_v419.z.string(),
|
|
2468
|
+
details: import_v419.z.optional(import_v419.z.unknown())
|
|
2457
2469
|
});
|
|
2458
2470
|
|
|
2459
2471
|
// src/api/name-tokens/response.ts
|
|
@@ -2492,10 +2504,10 @@ var NameTokensResponseErrorCodes = {
|
|
|
2492
2504
|
};
|
|
2493
2505
|
|
|
2494
2506
|
// src/api/name-tokens/zod-schemas.ts
|
|
2495
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) =>
|
|
2507
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v420.z.object({
|
|
2496
2508
|
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2497
2509
|
name: makeReinterpretedNameSchema(valueLabel),
|
|
2498
|
-
tokens:
|
|
2510
|
+
tokens: import_v420.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2499
2511
|
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2500
2512
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2501
2513
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
@@ -2537,32 +2549,32 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2537
2549
|
});
|
|
2538
2550
|
}
|
|
2539
2551
|
});
|
|
2540
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) =>
|
|
2541
|
-
responseCode:
|
|
2552
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v420.z.strictObject({
|
|
2553
|
+
responseCode: import_v420.z.literal(NameTokensResponseCodes.Ok),
|
|
2542
2554
|
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2543
2555
|
});
|
|
2544
|
-
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") =>
|
|
2545
|
-
responseCode:
|
|
2546
|
-
errorCode:
|
|
2556
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v420.z.strictObject({
|
|
2557
|
+
responseCode: import_v420.z.literal(NameTokensResponseCodes.Error),
|
|
2558
|
+
errorCode: import_v420.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2547
2559
|
error: ErrorResponseSchema
|
|
2548
2560
|
});
|
|
2549
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2550
|
-
responseCode:
|
|
2551
|
-
errorCode:
|
|
2561
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v420.z.strictObject({
|
|
2562
|
+
responseCode: import_v420.z.literal(NameTokensResponseCodes.Error),
|
|
2563
|
+
errorCode: import_v420.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2552
2564
|
error: ErrorResponseSchema
|
|
2553
2565
|
});
|
|
2554
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2555
|
-
responseCode:
|
|
2556
|
-
errorCode:
|
|
2566
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v420.z.strictObject({
|
|
2567
|
+
responseCode: import_v420.z.literal(NameTokensResponseCodes.Error),
|
|
2568
|
+
errorCode: import_v420.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2557
2569
|
error: ErrorResponseSchema
|
|
2558
2570
|
});
|
|
2559
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2571
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v420.z.discriminatedUnion("errorCode", [
|
|
2560
2572
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2561
2573
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2562
2574
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2563
2575
|
]);
|
|
2564
2576
|
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2565
|
-
return
|
|
2577
|
+
return import_v420.z.discriminatedUnion("responseCode", [
|
|
2566
2578
|
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2567
2579
|
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2568
2580
|
]);
|
|
@@ -2575,7 +2587,7 @@ function deserializedNameTokensResponse(maybeResponse) {
|
|
|
2575
2587
|
);
|
|
2576
2588
|
if (parsed.error) {
|
|
2577
2589
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2578
|
-
${(0,
|
|
2590
|
+
${(0, import_v421.prettifyError)(parsed.error)}
|
|
2579
2591
|
`);
|
|
2580
2592
|
}
|
|
2581
2593
|
return parsed.data;
|
|
@@ -2649,14 +2661,14 @@ function serializeNameTokensResponse(response) {
|
|
|
2649
2661
|
}
|
|
2650
2662
|
|
|
2651
2663
|
// src/api/registrar-actions/deserialize.ts
|
|
2652
|
-
var
|
|
2664
|
+
var import_v425 = require("zod/v4");
|
|
2653
2665
|
|
|
2654
2666
|
// src/api/registrar-actions/zod-schemas.ts
|
|
2655
2667
|
var import_ens7 = require("viem/ens");
|
|
2656
|
-
var
|
|
2668
|
+
var import_v424 = require("zod/v4");
|
|
2657
2669
|
|
|
2658
2670
|
// src/registrars/zod-schemas.ts
|
|
2659
|
-
var
|
|
2671
|
+
var import_v422 = require("zod/v4");
|
|
2660
2672
|
|
|
2661
2673
|
// src/registrars/encoded-referrer.ts
|
|
2662
2674
|
var import_viem15 = require("viem");
|
|
@@ -2731,11 +2743,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
2731
2743
|
}
|
|
2732
2744
|
|
|
2733
2745
|
// src/registrars/zod-schemas.ts
|
|
2734
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
2746
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v422.z.object({
|
|
2735
2747
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
2736
2748
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
2737
2749
|
});
|
|
2738
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
2750
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v422.z.object({
|
|
2739
2751
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
2740
2752
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
2741
2753
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -2751,18 +2763,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
2751
2763
|
});
|
|
2752
2764
|
}
|
|
2753
2765
|
}
|
|
2754
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
2766
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v422.z.union([
|
|
2755
2767
|
// pricing available
|
|
2756
|
-
|
|
2768
|
+
import_v422.z.object({
|
|
2757
2769
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
2758
2770
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
2759
2771
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
2760
2772
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
2761
2773
|
// pricing unknown
|
|
2762
|
-
|
|
2763
|
-
baseCost:
|
|
2764
|
-
premium:
|
|
2765
|
-
total:
|
|
2774
|
+
import_v422.z.object({
|
|
2775
|
+
baseCost: import_v422.z.null(),
|
|
2776
|
+
premium: import_v422.z.null(),
|
|
2777
|
+
total: import_v422.z.null()
|
|
2766
2778
|
}).transform((v) => v)
|
|
2767
2779
|
]);
|
|
2768
2780
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -2785,9 +2797,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
2785
2797
|
});
|
|
2786
2798
|
}
|
|
2787
2799
|
}
|
|
2788
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
2800
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v422.z.union([
|
|
2789
2801
|
// referral available
|
|
2790
|
-
|
|
2802
|
+
import_v422.z.object({
|
|
2791
2803
|
encodedReferrer: makeHexStringSchema(
|
|
2792
2804
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
2793
2805
|
`${valueLabel} Encoded Referrer`
|
|
@@ -2795,9 +2807,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
2795
2807
|
decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
2796
2808
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
2797
2809
|
// referral not applicable
|
|
2798
|
-
|
|
2799
|
-
encodedReferrer:
|
|
2800
|
-
decodedReferrer:
|
|
2810
|
+
import_v422.z.object({
|
|
2811
|
+
encodedReferrer: import_v422.z.null(),
|
|
2812
|
+
decodedReferrer: import_v422.z.null()
|
|
2801
2813
|
})
|
|
2802
2814
|
]);
|
|
2803
2815
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -2810,9 +2822,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
2810
2822
|
});
|
|
2811
2823
|
}
|
|
2812
2824
|
}
|
|
2813
|
-
var EventIdSchema =
|
|
2814
|
-
var EventIdsSchema =
|
|
2815
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
2825
|
+
var EventIdSchema = import_v422.z.string().nonempty();
|
|
2826
|
+
var EventIdsSchema = import_v422.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
2827
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v422.z.object({
|
|
2816
2828
|
id: EventIdSchema,
|
|
2817
2829
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
2818
2830
|
registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2826,38 +2838,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => im
|
|
|
2826
2838
|
eventIds: EventIdsSchema
|
|
2827
2839
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2828
2840
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2829
|
-
type:
|
|
2841
|
+
type: import_v422.z.literal(RegistrarActionTypes.Registration)
|
|
2830
2842
|
});
|
|
2831
2843
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2832
|
-
type:
|
|
2844
|
+
type: import_v422.z.literal(RegistrarActionTypes.Renewal)
|
|
2833
2845
|
});
|
|
2834
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
2846
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v422.z.discriminatedUnion("type", [
|
|
2835
2847
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2836
2848
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2837
2849
|
]);
|
|
2838
2850
|
|
|
2839
2851
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2840
|
-
var
|
|
2852
|
+
var import_v423 = require("zod/v4");
|
|
2841
2853
|
|
|
2842
2854
|
// src/api/shared/pagination/request.ts
|
|
2843
2855
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2844
2856
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
2845
2857
|
|
|
2846
2858
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2847
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
2859
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v423.z.object({
|
|
2848
2860
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2849
2861
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
2850
2862
|
RECORDS_PER_PAGE_MAX,
|
|
2851
2863
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
2852
2864
|
)
|
|
2853
2865
|
});
|
|
2854
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
2855
|
-
totalRecords:
|
|
2856
|
-
totalPages:
|
|
2857
|
-
hasNext:
|
|
2858
|
-
hasPrev:
|
|
2859
|
-
startIndex:
|
|
2860
|
-
endIndex:
|
|
2866
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v423.z.object({
|
|
2867
|
+
totalRecords: import_v423.z.literal(0),
|
|
2868
|
+
totalPages: import_v423.z.literal(1),
|
|
2869
|
+
hasNext: import_v423.z.literal(false),
|
|
2870
|
+
hasPrev: import_v423.z.literal(false),
|
|
2871
|
+
startIndex: import_v423.z.undefined(),
|
|
2872
|
+
endIndex: import_v423.z.undefined()
|
|
2861
2873
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
2862
2874
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
2863
2875
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -2892,15 +2904,15 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
2892
2904
|
});
|
|
2893
2905
|
}
|
|
2894
2906
|
}
|
|
2895
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
2907
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v423.z.object({
|
|
2896
2908
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2897
2909
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2898
|
-
hasNext:
|
|
2899
|
-
hasPrev:
|
|
2910
|
+
hasNext: import_v423.z.boolean(),
|
|
2911
|
+
hasPrev: import_v423.z.boolean(),
|
|
2900
2912
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
2901
2913
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
2902
2914
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
2903
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
2915
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v423.z.union([
|
|
2904
2916
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
2905
2917
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
2906
2918
|
]);
|
|
@@ -2930,21 +2942,21 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
2930
2942
|
});
|
|
2931
2943
|
}
|
|
2932
2944
|
}
|
|
2933
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
2945
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v424.z.object({
|
|
2934
2946
|
action: makeRegistrarActionSchema(valueLabel),
|
|
2935
2947
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
2936
2948
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2937
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
2938
|
-
responseCode:
|
|
2939
|
-
registrarActions:
|
|
2949
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v424.z.object({
|
|
2950
|
+
responseCode: import_v424.z.literal(RegistrarActionsResponseCodes.Ok),
|
|
2951
|
+
registrarActions: import_v424.z.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
2940
2952
|
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
2941
2953
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
|
|
2942
2954
|
});
|
|
2943
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
2944
|
-
responseCode:
|
|
2955
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v424.z.strictObject({
|
|
2956
|
+
responseCode: import_v424.z.literal(RegistrarActionsResponseCodes.Error),
|
|
2945
2957
|
error: ErrorResponseSchema
|
|
2946
2958
|
});
|
|
2947
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
2959
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v424.z.discriminatedUnion("responseCode", [
|
|
2948
2960
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2949
2961
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2950
2962
|
]);
|
|
@@ -2955,7 +2967,7 @@ function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
|
2955
2967
|
if (parsed.error) {
|
|
2956
2968
|
throw new Error(
|
|
2957
2969
|
`Cannot deserialize RegistrarActionsResponse:
|
|
2958
|
-
${(0,
|
|
2970
|
+
${(0, import_v425.prettifyError)(parsed.error)}
|
|
2959
2971
|
`
|
|
2960
2972
|
);
|
|
2961
2973
|
}
|
|
@@ -3203,12 +3215,12 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3203
3215
|
}
|
|
3204
3216
|
|
|
3205
3217
|
// src/api/shared/errors/deserialize.ts
|
|
3206
|
-
var
|
|
3218
|
+
var import_v426 = require("zod/v4");
|
|
3207
3219
|
function deserializeErrorResponse(maybeErrorResponse) {
|
|
3208
3220
|
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
3209
3221
|
if (parsed.error) {
|
|
3210
3222
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3211
|
-
${(0,
|
|
3223
|
+
${(0, import_v426.prettifyError)(parsed.error)}
|
|
3212
3224
|
`);
|
|
3213
3225
|
}
|
|
3214
3226
|
return parsed.data;
|