@ensnode/ensnode-sdk 0.0.0-next-20260211102546 → 0.0.0-next-20260213092129
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 +493 -475
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +166 -164
- package/dist/index.d.ts +166 -164
- package/dist/index.js +460 -442
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -230,7 +230,6 @@ __export(index_exports, {
|
|
|
230
230
|
serializeChainId: () => serializeChainId,
|
|
231
231
|
serializeChainIndexingSnapshots: () => serializeChainIndexingSnapshots,
|
|
232
232
|
serializeConfigResponse: () => serializeConfigResponse,
|
|
233
|
-
serializeCrossChainIndexingStatusSnapshotOmnichain: () => serializeCrossChainIndexingStatusSnapshotOmnichain,
|
|
234
233
|
serializeDatetime: () => serializeDatetime,
|
|
235
234
|
serializeDomainAssetId: () => serializeDomainAssetId,
|
|
236
235
|
serializeENSApiPublicConfig: () => serializeENSApiPublicConfig,
|
|
@@ -1132,20 +1131,205 @@ function sortChainStatusesByStartBlockAsc(chains) {
|
|
|
1132
1131
|
);
|
|
1133
1132
|
}
|
|
1134
1133
|
|
|
1135
|
-
// src/ensindexer/indexing-status/
|
|
1136
|
-
var
|
|
1134
|
+
// src/ensindexer/indexing-status/cross-chain-indexing-status-snapshot.ts
|
|
1135
|
+
var CrossChainIndexingStrategyIds = {
|
|
1136
|
+
/**
|
|
1137
|
+
* Represents that the indexing of events across all indexed chains will
|
|
1138
|
+
* proceed in a deterministic "omnichain" ordering by block timestamp, chain ID,
|
|
1139
|
+
* and block number.
|
|
1140
|
+
*
|
|
1141
|
+
* This strategy is "deterministic" in that the order of processing cross-chain indexed
|
|
1142
|
+
* events and each resulting indexed data state transition recorded in ENSDb is always
|
|
1143
|
+
* the same for each ENSIndexer instance operating with an equivalent
|
|
1144
|
+
* `ENSIndexerConfig` and ENSIndexer version. However it also has the drawbacks of:
|
|
1145
|
+
* - increased indexing latency that must wait for the slowest indexed chain to
|
|
1146
|
+
* add new blocks or to discover new blocks through the configured RPCs.
|
|
1147
|
+
* - if any indexed chain gets "stuck" due to chain or RPC failures, all indexed chains
|
|
1148
|
+
* will be affected.
|
|
1149
|
+
*/
|
|
1150
|
+
Omnichain: "omnichain"
|
|
1151
|
+
};
|
|
1152
|
+
function getLatestIndexedBlockRef(indexingStatus, chainId) {
|
|
1153
|
+
const chainIndexingStatus = indexingStatus.omnichainSnapshot.chains.get(chainId);
|
|
1154
|
+
if (chainIndexingStatus === void 0) {
|
|
1155
|
+
return null;
|
|
1156
|
+
}
|
|
1157
|
+
if (chainIndexingStatus.chainStatus === ChainIndexingStatusIds.Queued) {
|
|
1158
|
+
return null;
|
|
1159
|
+
}
|
|
1160
|
+
return chainIndexingStatus.latestIndexedBlock;
|
|
1161
|
+
}
|
|
1137
1162
|
|
|
1138
|
-
// src/ensindexer/indexing-status/
|
|
1139
|
-
var
|
|
1163
|
+
// src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
1164
|
+
var import_v48 = require("zod/v4");
|
|
1140
1165
|
|
|
1141
|
-
// src/
|
|
1166
|
+
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1142
1167
|
var import_v47 = require("zod/v4");
|
|
1168
|
+
|
|
1169
|
+
// src/shared/block-ref.ts
|
|
1170
|
+
function isBefore(blockA, blockB) {
|
|
1171
|
+
return blockA.number < blockB.number && blockA.timestamp < blockB.timestamp;
|
|
1172
|
+
}
|
|
1173
|
+
function isEqualTo(blockA, blockB) {
|
|
1174
|
+
return blockA.number === blockB.number && blockA.timestamp === blockB.timestamp;
|
|
1175
|
+
}
|
|
1176
|
+
function isBeforeOrEqualTo(blockA, blockB) {
|
|
1177
|
+
return isBefore(blockA, blockB) || isEqualTo(blockA, blockB);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1181
|
+
function invariant_chainSnapshotQueuedBlocks(ctx) {
|
|
1182
|
+
const { config } = ctx.value;
|
|
1183
|
+
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
if (isBeforeOrEqualTo(config.startBlock, config.endBlock) === false) {
|
|
1187
|
+
ctx.issues.push({
|
|
1188
|
+
code: "custom",
|
|
1189
|
+
input: ctx.value,
|
|
1190
|
+
message: "`config.startBlock` must be before or same as `config.endBlock`."
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
function invariant_chainSnapshotBackfillBlocks(ctx) {
|
|
1195
|
+
const { config, latestIndexedBlock, backfillEndBlock } = ctx.value;
|
|
1196
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1197
|
+
ctx.issues.push({
|
|
1198
|
+
code: "custom",
|
|
1199
|
+
input: ctx.value,
|
|
1200
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, backfillEndBlock) === false) {
|
|
1204
|
+
ctx.issues.push({
|
|
1205
|
+
code: "custom",
|
|
1206
|
+
input: ctx.value,
|
|
1207
|
+
message: "`latestIndexedBlock` must be before or same as `backfillEndBlock`."
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
if (isEqualTo(backfillEndBlock, config.endBlock) === false) {
|
|
1214
|
+
ctx.issues.push({
|
|
1215
|
+
code: "custom",
|
|
1216
|
+
input: ctx.value,
|
|
1217
|
+
message: "`backfillEndBlock` must be the same as `config.endBlock`."
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
function invariant_chainSnapshotCompletedBlocks(ctx) {
|
|
1222
|
+
const { config, latestIndexedBlock } = ctx.value;
|
|
1223
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1224
|
+
ctx.issues.push({
|
|
1225
|
+
code: "custom",
|
|
1226
|
+
input: ctx.value,
|
|
1227
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, config.endBlock) === false) {
|
|
1231
|
+
ctx.issues.push({
|
|
1232
|
+
code: "custom",
|
|
1233
|
+
input: ctx.value,
|
|
1234
|
+
message: "`latestIndexedBlock` must be before or same as `config.endBlock`."
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
function invariant_chainSnapshotFollowingBlocks(ctx) {
|
|
1239
|
+
const { config, latestIndexedBlock, latestKnownBlock } = ctx.value;
|
|
1240
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1241
|
+
ctx.issues.push({
|
|
1242
|
+
code: "custom",
|
|
1243
|
+
input: ctx.value,
|
|
1244
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, latestKnownBlock) === false) {
|
|
1248
|
+
ctx.issues.push({
|
|
1249
|
+
code: "custom",
|
|
1250
|
+
input: ctx.value,
|
|
1251
|
+
message: "`latestIndexedBlock` must be before or same as `latestKnownBlock`."
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
var makeChainIndexingConfigSchema = (valueLabel = "Value") => import_v47.z.discriminatedUnion("configType", [
|
|
1256
|
+
import_v47.z.object({
|
|
1257
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1258
|
+
startBlock: makeBlockRefSchema(valueLabel)
|
|
1259
|
+
}),
|
|
1260
|
+
import_v47.z.object({
|
|
1261
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1262
|
+
startBlock: makeBlockRefSchema(valueLabel),
|
|
1263
|
+
endBlock: makeBlockRefSchema(valueLabel)
|
|
1264
|
+
})
|
|
1265
|
+
]);
|
|
1266
|
+
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1267
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Queued),
|
|
1268
|
+
config: makeChainIndexingConfigSchema(valueLabel)
|
|
1269
|
+
}).check(invariant_chainSnapshotQueuedBlocks);
|
|
1270
|
+
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1271
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Backfill),
|
|
1272
|
+
config: makeChainIndexingConfigSchema(valueLabel),
|
|
1273
|
+
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1274
|
+
backfillEndBlock: makeBlockRefSchema(valueLabel)
|
|
1275
|
+
}).check(invariant_chainSnapshotBackfillBlocks);
|
|
1276
|
+
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1277
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Completed),
|
|
1278
|
+
config: import_v47.z.object({
|
|
1279
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1280
|
+
startBlock: makeBlockRefSchema(valueLabel),
|
|
1281
|
+
endBlock: makeBlockRefSchema(valueLabel)
|
|
1282
|
+
}),
|
|
1283
|
+
latestIndexedBlock: makeBlockRefSchema(valueLabel)
|
|
1284
|
+
}).check(invariant_chainSnapshotCompletedBlocks);
|
|
1285
|
+
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1286
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Following),
|
|
1287
|
+
config: import_v47.z.object({
|
|
1288
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1289
|
+
startBlock: makeBlockRefSchema(valueLabel)
|
|
1290
|
+
}),
|
|
1291
|
+
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1292
|
+
latestKnownBlock: makeBlockRefSchema(valueLabel)
|
|
1293
|
+
}).check(invariant_chainSnapshotFollowingBlocks);
|
|
1294
|
+
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v47.z.discriminatedUnion("chainStatus", [
|
|
1295
|
+
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1296
|
+
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1297
|
+
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
1298
|
+
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
|
|
1299
|
+
]);
|
|
1300
|
+
var makeSerializedChainIndexingStatusSnapshotSchema = makeChainIndexingStatusSnapshotSchema;
|
|
1301
|
+
|
|
1302
|
+
// src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
1303
|
+
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1304
|
+
const schema = makeSerializedChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1305
|
+
const parsed = schema.safeParse(maybeSnapshot);
|
|
1306
|
+
if (parsed.error) {
|
|
1307
|
+
throw new Error(
|
|
1308
|
+
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
1309
|
+
${(0, import_v48.prettifyError)(parsed.error)}
|
|
1310
|
+
`
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
return parsed.data;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
// src/ensindexer/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
|
|
1317
|
+
var import_v412 = require("zod/v4");
|
|
1318
|
+
|
|
1319
|
+
// src/ensindexer/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
|
|
1320
|
+
var import_v411 = require("zod/v4");
|
|
1321
|
+
|
|
1322
|
+
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1323
|
+
var import_v410 = require("zod/v4");
|
|
1324
|
+
|
|
1325
|
+
// src/shared/deserialize.ts
|
|
1326
|
+
var import_v49 = require("zod/v4");
|
|
1143
1327
|
function deserializeChainId(maybeChainId, valueLabel) {
|
|
1144
1328
|
const schema = makeChainIdStringSchema(valueLabel);
|
|
1145
1329
|
const parsed = schema.safeParse(maybeChainId);
|
|
1146
1330
|
if (parsed.error) {
|
|
1147
1331
|
throw new Error(`Cannot deserialize ChainId:
|
|
1148
|
-
${(0,
|
|
1332
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1149
1333
|
`);
|
|
1150
1334
|
}
|
|
1151
1335
|
return parsed.data;
|
|
@@ -1155,7 +1339,7 @@ function deserializeDatetime(maybeDatetime, valueLabel) {
|
|
|
1155
1339
|
const parsed = schema.safeParse(maybeDatetime);
|
|
1156
1340
|
if (parsed.error) {
|
|
1157
1341
|
throw new Error(`Cannot deserialize Datetime:
|
|
1158
|
-
${(0,
|
|
1342
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1159
1343
|
`);
|
|
1160
1344
|
}
|
|
1161
1345
|
return parsed.data;
|
|
@@ -1165,7 +1349,7 @@ function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
|
|
|
1165
1349
|
const parsed = schema.safeParse(maybeTimestamp);
|
|
1166
1350
|
if (parsed.error) {
|
|
1167
1351
|
throw new Error(`Cannot deserialize Unix Timestamp:
|
|
1168
|
-
${(0,
|
|
1352
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1169
1353
|
`);
|
|
1170
1354
|
}
|
|
1171
1355
|
return parsed.data;
|
|
@@ -1175,7 +1359,7 @@ function deserializeUrl(maybeUrl, valueLabel) {
|
|
|
1175
1359
|
const parsed = schema.safeParse(maybeUrl);
|
|
1176
1360
|
if (parsed.error) {
|
|
1177
1361
|
throw new Error(`Cannot deserialize URL:
|
|
1178
|
-
${(0,
|
|
1362
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1179
1363
|
`);
|
|
1180
1364
|
}
|
|
1181
1365
|
return parsed.data;
|
|
@@ -1185,7 +1369,7 @@ function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
|
|
|
1185
1369
|
const parsed = schema.safeParse(maybeBlockNumber);
|
|
1186
1370
|
if (parsed.error) {
|
|
1187
1371
|
throw new Error(`Cannot deserialize BlockNumber:
|
|
1188
|
-
${(0,
|
|
1372
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1189
1373
|
`);
|
|
1190
1374
|
}
|
|
1191
1375
|
return parsed.data;
|
|
@@ -1195,7 +1379,7 @@ function deserializeBlockrange(maybeBlockrange, valueLabel) {
|
|
|
1195
1379
|
const parsed = schema.safeParse(maybeBlockrange);
|
|
1196
1380
|
if (parsed.error) {
|
|
1197
1381
|
throw new Error(`Cannot deserialize Blockrange:
|
|
1198
|
-
${(0,
|
|
1382
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1199
1383
|
`);
|
|
1200
1384
|
}
|
|
1201
1385
|
return parsed.data;
|
|
@@ -1205,7 +1389,7 @@ function deserializeBlockRef(maybeBlockRef, valueLabel) {
|
|
|
1205
1389
|
const parsed = schema.safeParse(maybeBlockRef);
|
|
1206
1390
|
if (parsed.error) {
|
|
1207
1391
|
throw new Error(`Cannot deserialize BlockRef:
|
|
1208
|
-
${(0,
|
|
1392
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1209
1393
|
`);
|
|
1210
1394
|
}
|
|
1211
1395
|
return parsed.data;
|
|
@@ -1215,7 +1399,7 @@ function deserializeDuration(maybeDuration, valueLabel) {
|
|
|
1215
1399
|
const parsed = schema.safeParse(maybeDuration);
|
|
1216
1400
|
if (parsed.error) {
|
|
1217
1401
|
throw new RangeError(`Cannot deserialize Duration:
|
|
1218
|
-
${(0,
|
|
1402
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1219
1403
|
`);
|
|
1220
1404
|
}
|
|
1221
1405
|
return parsed.data;
|
|
@@ -1225,7 +1409,7 @@ function parseAccountId(maybeAccountId, valueLabel) {
|
|
|
1225
1409
|
const parsed = schema.safeParse(maybeAccountId);
|
|
1226
1410
|
if (parsed.error) {
|
|
1227
1411
|
throw new RangeError(`Cannot deserialize AccountId:
|
|
1228
|
-
${(0,
|
|
1412
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1229
1413
|
`);
|
|
1230
1414
|
}
|
|
1231
1415
|
return parsed.data;
|
|
@@ -1235,7 +1419,7 @@ function deserializePriceEth(maybePrice, valueLabel) {
|
|
|
1235
1419
|
const parsed = schema.safeParse(maybePrice);
|
|
1236
1420
|
if (parsed.error) {
|
|
1237
1421
|
throw new Error(`Cannot deserialize PriceEth:
|
|
1238
|
-
${(0,
|
|
1422
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1239
1423
|
`);
|
|
1240
1424
|
}
|
|
1241
1425
|
return parsed.data;
|
|
@@ -1245,7 +1429,7 @@ function deserializePriceUsdc(maybePrice, valueLabel) {
|
|
|
1245
1429
|
const parsed = schema.safeParse(maybePrice);
|
|
1246
1430
|
if (parsed.error) {
|
|
1247
1431
|
throw new Error(`Cannot deserialize PriceUsdc:
|
|
1248
|
-
${(0,
|
|
1432
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1249
1433
|
`);
|
|
1250
1434
|
}
|
|
1251
1435
|
return parsed.data;
|
|
@@ -1255,13 +1439,13 @@ function deserializePriceDai(maybePrice, valueLabel) {
|
|
|
1255
1439
|
const parsed = schema.safeParse(maybePrice);
|
|
1256
1440
|
if (parsed.error) {
|
|
1257
1441
|
throw new Error(`Cannot deserialize PriceDai:
|
|
1258
|
-
${(0,
|
|
1442
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1259
1443
|
`);
|
|
1260
1444
|
}
|
|
1261
1445
|
return parsed.data;
|
|
1262
1446
|
}
|
|
1263
1447
|
|
|
1264
|
-
// src/ensindexer/indexing-status/
|
|
1448
|
+
// src/ensindexer/indexing-status/omnichain-indexing-status-snapshot.ts
|
|
1265
1449
|
var OmnichainIndexingStatusIds = {
|
|
1266
1450
|
/**
|
|
1267
1451
|
* Represents that omnichain indexing is not ready to begin yet because
|
|
@@ -1288,25 +1472,30 @@ var OmnichainIndexingStatusIds = {
|
|
|
1288
1472
|
*/
|
|
1289
1473
|
Completed: "omnichain-completed"
|
|
1290
1474
|
};
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1475
|
+
function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains) {
|
|
1476
|
+
return chains.every((chain) => chain.chainStatus === ChainIndexingStatusIds.Queued);
|
|
1477
|
+
}
|
|
1478
|
+
function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains) {
|
|
1479
|
+
const atLeastOneChainInTargetStatus = chains.some(
|
|
1480
|
+
(chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
|
|
1481
|
+
);
|
|
1482
|
+
const otherChainsHaveValidStatuses = chains.every(
|
|
1483
|
+
(chain) => chain.chainStatus === ChainIndexingStatusIds.Queued || chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed
|
|
1484
|
+
);
|
|
1485
|
+
return atLeastOneChainInTargetStatus && otherChainsHaveValidStatuses;
|
|
1486
|
+
}
|
|
1487
|
+
function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains) {
|
|
1488
|
+
const allChainsHaveValidStatuses = chains.every(
|
|
1489
|
+
(chain) => chain.chainStatus === ChainIndexingStatusIds.Completed
|
|
1490
|
+
);
|
|
1491
|
+
return allChainsHaveValidStatuses;
|
|
1492
|
+
}
|
|
1493
|
+
function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains) {
|
|
1494
|
+
const allChainsHaveValidStatuses = chains.some(
|
|
1495
|
+
(chain) => chain.chainStatus === ChainIndexingStatusIds.Following
|
|
1496
|
+
);
|
|
1497
|
+
return allChainsHaveValidStatuses;
|
|
1498
|
+
}
|
|
1310
1499
|
function getOmnichainIndexingStatus(chains) {
|
|
1311
1500
|
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains)) {
|
|
1312
1501
|
return OmnichainIndexingStatusIds.Following;
|
|
@@ -1336,42 +1525,8 @@ function getOmnichainIndexingCursor(chains) {
|
|
|
1336
1525
|
}
|
|
1337
1526
|
return Math.max(...latestIndexedBlockTimestamps);
|
|
1338
1527
|
}
|
|
1339
|
-
function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains) {
|
|
1340
|
-
return chains.every((chain) => chain.chainStatus === ChainIndexingStatusIds.Queued);
|
|
1341
|
-
}
|
|
1342
|
-
function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains) {
|
|
1343
|
-
const atLeastOneChainInTargetStatus = chains.some(
|
|
1344
|
-
(chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
|
|
1345
|
-
);
|
|
1346
|
-
const otherChainsHaveValidStatuses = chains.every(
|
|
1347
|
-
(chain) => chain.chainStatus === ChainIndexingStatusIds.Queued || chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed
|
|
1348
|
-
);
|
|
1349
|
-
return atLeastOneChainInTargetStatus && otherChainsHaveValidStatuses;
|
|
1350
|
-
}
|
|
1351
|
-
function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains) {
|
|
1352
|
-
const allChainsHaveValidStatuses = chains.every(
|
|
1353
|
-
(chain) => chain.chainStatus === ChainIndexingStatusIds.Completed
|
|
1354
|
-
);
|
|
1355
|
-
return allChainsHaveValidStatuses;
|
|
1356
|
-
}
|
|
1357
|
-
function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains) {
|
|
1358
|
-
const allChainsHaveValidStatuses = chains.some(
|
|
1359
|
-
(chain) => chain.chainStatus === ChainIndexingStatusIds.Following
|
|
1360
|
-
);
|
|
1361
|
-
return allChainsHaveValidStatuses;
|
|
1362
|
-
}
|
|
1363
|
-
function getLatestIndexedBlockRef(indexingStatus, chainId) {
|
|
1364
|
-
const chainIndexingStatus = indexingStatus.omnichainSnapshot.chains.get(chainId);
|
|
1365
|
-
if (chainIndexingStatus === void 0) {
|
|
1366
|
-
return null;
|
|
1367
|
-
}
|
|
1368
|
-
if (chainIndexingStatus.chainStatus === ChainIndexingStatusIds.Queued) {
|
|
1369
|
-
return null;
|
|
1370
|
-
}
|
|
1371
|
-
return chainIndexingStatus.latestIndexedBlock;
|
|
1372
|
-
}
|
|
1373
1528
|
|
|
1374
|
-
// src/ensindexer/indexing-status/
|
|
1529
|
+
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1375
1530
|
function invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot(ctx) {
|
|
1376
1531
|
const snapshot = ctx.value;
|
|
1377
1532
|
const chains = Array.from(snapshot.chains.values());
|
|
@@ -1421,264 +1576,66 @@ function invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlo
|
|
|
1421
1576
|
});
|
|
1422
1577
|
}
|
|
1423
1578
|
}
|
|
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
|
-
});
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
|
|
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
|
-
});
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ctx) {
|
|
1531
|
-
const projection = ctx.value;
|
|
1532
|
-
const { projectedAt, snapshot, worstCaseDistance } = projection;
|
|
1533
|
-
const { omnichainSnapshot } = snapshot;
|
|
1534
|
-
const expectedWorstCaseDistance = projectedAt - omnichainSnapshot.omnichainIndexingCursor;
|
|
1535
|
-
if (worstCaseDistance !== expectedWorstCaseDistance) {
|
|
1536
|
-
ctx.issues.push({
|
|
1537
|
-
code: "custom",
|
|
1538
|
-
input: projection,
|
|
1539
|
-
message: "`worstCaseDistance` must be the exact difference between `projectedAt` and `snapshot.omnichainIndexingCursor`."
|
|
1540
|
-
});
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
|
|
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) {
|
|
1579
|
+
function invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain(ctx) {
|
|
1580
|
+
const snapshot = ctx.value;
|
|
1581
|
+
const indexedChains = Array.from(snapshot.chains.values()).filter(
|
|
1582
|
+
(chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed || chain.chainStatus === ChainIndexingStatusIds.Following
|
|
1583
|
+
);
|
|
1584
|
+
if (indexedChains.length === 0) {
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
const indexedChainLatestIndexedBlocks = indexedChains.map(
|
|
1588
|
+
(chain) => chain.latestIndexedBlock.timestamp
|
|
1589
|
+
);
|
|
1590
|
+
const indexedChainHighestLatestIndexedBlock = Math.max(...indexedChainLatestIndexedBlocks);
|
|
1591
|
+
if (snapshot.omnichainIndexingCursor !== indexedChainHighestLatestIndexedBlock) {
|
|
1602
1592
|
ctx.issues.push({
|
|
1603
1593
|
code: "custom",
|
|
1604
|
-
input:
|
|
1605
|
-
message: "`
|
|
1594
|
+
input: snapshot,
|
|
1595
|
+
message: "`omnichainIndexingCursor` must be same as the highest `latestIndexedBlock` across all indexed chains."
|
|
1606
1596
|
});
|
|
1607
1597
|
}
|
|
1608
|
-
|
|
1598
|
+
}
|
|
1599
|
+
function invariant_omnichainSnapshotUnstartedHasValidChains(ctx) {
|
|
1600
|
+
const chains = ctx.value;
|
|
1601
|
+
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(
|
|
1602
|
+
Array.from(chains.values())
|
|
1603
|
+
);
|
|
1604
|
+
if (hasValidChains === false) {
|
|
1609
1605
|
ctx.issues.push({
|
|
1610
1606
|
code: "custom",
|
|
1611
|
-
input:
|
|
1612
|
-
message:
|
|
1607
|
+
input: chains,
|
|
1608
|
+
message: `For omnichain status snapshot 'unstarted', all chains must have "queued" status.`
|
|
1613
1609
|
});
|
|
1614
1610
|
}
|
|
1615
1611
|
}
|
|
1616
|
-
function
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1612
|
+
function invariant_omnichainStatusSnapshotBackfillHasValidChains(ctx) {
|
|
1613
|
+
const chains = ctx.value;
|
|
1614
|
+
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(
|
|
1615
|
+
Array.from(chains.values())
|
|
1616
|
+
);
|
|
1617
|
+
if (hasValidChains === false) {
|
|
1619
1618
|
ctx.issues.push({
|
|
1620
1619
|
code: "custom",
|
|
1621
|
-
input:
|
|
1622
|
-
message:
|
|
1620
|
+
input: chains,
|
|
1621
|
+
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".`
|
|
1623
1622
|
});
|
|
1624
1623
|
}
|
|
1625
|
-
|
|
1624
|
+
}
|
|
1625
|
+
function invariant_omnichainStatusSnapshotCompletedHasValidChains(ctx) {
|
|
1626
|
+
const chains = ctx.value;
|
|
1627
|
+
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(
|
|
1628
|
+
Array.from(chains.values())
|
|
1629
|
+
);
|
|
1630
|
+
if (hasValidChains === false) {
|
|
1626
1631
|
ctx.issues.push({
|
|
1627
1632
|
code: "custom",
|
|
1628
|
-
input:
|
|
1629
|
-
message:
|
|
1633
|
+
input: chains,
|
|
1634
|
+
message: `For omnichain status snapshot 'completed', all chains must have "completed" status.`
|
|
1630
1635
|
});
|
|
1631
1636
|
}
|
|
1632
1637
|
}
|
|
1633
|
-
var
|
|
1634
|
-
import_v48.z.object({
|
|
1635
|
-
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1636
|
-
startBlock: makeBlockRefSchema(valueLabel)
|
|
1637
|
-
}),
|
|
1638
|
-
import_v48.z.object({
|
|
1639
|
-
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1640
|
-
startBlock: makeBlockRefSchema(valueLabel),
|
|
1641
|
-
endBlock: makeBlockRefSchema(valueLabel)
|
|
1642
|
-
})
|
|
1643
|
-
]);
|
|
1644
|
-
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1645
|
-
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Queued),
|
|
1646
|
-
config: makeChainIndexingConfigSchema(valueLabel)
|
|
1647
|
-
}).check(invariant_chainSnapshotQueuedBlocks);
|
|
1648
|
-
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1649
|
-
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Backfill),
|
|
1650
|
-
config: makeChainIndexingConfigSchema(valueLabel),
|
|
1651
|
-
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1652
|
-
backfillEndBlock: makeBlockRefSchema(valueLabel)
|
|
1653
|
-
}).check(invariant_chainSnapshotBackfillBlocks);
|
|
1654
|
-
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1655
|
-
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Completed),
|
|
1656
|
-
config: import_v48.z.object({
|
|
1657
|
-
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1658
|
-
startBlock: makeBlockRefSchema(valueLabel),
|
|
1659
|
-
endBlock: makeBlockRefSchema(valueLabel)
|
|
1660
|
-
}),
|
|
1661
|
-
latestIndexedBlock: makeBlockRefSchema(valueLabel)
|
|
1662
|
-
}).check(invariant_chainSnapshotCompletedBlocks);
|
|
1663
|
-
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1664
|
-
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Following),
|
|
1665
|
-
config: import_v48.z.object({
|
|
1666
|
-
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1667
|
-
startBlock: makeBlockRefSchema(valueLabel)
|
|
1668
|
-
}),
|
|
1669
|
-
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1670
|
-
latestKnownBlock: makeBlockRefSchema(valueLabel)
|
|
1671
|
-
}).check(invariant_chainSnapshotFollowingBlocks);
|
|
1672
|
-
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v48.z.discriminatedUnion("chainStatus", [
|
|
1673
|
-
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1674
|
-
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1675
|
-
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
1676
|
-
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
|
|
1677
|
-
]);
|
|
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), {
|
|
1638
|
+
var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v410.z.record(makeChainIdStringSchema(), makeChainIndexingStatusSnapshotSchema(valueLabel), {
|
|
1682
1639
|
error: "Chains indexing statuses must be an object mapping valid chain IDs to their indexing status snapshots."
|
|
1683
1640
|
}).transform((serializedChainsIndexingStatus) => {
|
|
1684
1641
|
const chainsIndexingStatus = /* @__PURE__ */ new Map();
|
|
@@ -1687,29 +1644,29 @@ var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v49.z.rec
|
|
|
1687
1644
|
}
|
|
1688
1645
|
return chainsIndexingStatus;
|
|
1689
1646
|
});
|
|
1690
|
-
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) =>
|
|
1691
|
-
omnichainStatus:
|
|
1647
|
+
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1648
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Unstarted),
|
|
1692
1649
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainSnapshotUnstartedHasValidChains).transform((chains) => chains),
|
|
1693
1650
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1694
1651
|
});
|
|
1695
|
-
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =>
|
|
1696
|
-
omnichainStatus:
|
|
1652
|
+
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1653
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Backfill),
|
|
1697
1654
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotBackfillHasValidChains).transform(
|
|
1698
1655
|
(chains) => chains
|
|
1699
1656
|
),
|
|
1700
1657
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1701
1658
|
});
|
|
1702
|
-
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) =>
|
|
1703
|
-
omnichainStatus:
|
|
1659
|
+
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1660
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Completed),
|
|
1704
1661
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotCompletedHasValidChains).transform((chains) => chains),
|
|
1705
1662
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1706
1663
|
});
|
|
1707
|
-
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) =>
|
|
1708
|
-
omnichainStatus:
|
|
1664
|
+
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1665
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Following),
|
|
1709
1666
|
chains: makeChainIndexingStatusesSchema(valueLabel),
|
|
1710
1667
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1711
1668
|
});
|
|
1712
|
-
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") =>
|
|
1669
|
+
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => import_v410.z.discriminatedUnion("omnichainStatus", [
|
|
1713
1670
|
makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
|
|
1714
1671
|
makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1715
1672
|
makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
@@ -1717,75 +1674,132 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
|
|
|
1717
1674
|
]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
|
|
1718
1675
|
invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
|
|
1719
1676
|
).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
|
|
1720
|
-
|
|
1721
|
-
|
|
1677
|
+
|
|
1678
|
+
// src/ensindexer/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
|
|
1679
|
+
function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
|
|
1680
|
+
const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
|
|
1681
|
+
const { omnichainIndexingCursor } = omnichainSnapshot;
|
|
1682
|
+
if (slowestChainIndexingCursor !== omnichainIndexingCursor) {
|
|
1683
|
+
console.log("invariant_slowestChainEqualsToOmnichainSnapshotTime", {
|
|
1684
|
+
slowestChainIndexingCursor,
|
|
1685
|
+
omnichainIndexingCursor
|
|
1686
|
+
});
|
|
1687
|
+
ctx.issues.push({
|
|
1688
|
+
code: "custom",
|
|
1689
|
+
input: ctx.value,
|
|
1690
|
+
message: `'slowestChainIndexingCursor' must be equal to 'omnichainSnapshot.omnichainIndexingCursor'`
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
1695
|
+
const { snapshotTime, omnichainSnapshot } = ctx.value;
|
|
1696
|
+
const chains = Array.from(omnichainSnapshot.chains.values());
|
|
1697
|
+
const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1698
|
+
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.configType === ChainIndexingConfigTypeIds.Definite).map((chainConfig) => chainConfig.endBlock.timestamp);
|
|
1699
|
+
const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
|
|
1700
|
+
const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
|
|
1701
|
+
const highestKnownBlockTimestamp = Math.max(
|
|
1702
|
+
...startBlockTimestamps,
|
|
1703
|
+
...endBlockTimestamps,
|
|
1704
|
+
...backfillEndBlockTimestamps,
|
|
1705
|
+
...latestKnownBlockTimestamps
|
|
1706
|
+
);
|
|
1707
|
+
if (snapshotTime < highestKnownBlockTimestamp) {
|
|
1708
|
+
ctx.issues.push({
|
|
1709
|
+
code: "custom",
|
|
1710
|
+
input: ctx.value,
|
|
1711
|
+
message: `'snapshotTime' (${snapshotTime}) must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => import_v411.z.strictObject({
|
|
1716
|
+
strategy: import_v411.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_v411.z.discriminatedUnion("strategy", [
|
|
1727
1722
|
makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
|
|
1728
1723
|
]);
|
|
1729
|
-
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v49.z.strictObject({
|
|
1730
|
-
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1731
|
-
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1732
|
-
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
1733
|
-
}).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
|
|
1734
1724
|
|
|
1735
|
-
// src/ensindexer/indexing-status/deserialize.ts
|
|
1736
|
-
function
|
|
1737
|
-
const schema =
|
|
1725
|
+
// src/ensindexer/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
|
|
1726
|
+
function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1727
|
+
const schema = makeCrossChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1738
1728
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
1739
1729
|
if (parsed.error) {
|
|
1740
1730
|
throw new Error(
|
|
1741
|
-
`Cannot deserialize into
|
|
1742
|
-
${(0,
|
|
1731
|
+
`Cannot deserialize into CrossChainIndexingStatusSnapshot:
|
|
1732
|
+
${(0, import_v412.prettifyError)(parsed.error)}
|
|
1743
1733
|
`
|
|
1744
1734
|
);
|
|
1745
1735
|
}
|
|
1746
1736
|
return parsed.data;
|
|
1747
1737
|
}
|
|
1748
|
-
|
|
1749
|
-
|
|
1738
|
+
|
|
1739
|
+
// src/ensindexer/indexing-status/deserialize/omnichain-indexing-status-snapshot.ts
|
|
1740
|
+
var import_v413 = require("zod/v4");
|
|
1741
|
+
function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1742
|
+
const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
|
|
1750
1743
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
1751
1744
|
if (parsed.error) {
|
|
1752
1745
|
throw new Error(
|
|
1753
|
-
`Cannot deserialize into
|
|
1754
|
-
${(0,
|
|
1746
|
+
`Cannot deserialize into OmnichainIndexingStatusSnapshot:
|
|
1747
|
+
${(0, import_v413.prettifyError)(parsed.error)}
|
|
1755
1748
|
`
|
|
1756
1749
|
);
|
|
1757
1750
|
}
|
|
1758
1751
|
return parsed.data;
|
|
1759
1752
|
}
|
|
1753
|
+
|
|
1754
|
+
// src/ensindexer/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
1755
|
+
var import_v415 = require("zod/v4");
|
|
1756
|
+
|
|
1757
|
+
// src/ensindexer/indexing-status/zod-schema/realtime-indexing-status-projection.ts
|
|
1758
|
+
var import_v414 = require("zod/v4");
|
|
1759
|
+
function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
|
|
1760
|
+
const projection = ctx.value;
|
|
1761
|
+
const { snapshot, projectedAt } = projection;
|
|
1762
|
+
if (snapshot.snapshotTime > projectedAt) {
|
|
1763
|
+
ctx.issues.push({
|
|
1764
|
+
code: "custom",
|
|
1765
|
+
input: projection,
|
|
1766
|
+
message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
|
|
1767
|
+
});
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ctx) {
|
|
1771
|
+
const projection = ctx.value;
|
|
1772
|
+
const { projectedAt, snapshot, worstCaseDistance } = projection;
|
|
1773
|
+
const expectedWorstCaseDistance = projectedAt - snapshot.slowestChainIndexingCursor;
|
|
1774
|
+
if (worstCaseDistance !== expectedWorstCaseDistance) {
|
|
1775
|
+
ctx.issues.push({
|
|
1776
|
+
code: "custom",
|
|
1777
|
+
input: projection,
|
|
1778
|
+
message: "`worstCaseDistance` must be the exact difference between `projectedAt` and `snapshot.slowestChainIndexingCursor`."
|
|
1779
|
+
});
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v414.z.strictObject({
|
|
1783
|
+
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1784
|
+
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1785
|
+
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
1786
|
+
}).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
|
|
1787
|
+
|
|
1788
|
+
// src/ensindexer/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
1760
1789
|
function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel) {
|
|
1761
1790
|
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
1762
1791
|
const parsed = schema.safeParse(maybeProjection);
|
|
1763
1792
|
if (parsed.error) {
|
|
1764
1793
|
throw new Error(
|
|
1765
1794
|
`Cannot deserialize into RealtimeIndexingStatusProjection:
|
|
1766
|
-
${(0,
|
|
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)}
|
|
1795
|
+
${(0, import_v415.prettifyError)(parsed.error)}
|
|
1782
1796
|
`
|
|
1783
1797
|
);
|
|
1784
1798
|
}
|
|
1785
1799
|
return parsed.data;
|
|
1786
1800
|
}
|
|
1787
1801
|
|
|
1788
|
-
// src/ensindexer/indexing-status/projection.ts
|
|
1802
|
+
// src/ensindexer/indexing-status/realtime-indexing-status-projection.ts
|
|
1789
1803
|
function createRealtimeIndexingStatusProjection(snapshot, now) {
|
|
1790
1804
|
const projectedAt = Math.max(now, snapshot.snapshotTime);
|
|
1791
1805
|
return {
|
|
@@ -1848,27 +1862,7 @@ function serializeChainIndexingSnapshots(chains) {
|
|
|
1848
1862
|
return serializedSnapshots;
|
|
1849
1863
|
}
|
|
1850
1864
|
|
|
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
|
-
}
|
|
1865
|
+
// src/ensindexer/indexing-status/serialize/omnichain-indexing-status-snapshot.ts
|
|
1872
1866
|
function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
|
|
1873
1867
|
switch (indexingStatus.omnichainStatus) {
|
|
1874
1868
|
case OmnichainIndexingStatusIds.Unstarted:
|
|
@@ -1899,14 +1893,38 @@ function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
|
|
|
1899
1893
|
}
|
|
1900
1894
|
}
|
|
1901
1895
|
|
|
1896
|
+
// src/ensindexer/indexing-status/serialize/cross-chain-indexing-status-snapshot.ts
|
|
1897
|
+
function serializeCrossChainIndexingStatusSnapshotOmnichain({
|
|
1898
|
+
strategy,
|
|
1899
|
+
slowestChainIndexingCursor,
|
|
1900
|
+
snapshotTime,
|
|
1901
|
+
omnichainSnapshot
|
|
1902
|
+
}) {
|
|
1903
|
+
return {
|
|
1904
|
+
strategy,
|
|
1905
|
+
slowestChainIndexingCursor,
|
|
1906
|
+
snapshotTime,
|
|
1907
|
+
omnichainSnapshot: serializeOmnichainIndexingStatusSnapshot(omnichainSnapshot)
|
|
1908
|
+
};
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// src/ensindexer/indexing-status/serialize/realtime-indexing-status-projection.ts
|
|
1912
|
+
function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
1913
|
+
return {
|
|
1914
|
+
projectedAt: indexingProjection.projectedAt,
|
|
1915
|
+
worstCaseDistance: indexingProjection.worstCaseDistance,
|
|
1916
|
+
snapshot: serializeCrossChainIndexingStatusSnapshotOmnichain(indexingProjection.snapshot)
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1902
1920
|
// src/ensindexer/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
1903
|
-
var
|
|
1921
|
+
var import_v416 = require("zod/v4");
|
|
1904
1922
|
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
1905
1923
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1906
1924
|
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
1907
1925
|
if (parsed.error) {
|
|
1908
1926
|
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
1909
|
-
${(0,
|
|
1927
|
+
${(0, import_v416.prettifyError)(parsed.error)}
|
|
1910
1928
|
`);
|
|
1911
1929
|
}
|
|
1912
1930
|
return parsed.data;
|
|
@@ -1933,10 +1951,10 @@ function serializeConfigResponse(response) {
|
|
|
1933
1951
|
}
|
|
1934
1952
|
|
|
1935
1953
|
// src/api/indexing-status/deserialize.ts
|
|
1936
|
-
var
|
|
1954
|
+
var import_v418 = require("zod/v4");
|
|
1937
1955
|
|
|
1938
1956
|
// src/api/indexing-status/zod-schemas.ts
|
|
1939
|
-
var
|
|
1957
|
+
var import_v417 = require("zod/v4");
|
|
1940
1958
|
|
|
1941
1959
|
// src/api/indexing-status/response.ts
|
|
1942
1960
|
var IndexingStatusResponseCodes = {
|
|
@@ -1951,14 +1969,14 @@ var IndexingStatusResponseCodes = {
|
|
|
1951
1969
|
};
|
|
1952
1970
|
|
|
1953
1971
|
// src/api/indexing-status/zod-schemas.ts
|
|
1954
|
-
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") =>
|
|
1955
|
-
responseCode:
|
|
1972
|
+
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v417.z.strictObject({
|
|
1973
|
+
responseCode: import_v417.z.literal(IndexingStatusResponseCodes.Ok),
|
|
1956
1974
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1957
1975
|
});
|
|
1958
|
-
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") =>
|
|
1959
|
-
responseCode:
|
|
1976
|
+
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v417.z.strictObject({
|
|
1977
|
+
responseCode: import_v417.z.literal(IndexingStatusResponseCodes.Error)
|
|
1960
1978
|
});
|
|
1961
|
-
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") =>
|
|
1979
|
+
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v417.z.discriminatedUnion("responseCode", [
|
|
1962
1980
|
makeIndexingStatusResponseOkSchema(valueLabel),
|
|
1963
1981
|
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
1964
1982
|
]);
|
|
@@ -1968,7 +1986,7 @@ function deserializeIndexingStatusResponse(maybeResponse) {
|
|
|
1968
1986
|
const parsed = makeIndexingStatusResponseSchema().safeParse(maybeResponse);
|
|
1969
1987
|
if (parsed.error) {
|
|
1970
1988
|
throw new Error(`Cannot deserialize IndexingStatusResponse:
|
|
1971
|
-
${(0,
|
|
1989
|
+
${(0, import_v418.prettifyError)(parsed.error)}
|
|
1972
1990
|
`);
|
|
1973
1991
|
}
|
|
1974
1992
|
return parsed.data;
|
|
@@ -1988,20 +2006,20 @@ function serializeIndexingStatusResponse(response) {
|
|
|
1988
2006
|
}
|
|
1989
2007
|
|
|
1990
2008
|
// src/api/name-tokens/deserialize.ts
|
|
1991
|
-
var
|
|
2009
|
+
var import_v423 = require("zod/v4");
|
|
1992
2010
|
|
|
1993
2011
|
// src/api/name-tokens/zod-schemas.ts
|
|
1994
2012
|
var import_viem14 = require("viem");
|
|
1995
|
-
var
|
|
2013
|
+
var import_v422 = require("zod/v4");
|
|
1996
2014
|
|
|
1997
2015
|
// src/tokenscope/assets.ts
|
|
1998
2016
|
var import_viem13 = require("viem");
|
|
1999
|
-
var
|
|
2017
|
+
var import_v420 = require("zod/v4");
|
|
2000
2018
|
|
|
2001
2019
|
// src/tokenscope/zod-schemas.ts
|
|
2002
2020
|
var import_caip3 = require("caip");
|
|
2003
2021
|
var import_viem12 = require("viem");
|
|
2004
|
-
var
|
|
2022
|
+
var import_v419 = require("zod/v4");
|
|
2005
2023
|
|
|
2006
2024
|
// src/shared/types.ts
|
|
2007
2025
|
var AssetNamespaces = {
|
|
@@ -2124,10 +2142,10 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2124
2142
|
}
|
|
2125
2143
|
|
|
2126
2144
|
// src/tokenscope/zod-schemas.ts
|
|
2127
|
-
var tokenIdSchemaSerializable =
|
|
2128
|
-
var tokenIdSchemaNative =
|
|
2145
|
+
var tokenIdSchemaSerializable = import_v419.z.string();
|
|
2146
|
+
var tokenIdSchemaNative = import_v419.z.preprocess(
|
|
2129
2147
|
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2130
|
-
|
|
2148
|
+
import_v419.z.bigint().positive()
|
|
2131
2149
|
);
|
|
2132
2150
|
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2133
2151
|
if (serializable) {
|
|
@@ -2137,13 +2155,13 @@ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false
|
|
|
2137
2155
|
}
|
|
2138
2156
|
}
|
|
2139
2157
|
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2140
|
-
return
|
|
2141
|
-
assetNamespace:
|
|
2158
|
+
return import_v419.z.object({
|
|
2159
|
+
assetNamespace: import_v419.z.enum(AssetNamespaces),
|
|
2142
2160
|
contract: makeAccountIdSchema(valueLabel),
|
|
2143
2161
|
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2144
2162
|
});
|
|
2145
2163
|
};
|
|
2146
|
-
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") =>
|
|
2164
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v419.z.preprocess((v) => {
|
|
2147
2165
|
if (typeof v === "string") {
|
|
2148
2166
|
const result = new import_caip3.AssetId(v);
|
|
2149
2167
|
return {
|
|
@@ -2167,20 +2185,20 @@ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
|
2167
2185
|
});
|
|
2168
2186
|
}
|
|
2169
2187
|
}
|
|
2170
|
-
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") =>
|
|
2171
|
-
ownershipType:
|
|
2188
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v419.z.object({
|
|
2189
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2172
2190
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2173
2191
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2174
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") =>
|
|
2175
|
-
ownershipType:
|
|
2192
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v419.z.object({
|
|
2193
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2176
2194
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2177
2195
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2178
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") =>
|
|
2179
|
-
ownershipType:
|
|
2196
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v419.z.object({
|
|
2197
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2180
2198
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2181
2199
|
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2182
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") =>
|
|
2183
|
-
ownershipType:
|
|
2200
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v419.z.object({
|
|
2201
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2184
2202
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2185
2203
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2186
2204
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
@@ -2193,16 +2211,16 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
|
2193
2211
|
});
|
|
2194
2212
|
}
|
|
2195
2213
|
}
|
|
2196
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") =>
|
|
2214
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v419.z.discriminatedUnion("ownershipType", [
|
|
2197
2215
|
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2198
2216
|
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2199
2217
|
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2200
2218
|
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2201
2219
|
]);
|
|
2202
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) =>
|
|
2220
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v419.z.object({
|
|
2203
2221
|
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2204
2222
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2205
|
-
mintStatus:
|
|
2223
|
+
mintStatus: import_v419.z.enum(NFTMintStatuses)
|
|
2206
2224
|
});
|
|
2207
2225
|
|
|
2208
2226
|
// src/tokenscope/assets.ts
|
|
@@ -2218,7 +2236,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2218
2236
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2219
2237
|
if (parsed.error) {
|
|
2220
2238
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2221
|
-
${(0,
|
|
2239
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
2222
2240
|
`);
|
|
2223
2241
|
}
|
|
2224
2242
|
return parsed.data;
|
|
@@ -2228,7 +2246,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
2228
2246
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2229
2247
|
if (parsed.error) {
|
|
2230
2248
|
throw new RangeError(`Cannot parse AssetId:
|
|
2231
|
-
${(0,
|
|
2249
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
2232
2250
|
`);
|
|
2233
2251
|
}
|
|
2234
2252
|
return parsed.data;
|
|
@@ -2450,10 +2468,10 @@ ${formatNFTTransferEventMetadata(metadata)}`
|
|
|
2450
2468
|
};
|
|
2451
2469
|
|
|
2452
2470
|
// src/api/shared/errors/zod-schemas.ts
|
|
2453
|
-
var
|
|
2454
|
-
var ErrorResponseSchema =
|
|
2455
|
-
message:
|
|
2456
|
-
details:
|
|
2471
|
+
var import_v421 = require("zod/v4");
|
|
2472
|
+
var ErrorResponseSchema = import_v421.z.object({
|
|
2473
|
+
message: import_v421.z.string(),
|
|
2474
|
+
details: import_v421.z.optional(import_v421.z.unknown())
|
|
2457
2475
|
});
|
|
2458
2476
|
|
|
2459
2477
|
// src/api/name-tokens/response.ts
|
|
@@ -2492,10 +2510,10 @@ var NameTokensResponseErrorCodes = {
|
|
|
2492
2510
|
};
|
|
2493
2511
|
|
|
2494
2512
|
// src/api/name-tokens/zod-schemas.ts
|
|
2495
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) =>
|
|
2513
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v422.z.object({
|
|
2496
2514
|
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2497
2515
|
name: makeReinterpretedNameSchema(valueLabel),
|
|
2498
|
-
tokens:
|
|
2516
|
+
tokens: import_v422.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2499
2517
|
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2500
2518
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2501
2519
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
@@ -2537,32 +2555,32 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2537
2555
|
});
|
|
2538
2556
|
}
|
|
2539
2557
|
});
|
|
2540
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) =>
|
|
2541
|
-
responseCode:
|
|
2558
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v422.z.strictObject({
|
|
2559
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Ok),
|
|
2542
2560
|
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2543
2561
|
});
|
|
2544
|
-
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") =>
|
|
2545
|
-
responseCode:
|
|
2546
|
-
errorCode:
|
|
2562
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v422.z.strictObject({
|
|
2563
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Error),
|
|
2564
|
+
errorCode: import_v422.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2547
2565
|
error: ErrorResponseSchema
|
|
2548
2566
|
});
|
|
2549
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2550
|
-
responseCode:
|
|
2551
|
-
errorCode:
|
|
2567
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v422.z.strictObject({
|
|
2568
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Error),
|
|
2569
|
+
errorCode: import_v422.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2552
2570
|
error: ErrorResponseSchema
|
|
2553
2571
|
});
|
|
2554
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2555
|
-
responseCode:
|
|
2556
|
-
errorCode:
|
|
2572
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v422.z.strictObject({
|
|
2573
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Error),
|
|
2574
|
+
errorCode: import_v422.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2557
2575
|
error: ErrorResponseSchema
|
|
2558
2576
|
});
|
|
2559
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2577
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v422.z.discriminatedUnion("errorCode", [
|
|
2560
2578
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2561
2579
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2562
2580
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2563
2581
|
]);
|
|
2564
2582
|
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2565
|
-
return
|
|
2583
|
+
return import_v422.z.discriminatedUnion("responseCode", [
|
|
2566
2584
|
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2567
2585
|
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2568
2586
|
]);
|
|
@@ -2575,7 +2593,7 @@ function deserializedNameTokensResponse(maybeResponse) {
|
|
|
2575
2593
|
);
|
|
2576
2594
|
if (parsed.error) {
|
|
2577
2595
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2578
|
-
${(0,
|
|
2596
|
+
${(0, import_v423.prettifyError)(parsed.error)}
|
|
2579
2597
|
`);
|
|
2580
2598
|
}
|
|
2581
2599
|
return parsed.data;
|
|
@@ -2649,14 +2667,14 @@ function serializeNameTokensResponse(response) {
|
|
|
2649
2667
|
}
|
|
2650
2668
|
|
|
2651
2669
|
// src/api/registrar-actions/deserialize.ts
|
|
2652
|
-
var
|
|
2670
|
+
var import_v427 = require("zod/v4");
|
|
2653
2671
|
|
|
2654
2672
|
// src/api/registrar-actions/zod-schemas.ts
|
|
2655
2673
|
var import_ens7 = require("viem/ens");
|
|
2656
|
-
var
|
|
2674
|
+
var import_v426 = require("zod/v4");
|
|
2657
2675
|
|
|
2658
2676
|
// src/registrars/zod-schemas.ts
|
|
2659
|
-
var
|
|
2677
|
+
var import_v424 = require("zod/v4");
|
|
2660
2678
|
|
|
2661
2679
|
// src/registrars/encoded-referrer.ts
|
|
2662
2680
|
var import_viem15 = require("viem");
|
|
@@ -2731,11 +2749,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
2731
2749
|
}
|
|
2732
2750
|
|
|
2733
2751
|
// src/registrars/zod-schemas.ts
|
|
2734
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
2752
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v424.z.object({
|
|
2735
2753
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
2736
2754
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
2737
2755
|
});
|
|
2738
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
2756
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v424.z.object({
|
|
2739
2757
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
2740
2758
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
2741
2759
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -2751,18 +2769,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
2751
2769
|
});
|
|
2752
2770
|
}
|
|
2753
2771
|
}
|
|
2754
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
2772
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v424.z.union([
|
|
2755
2773
|
// pricing available
|
|
2756
|
-
|
|
2774
|
+
import_v424.z.object({
|
|
2757
2775
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
2758
2776
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
2759
2777
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
2760
2778
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
2761
2779
|
// pricing unknown
|
|
2762
|
-
|
|
2763
|
-
baseCost:
|
|
2764
|
-
premium:
|
|
2765
|
-
total:
|
|
2780
|
+
import_v424.z.object({
|
|
2781
|
+
baseCost: import_v424.z.null(),
|
|
2782
|
+
premium: import_v424.z.null(),
|
|
2783
|
+
total: import_v424.z.null()
|
|
2766
2784
|
}).transform((v) => v)
|
|
2767
2785
|
]);
|
|
2768
2786
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -2785,9 +2803,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
2785
2803
|
});
|
|
2786
2804
|
}
|
|
2787
2805
|
}
|
|
2788
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
2806
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v424.z.union([
|
|
2789
2807
|
// referral available
|
|
2790
|
-
|
|
2808
|
+
import_v424.z.object({
|
|
2791
2809
|
encodedReferrer: makeHexStringSchema(
|
|
2792
2810
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
2793
2811
|
`${valueLabel} Encoded Referrer`
|
|
@@ -2795,9 +2813,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
2795
2813
|
decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
2796
2814
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
2797
2815
|
// referral not applicable
|
|
2798
|
-
|
|
2799
|
-
encodedReferrer:
|
|
2800
|
-
decodedReferrer:
|
|
2816
|
+
import_v424.z.object({
|
|
2817
|
+
encodedReferrer: import_v424.z.null(),
|
|
2818
|
+
decodedReferrer: import_v424.z.null()
|
|
2801
2819
|
})
|
|
2802
2820
|
]);
|
|
2803
2821
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -2810,9 +2828,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
2810
2828
|
});
|
|
2811
2829
|
}
|
|
2812
2830
|
}
|
|
2813
|
-
var EventIdSchema =
|
|
2814
|
-
var EventIdsSchema =
|
|
2815
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
2831
|
+
var EventIdSchema = import_v424.z.string().nonempty();
|
|
2832
|
+
var EventIdsSchema = import_v424.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
2833
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v424.z.object({
|
|
2816
2834
|
id: EventIdSchema,
|
|
2817
2835
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
2818
2836
|
registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2826,38 +2844,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => im
|
|
|
2826
2844
|
eventIds: EventIdsSchema
|
|
2827
2845
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2828
2846
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2829
|
-
type:
|
|
2847
|
+
type: import_v424.z.literal(RegistrarActionTypes.Registration)
|
|
2830
2848
|
});
|
|
2831
2849
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2832
|
-
type:
|
|
2850
|
+
type: import_v424.z.literal(RegistrarActionTypes.Renewal)
|
|
2833
2851
|
});
|
|
2834
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
2852
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v424.z.discriminatedUnion("type", [
|
|
2835
2853
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2836
2854
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2837
2855
|
]);
|
|
2838
2856
|
|
|
2839
2857
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2840
|
-
var
|
|
2858
|
+
var import_v425 = require("zod/v4");
|
|
2841
2859
|
|
|
2842
2860
|
// src/api/shared/pagination/request.ts
|
|
2843
2861
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2844
2862
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
2845
2863
|
|
|
2846
2864
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2847
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
2865
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v425.z.object({
|
|
2848
2866
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2849
2867
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
2850
2868
|
RECORDS_PER_PAGE_MAX,
|
|
2851
2869
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
2852
2870
|
)
|
|
2853
2871
|
});
|
|
2854
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
2855
|
-
totalRecords:
|
|
2856
|
-
totalPages:
|
|
2857
|
-
hasNext:
|
|
2858
|
-
hasPrev:
|
|
2859
|
-
startIndex:
|
|
2860
|
-
endIndex:
|
|
2872
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v425.z.object({
|
|
2873
|
+
totalRecords: import_v425.z.literal(0),
|
|
2874
|
+
totalPages: import_v425.z.literal(1),
|
|
2875
|
+
hasNext: import_v425.z.literal(false),
|
|
2876
|
+
hasPrev: import_v425.z.literal(false),
|
|
2877
|
+
startIndex: import_v425.z.undefined(),
|
|
2878
|
+
endIndex: import_v425.z.undefined()
|
|
2861
2879
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
2862
2880
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
2863
2881
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -2892,15 +2910,15 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
2892
2910
|
});
|
|
2893
2911
|
}
|
|
2894
2912
|
}
|
|
2895
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
2913
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v425.z.object({
|
|
2896
2914
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2897
2915
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2898
|
-
hasNext:
|
|
2899
|
-
hasPrev:
|
|
2916
|
+
hasNext: import_v425.z.boolean(),
|
|
2917
|
+
hasPrev: import_v425.z.boolean(),
|
|
2900
2918
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
2901
2919
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
2902
2920
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
2903
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
2921
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v425.z.union([
|
|
2904
2922
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
2905
2923
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
2906
2924
|
]);
|
|
@@ -2930,21 +2948,21 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
2930
2948
|
});
|
|
2931
2949
|
}
|
|
2932
2950
|
}
|
|
2933
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
2951
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v426.z.object({
|
|
2934
2952
|
action: makeRegistrarActionSchema(valueLabel),
|
|
2935
2953
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
2936
2954
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2937
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
2938
|
-
responseCode:
|
|
2939
|
-
registrarActions:
|
|
2955
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v426.z.object({
|
|
2956
|
+
responseCode: import_v426.z.literal(RegistrarActionsResponseCodes.Ok),
|
|
2957
|
+
registrarActions: import_v426.z.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
2940
2958
|
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
2941
2959
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
|
|
2942
2960
|
});
|
|
2943
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
2944
|
-
responseCode:
|
|
2961
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v426.z.strictObject({
|
|
2962
|
+
responseCode: import_v426.z.literal(RegistrarActionsResponseCodes.Error),
|
|
2945
2963
|
error: ErrorResponseSchema
|
|
2946
2964
|
});
|
|
2947
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
2965
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v426.z.discriminatedUnion("responseCode", [
|
|
2948
2966
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2949
2967
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2950
2968
|
]);
|
|
@@ -2955,7 +2973,7 @@ function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
|
2955
2973
|
if (parsed.error) {
|
|
2956
2974
|
throw new Error(
|
|
2957
2975
|
`Cannot deserialize RegistrarActionsResponse:
|
|
2958
|
-
${(0,
|
|
2976
|
+
${(0, import_v427.prettifyError)(parsed.error)}
|
|
2959
2977
|
`
|
|
2960
2978
|
);
|
|
2961
2979
|
}
|
|
@@ -3203,12 +3221,12 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3203
3221
|
}
|
|
3204
3222
|
|
|
3205
3223
|
// src/api/shared/errors/deserialize.ts
|
|
3206
|
-
var
|
|
3224
|
+
var import_v428 = require("zod/v4");
|
|
3207
3225
|
function deserializeErrorResponse(maybeErrorResponse) {
|
|
3208
3226
|
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
3209
3227
|
if (parsed.error) {
|
|
3210
3228
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3211
|
-
${(0,
|
|
3229
|
+
${(0, import_v428.prettifyError)(parsed.error)}
|
|
3212
3230
|
`);
|
|
3213
3231
|
}
|
|
3214
3232
|
return parsed.data;
|