@secondlayer/shared 7.2.2 → 7.3.1
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/src/db/index.d.ts +19 -1
- package/dist/src/db/index.js +2 -1
- package/dist/src/db/index.js.map +3 -3
- package/dist/src/db/queries/chain-reorgs.d.ts +17 -0
- package/dist/src/db/queries/chain-reorgs.js +2 -1
- package/dist/src/db/queries/chain-reorgs.js.map +3 -3
- package/dist/src/db/queries/contracts.d.ts +17 -0
- package/dist/src/db/queries/integrity.d.ts +17 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +17 -0
- package/dist/src/db/queries/subgraph-operations.d.ts +17 -0
- package/dist/src/db/queries/subgraphs.d.ts +17 -0
- package/dist/src/db/queries/subgraphs.js +2 -1
- package/dist/src/db/queries/subgraphs.js.map +3 -3
- package/dist/src/db/queries/subscriptions.d.ts +17 -0
- package/dist/src/db/schema.d.ts +18 -1
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/errors.js +2 -1
- package/dist/src/errors.js.map +3 -3
- package/dist/src/index-http.d.ts +2 -0
- package/dist/src/index-http.js.map +2 -2
- package/dist/src/index.d.ts +40 -114
- package/dist/src/index.js +102 -227
- package/dist/src/index.js.map +8 -9
- package/dist/src/node/local-client.d.ts +17 -0
- package/dist/src/schemas/index.d.ts +16 -109
- package/dist/src/schemas/index.js +95 -213
- package/dist/src/schemas/index.js.map +4 -5
- package/dist/src/schemas/subgraphs.d.ts +2 -2
- package/dist/src/schemas/subgraphs.js.map +1 -1
- package/dist/src/subgraphs/spec.d.ts +4 -4
- package/dist/src/subgraphs/spec.js.map +1 -1
- package/migrations/0111_chain_read_cache.ts +64 -0
- package/package.json +2 -2
- package/dist/src/schemas/filters.d.ts +0 -94
- package/dist/src/schemas/filters.js +0 -138
- package/dist/src/schemas/filters.js.map +0 -10
package/dist/src/index.js
CHANGED
|
@@ -655,6 +655,7 @@ var TABLE_TO_DB = {
|
|
|
655
655
|
index_progress: "source",
|
|
656
656
|
contracts: "source",
|
|
657
657
|
chain_reorgs: "source",
|
|
658
|
+
chain_read_cache: "source",
|
|
658
659
|
decoded_events: "source",
|
|
659
660
|
decoder_checkpoints: "source",
|
|
660
661
|
pox4_calls: "source",
|
|
@@ -987,6 +988,7 @@ class TenantSuspendedError extends SecondLayerError {
|
|
|
987
988
|
}
|
|
988
989
|
}
|
|
989
990
|
var CODE_TO_STATUS = {
|
|
991
|
+
CHAIN_DATA_UNAVAILABLE: 503,
|
|
990
992
|
AUTHENTICATION_ERROR: 401,
|
|
991
993
|
AUTHORIZATION_ERROR: 403,
|
|
992
994
|
PAYMENT_REQUIRED: 402,
|
|
@@ -1008,128 +1010,24 @@ function getErrorMessage(err) {
|
|
|
1008
1010
|
return err instanceof Error ? err.message : String(err);
|
|
1009
1011
|
}
|
|
1010
1012
|
|
|
1011
|
-
// src/schemas/filters.ts
|
|
1012
|
-
import { isValidAddress as _isValidAddress } from "@secondlayer/stacks";
|
|
1013
|
-
import { z as z2 } from "zod";
|
|
1014
|
-
var isValidAddress = _isValidAddress;
|
|
1015
|
-
var stacksPrincipal = z2.string().refine((val) => {
|
|
1016
|
-
const parts = val.split(".");
|
|
1017
|
-
if (parts.length > 2)
|
|
1018
|
-
return false;
|
|
1019
|
-
return isValidAddress(parts[0]);
|
|
1020
|
-
}, "Invalid Stacks principal address");
|
|
1021
|
-
var baseFilter = {
|
|
1022
|
-
sender: stacksPrincipal.optional(),
|
|
1023
|
-
recipient: stacksPrincipal.optional()
|
|
1024
|
-
};
|
|
1025
|
-
var StxTransferFilterSchema = z2.object({
|
|
1026
|
-
type: z2.literal("stx_transfer"),
|
|
1027
|
-
...baseFilter,
|
|
1028
|
-
minAmount: z2.coerce.number().int().positive().optional(),
|
|
1029
|
-
maxAmount: z2.coerce.number().int().positive().optional()
|
|
1030
|
-
});
|
|
1031
|
-
var StxMintFilterSchema = z2.object({
|
|
1032
|
-
type: z2.literal("stx_mint"),
|
|
1033
|
-
recipient: stacksPrincipal.optional(),
|
|
1034
|
-
minAmount: z2.coerce.number().int().positive().optional()
|
|
1035
|
-
});
|
|
1036
|
-
var StxBurnFilterSchema = z2.object({
|
|
1037
|
-
type: z2.literal("stx_burn"),
|
|
1038
|
-
sender: stacksPrincipal.optional(),
|
|
1039
|
-
minAmount: z2.coerce.number().int().positive().optional()
|
|
1040
|
-
});
|
|
1041
|
-
var StxLockFilterSchema = z2.object({
|
|
1042
|
-
type: z2.literal("stx_lock"),
|
|
1043
|
-
lockedAddress: stacksPrincipal.optional(),
|
|
1044
|
-
minAmount: z2.coerce.number().int().positive().optional()
|
|
1045
|
-
});
|
|
1046
|
-
var FtTransferFilterSchema = z2.object({
|
|
1047
|
-
type: z2.literal("ft_transfer"),
|
|
1048
|
-
...baseFilter,
|
|
1049
|
-
assetIdentifier: z2.string().optional(),
|
|
1050
|
-
minAmount: z2.coerce.number().int().positive().optional()
|
|
1051
|
-
});
|
|
1052
|
-
var FtMintFilterSchema = z2.object({
|
|
1053
|
-
type: z2.literal("ft_mint"),
|
|
1054
|
-
recipient: stacksPrincipal.optional(),
|
|
1055
|
-
assetIdentifier: z2.string().optional(),
|
|
1056
|
-
minAmount: z2.coerce.number().int().positive().optional()
|
|
1057
|
-
});
|
|
1058
|
-
var FtBurnFilterSchema = z2.object({
|
|
1059
|
-
type: z2.literal("ft_burn"),
|
|
1060
|
-
sender: stacksPrincipal.optional(),
|
|
1061
|
-
assetIdentifier: z2.string().optional(),
|
|
1062
|
-
minAmount: z2.coerce.number().int().positive().optional()
|
|
1063
|
-
});
|
|
1064
|
-
var NftTransferFilterSchema = z2.object({
|
|
1065
|
-
type: z2.literal("nft_transfer"),
|
|
1066
|
-
...baseFilter,
|
|
1067
|
-
assetIdentifier: z2.string().optional(),
|
|
1068
|
-
tokenId: z2.string().optional()
|
|
1069
|
-
});
|
|
1070
|
-
var NftMintFilterSchema = z2.object({
|
|
1071
|
-
type: z2.literal("nft_mint"),
|
|
1072
|
-
recipient: stacksPrincipal.optional(),
|
|
1073
|
-
assetIdentifier: z2.string().optional(),
|
|
1074
|
-
tokenId: z2.string().optional()
|
|
1075
|
-
});
|
|
1076
|
-
var NftBurnFilterSchema = z2.object({
|
|
1077
|
-
type: z2.literal("nft_burn"),
|
|
1078
|
-
sender: stacksPrincipal.optional(),
|
|
1079
|
-
assetIdentifier: z2.string().optional(),
|
|
1080
|
-
tokenId: z2.string().optional()
|
|
1081
|
-
});
|
|
1082
|
-
var ContractCallFilterSchema = z2.object({
|
|
1083
|
-
type: z2.literal("contract_call"),
|
|
1084
|
-
contractId: stacksPrincipal.optional(),
|
|
1085
|
-
functionName: z2.string().optional(),
|
|
1086
|
-
caller: stacksPrincipal.optional()
|
|
1087
|
-
});
|
|
1088
|
-
var ContractDeployFilterSchema = z2.object({
|
|
1089
|
-
type: z2.literal("contract_deploy"),
|
|
1090
|
-
deployer: stacksPrincipal.optional(),
|
|
1091
|
-
contractName: z2.string().optional()
|
|
1092
|
-
});
|
|
1093
|
-
var PrintEventFilterSchema = z2.object({
|
|
1094
|
-
type: z2.literal("print_event"),
|
|
1095
|
-
contractId: stacksPrincipal.optional(),
|
|
1096
|
-
topic: z2.string().optional(),
|
|
1097
|
-
contains: z2.string().optional()
|
|
1098
|
-
});
|
|
1099
|
-
var EventFilterSchema = z2.discriminatedUnion("type", [
|
|
1100
|
-
StxTransferFilterSchema,
|
|
1101
|
-
StxMintFilterSchema,
|
|
1102
|
-
StxBurnFilterSchema,
|
|
1103
|
-
StxLockFilterSchema,
|
|
1104
|
-
FtTransferFilterSchema,
|
|
1105
|
-
FtMintFilterSchema,
|
|
1106
|
-
FtBurnFilterSchema,
|
|
1107
|
-
NftTransferFilterSchema,
|
|
1108
|
-
NftMintFilterSchema,
|
|
1109
|
-
NftBurnFilterSchema,
|
|
1110
|
-
ContractCallFilterSchema,
|
|
1111
|
-
ContractDeployFilterSchema,
|
|
1112
|
-
PrintEventFilterSchema
|
|
1113
|
-
]);
|
|
1114
|
-
|
|
1115
1013
|
// src/schemas/subgraphs.ts
|
|
1116
|
-
import { z as
|
|
1117
|
-
var DeploySubgraphRequestSchema =
|
|
1118
|
-
name:
|
|
1119
|
-
version:
|
|
1120
|
-
description:
|
|
1121
|
-
sources:
|
|
1122
|
-
schema:
|
|
1123
|
-
handlerCode:
|
|
1124
|
-
startBlock:
|
|
1125
|
-
sourceCode:
|
|
1126
|
-
databaseUrl:
|
|
1127
|
-
dryRun:
|
|
1128
|
-
visibility:
|
|
1014
|
+
import { z as z2 } from "zod";
|
|
1015
|
+
var DeploySubgraphRequestSchema = z2.object({
|
|
1016
|
+
name: z2.string().regex(/^[a-z0-9-]+$/, "lowercase alphanumeric + hyphens only").max(63),
|
|
1017
|
+
version: z2.string().optional(),
|
|
1018
|
+
description: z2.string().optional(),
|
|
1019
|
+
sources: z2.record(z2.string(), z2.record(z2.string(), z2.unknown())).refine((s) => Object.keys(s).length > 0, "Must have at least one source"),
|
|
1020
|
+
schema: z2.record(z2.string(), z2.unknown()),
|
|
1021
|
+
handlerCode: z2.string().max(1048576, "handler code exceeds 1MB limit"),
|
|
1022
|
+
startBlock: z2.number().int().nonnegative().optional(),
|
|
1023
|
+
sourceCode: z2.string().max(1048576, "source code exceeds 1MB limit").optional(),
|
|
1024
|
+
databaseUrl: z2.string().url().refine((u) => u.startsWith("postgres://") || u.startsWith("postgresql://"), "must be a postgres:// connection string").optional(),
|
|
1025
|
+
dryRun: z2.boolean().optional(),
|
|
1026
|
+
visibility: z2.enum(["public", "private"]).optional()
|
|
1129
1027
|
});
|
|
1130
1028
|
|
|
1131
1029
|
// src/schemas/subscriptions.ts
|
|
1132
|
-
import { z as
|
|
1030
|
+
import { z as z3 } from "zod";
|
|
1133
1031
|
var SUBSCRIPTION_FORMATS = [
|
|
1134
1032
|
"standard-webhooks",
|
|
1135
1033
|
"inngest",
|
|
@@ -1154,29 +1052,29 @@ var SUBSCRIPTION_FILTER_OPERATORS = [
|
|
|
1154
1052
|
"lte",
|
|
1155
1053
|
"in"
|
|
1156
1054
|
];
|
|
1157
|
-
var webhookUrl =
|
|
1158
|
-
var name =
|
|
1159
|
-
var resourceName =
|
|
1160
|
-
var SubscriptionStatusSchema =
|
|
1161
|
-
var SubscriptionFormatSchema =
|
|
1162
|
-
var SubscriptionRuntimeSchema =
|
|
1163
|
-
var SubscriptionFilterPrimitiveSchema =
|
|
1164
|
-
var SubscriptionFilterOperatorSchema =
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
in:
|
|
1055
|
+
var webhookUrl = z3.string().trim().min(1).refine((value) => value.startsWith("http://") || value.startsWith("https://"), "must be an http(s) URL");
|
|
1056
|
+
var name = z3.string().trim().min(1).max(128);
|
|
1057
|
+
var resourceName = z3.string().trim().min(1).max(128);
|
|
1058
|
+
var SubscriptionStatusSchema = z3.enum(SUBSCRIPTION_STATUSES);
|
|
1059
|
+
var SubscriptionFormatSchema = z3.enum(SUBSCRIPTION_FORMATS);
|
|
1060
|
+
var SubscriptionRuntimeSchema = z3.enum(SUBSCRIPTION_RUNTIMES);
|
|
1061
|
+
var SubscriptionFilterPrimitiveSchema = z3.union([z3.string(), z3.number().finite(), z3.boolean()]);
|
|
1062
|
+
var SubscriptionFilterOperatorSchema = z3.union([
|
|
1063
|
+
z3.object({ eq: SubscriptionFilterPrimitiveSchema }).strict(),
|
|
1064
|
+
z3.object({ neq: SubscriptionFilterPrimitiveSchema }).strict(),
|
|
1065
|
+
z3.object({ gt: z3.union([z3.string(), z3.number().finite()]) }).strict(),
|
|
1066
|
+
z3.object({ gte: z3.union([z3.string(), z3.number().finite()]) }).strict(),
|
|
1067
|
+
z3.object({ lt: z3.union([z3.string(), z3.number().finite()]) }).strict(),
|
|
1068
|
+
z3.object({ lte: z3.union([z3.string(), z3.number().finite()]) }).strict(),
|
|
1069
|
+
z3.object({
|
|
1070
|
+
in: z3.array(SubscriptionFilterPrimitiveSchema).min(1)
|
|
1173
1071
|
}).strict()
|
|
1174
1072
|
]);
|
|
1175
|
-
var SubscriptionFilterClauseSchema =
|
|
1073
|
+
var SubscriptionFilterClauseSchema = z3.union([
|
|
1176
1074
|
SubscriptionFilterPrimitiveSchema,
|
|
1177
1075
|
SubscriptionFilterOperatorSchema
|
|
1178
1076
|
]);
|
|
1179
|
-
var SubscriptionFilterSchema =
|
|
1077
|
+
var SubscriptionFilterSchema = z3.record(z3.string().min(1), SubscriptionFilterClauseSchema);
|
|
1180
1078
|
var CHAIN_TRIGGER_TYPES = [
|
|
1181
1079
|
"stx_transfer",
|
|
1182
1080
|
"stx_mint",
|
|
@@ -1197,131 +1095,131 @@ var CHAIN_TRIGGER_TYPES = [
|
|
|
1197
1095
|
"sbtc_withdrawal_reject",
|
|
1198
1096
|
"sbtc_withdrawal_swept_confirmed"
|
|
1199
1097
|
];
|
|
1200
|
-
var triggerAmount =
|
|
1201
|
-
|
|
1202
|
-
|
|
1098
|
+
var triggerAmount = z3.union([
|
|
1099
|
+
z3.string().trim().regex(/^\d+$/, "must be a non-negative integer string"),
|
|
1100
|
+
z3.number().int().nonnegative()
|
|
1203
1101
|
]);
|
|
1204
|
-
var triggerPattern =
|
|
1205
|
-
var trait =
|
|
1206
|
-
var ChainTriggerSchema =
|
|
1207
|
-
|
|
1208
|
-
type:
|
|
1102
|
+
var triggerPattern = z3.string().trim().min(1);
|
|
1103
|
+
var trait = z3.string().trim().min(1);
|
|
1104
|
+
var ChainTriggerSchema = z3.discriminatedUnion("type", [
|
|
1105
|
+
z3.object({
|
|
1106
|
+
type: z3.literal("stx_transfer"),
|
|
1209
1107
|
sender: triggerPattern.optional(),
|
|
1210
1108
|
recipient: triggerPattern.optional(),
|
|
1211
1109
|
minAmount: triggerAmount.optional(),
|
|
1212
1110
|
maxAmount: triggerAmount.optional()
|
|
1213
1111
|
}).strict(),
|
|
1214
|
-
|
|
1215
|
-
type:
|
|
1112
|
+
z3.object({
|
|
1113
|
+
type: z3.literal("stx_mint"),
|
|
1216
1114
|
recipient: triggerPattern.optional(),
|
|
1217
1115
|
minAmount: triggerAmount.optional()
|
|
1218
1116
|
}).strict(),
|
|
1219
|
-
|
|
1220
|
-
type:
|
|
1117
|
+
z3.object({
|
|
1118
|
+
type: z3.literal("stx_burn"),
|
|
1221
1119
|
sender: triggerPattern.optional(),
|
|
1222
1120
|
minAmount: triggerAmount.optional()
|
|
1223
1121
|
}).strict(),
|
|
1224
|
-
|
|
1225
|
-
type:
|
|
1122
|
+
z3.object({
|
|
1123
|
+
type: z3.literal("stx_lock"),
|
|
1226
1124
|
lockedAddress: triggerPattern.optional(),
|
|
1227
1125
|
minAmount: triggerAmount.optional()
|
|
1228
1126
|
}).strict(),
|
|
1229
|
-
|
|
1230
|
-
type:
|
|
1127
|
+
z3.object({
|
|
1128
|
+
type: z3.literal("ft_transfer"),
|
|
1231
1129
|
assetIdentifier: triggerPattern.optional(),
|
|
1232
1130
|
sender: triggerPattern.optional(),
|
|
1233
1131
|
recipient: triggerPattern.optional(),
|
|
1234
1132
|
minAmount: triggerAmount.optional(),
|
|
1235
1133
|
trait: trait.optional()
|
|
1236
1134
|
}).strict(),
|
|
1237
|
-
|
|
1238
|
-
type:
|
|
1135
|
+
z3.object({
|
|
1136
|
+
type: z3.literal("ft_mint"),
|
|
1239
1137
|
assetIdentifier: triggerPattern.optional(),
|
|
1240
1138
|
recipient: triggerPattern.optional(),
|
|
1241
1139
|
minAmount: triggerAmount.optional(),
|
|
1242
1140
|
trait: trait.optional()
|
|
1243
1141
|
}).strict(),
|
|
1244
|
-
|
|
1245
|
-
type:
|
|
1142
|
+
z3.object({
|
|
1143
|
+
type: z3.literal("ft_burn"),
|
|
1246
1144
|
assetIdentifier: triggerPattern.optional(),
|
|
1247
1145
|
sender: triggerPattern.optional(),
|
|
1248
1146
|
minAmount: triggerAmount.optional(),
|
|
1249
1147
|
trait: trait.optional()
|
|
1250
1148
|
}).strict(),
|
|
1251
|
-
|
|
1252
|
-
type:
|
|
1149
|
+
z3.object({
|
|
1150
|
+
type: z3.literal("nft_transfer"),
|
|
1253
1151
|
assetIdentifier: triggerPattern.optional(),
|
|
1254
1152
|
sender: triggerPattern.optional(),
|
|
1255
1153
|
recipient: triggerPattern.optional(),
|
|
1256
1154
|
trait: trait.optional()
|
|
1257
1155
|
}).strict(),
|
|
1258
|
-
|
|
1259
|
-
type:
|
|
1156
|
+
z3.object({
|
|
1157
|
+
type: z3.literal("nft_mint"),
|
|
1260
1158
|
assetIdentifier: triggerPattern.optional(),
|
|
1261
1159
|
recipient: triggerPattern.optional(),
|
|
1262
1160
|
trait: trait.optional()
|
|
1263
1161
|
}).strict(),
|
|
1264
|
-
|
|
1265
|
-
type:
|
|
1162
|
+
z3.object({
|
|
1163
|
+
type: z3.literal("nft_burn"),
|
|
1266
1164
|
assetIdentifier: triggerPattern.optional(),
|
|
1267
1165
|
sender: triggerPattern.optional(),
|
|
1268
1166
|
trait: trait.optional()
|
|
1269
1167
|
}).strict(),
|
|
1270
|
-
|
|
1271
|
-
type:
|
|
1168
|
+
z3.object({
|
|
1169
|
+
type: z3.literal("contract_call"),
|
|
1272
1170
|
contractId: triggerPattern.optional(),
|
|
1273
1171
|
functionName: triggerPattern.optional(),
|
|
1274
1172
|
caller: triggerPattern.optional(),
|
|
1275
1173
|
trait: trait.optional()
|
|
1276
1174
|
}).strict(),
|
|
1277
|
-
|
|
1278
|
-
type:
|
|
1175
|
+
z3.object({
|
|
1176
|
+
type: z3.literal("contract_deploy"),
|
|
1279
1177
|
deployer: triggerPattern.optional(),
|
|
1280
1178
|
contractName: triggerPattern.optional()
|
|
1281
1179
|
}).strict(),
|
|
1282
|
-
|
|
1283
|
-
type:
|
|
1180
|
+
z3.object({
|
|
1181
|
+
type: z3.literal("print_event"),
|
|
1284
1182
|
contractId: triggerPattern.optional(),
|
|
1285
1183
|
topic: triggerPattern.optional(),
|
|
1286
1184
|
trait: trait.optional()
|
|
1287
1185
|
}).strict(),
|
|
1288
|
-
|
|
1289
|
-
type:
|
|
1186
|
+
z3.object({
|
|
1187
|
+
type: z3.literal("sbtc_deposit"),
|
|
1290
1188
|
sender: triggerPattern.optional(),
|
|
1291
1189
|
minAmount: triggerAmount.optional(),
|
|
1292
1190
|
maxAmount: triggerAmount.optional(),
|
|
1293
1191
|
bitcoinTxid: triggerPattern.optional(),
|
|
1294
|
-
requestId:
|
|
1192
|
+
requestId: z3.number().int().nonnegative().optional()
|
|
1295
1193
|
}).strict(),
|
|
1296
|
-
|
|
1297
|
-
type:
|
|
1194
|
+
z3.object({
|
|
1195
|
+
type: z3.literal("sbtc_withdrawal_create"),
|
|
1298
1196
|
sender: triggerPattern.optional(),
|
|
1299
1197
|
minAmount: triggerAmount.optional(),
|
|
1300
1198
|
maxAmount: triggerAmount.optional(),
|
|
1301
|
-
requestId:
|
|
1199
|
+
requestId: z3.number().int().nonnegative().optional()
|
|
1302
1200
|
}).strict(),
|
|
1303
|
-
|
|
1304
|
-
type:
|
|
1305
|
-
requestId:
|
|
1201
|
+
z3.object({
|
|
1202
|
+
type: z3.literal("sbtc_withdrawal_accept"),
|
|
1203
|
+
requestId: z3.number().int().nonnegative().optional(),
|
|
1306
1204
|
sweepTxid: triggerPattern.optional()
|
|
1307
1205
|
}).strict(),
|
|
1308
|
-
|
|
1309
|
-
type:
|
|
1310
|
-
requestId:
|
|
1206
|
+
z3.object({
|
|
1207
|
+
type: z3.literal("sbtc_withdrawal_reject"),
|
|
1208
|
+
requestId: z3.number().int().nonnegative().optional()
|
|
1311
1209
|
}).strict(),
|
|
1312
|
-
|
|
1313
|
-
type:
|
|
1314
|
-
requestId:
|
|
1210
|
+
z3.object({
|
|
1211
|
+
type: z3.literal("sbtc_withdrawal_swept_confirmed"),
|
|
1212
|
+
requestId: z3.number().int().nonnegative().optional(),
|
|
1315
1213
|
sweepTxid: triggerPattern.optional()
|
|
1316
1214
|
}).strict()
|
|
1317
1215
|
]);
|
|
1318
|
-
var ChainTriggersSchema =
|
|
1216
|
+
var ChainTriggersSchema = z3.array(ChainTriggerSchema).min(1).max(50);
|
|
1319
1217
|
var CHAIN_TRIGGER_FIELDS = Object.fromEntries(ChainTriggerSchema._zod.def.options.map((opt) => {
|
|
1320
1218
|
const shape = opt._zod.def.shape;
|
|
1321
1219
|
const type = shape.type._zod.def.values[0];
|
|
1322
1220
|
return [type, Object.keys(shape).filter((k) => k !== "type")];
|
|
1323
1221
|
}));
|
|
1324
|
-
var CreateSubscriptionRequestSchema =
|
|
1222
|
+
var CreateSubscriptionRequestSchema = z3.object({
|
|
1325
1223
|
name,
|
|
1326
1224
|
subgraphName: resourceName.optional(),
|
|
1327
1225
|
tableName: resourceName.optional(),
|
|
@@ -1330,10 +1228,10 @@ var CreateSubscriptionRequestSchema = z4.object({
|
|
|
1330
1228
|
url: webhookUrl,
|
|
1331
1229
|
format: SubscriptionFormatSchema.default("standard-webhooks"),
|
|
1332
1230
|
runtime: SubscriptionRuntimeSchema.nullable().optional(),
|
|
1333
|
-
authConfig:
|
|
1334
|
-
maxRetries:
|
|
1335
|
-
timeoutMs:
|
|
1336
|
-
concurrency:
|
|
1231
|
+
authConfig: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1232
|
+
maxRetries: z3.number().int().min(0).max(100).optional(),
|
|
1233
|
+
timeoutMs: z3.number().int().min(100).max(300000).optional(),
|
|
1234
|
+
concurrency: z3.number().int().min(1).max(100).optional()
|
|
1337
1235
|
}).refine((v) => {
|
|
1338
1236
|
const subgraphMode = v.subgraphName !== undefined || v.tableName !== undefined;
|
|
1339
1237
|
const chainMode = v.triggers !== undefined;
|
|
@@ -1348,23 +1246,23 @@ var CreateSubscriptionRequestSchema = z4.object({
|
|
|
1348
1246
|
message: "`filter` applies to subgraph subscriptions; chain subscriptions use `triggers`",
|
|
1349
1247
|
path: ["filter"]
|
|
1350
1248
|
});
|
|
1351
|
-
var UpdateSubscriptionRequestSchema =
|
|
1249
|
+
var UpdateSubscriptionRequestSchema = z3.object({
|
|
1352
1250
|
name: name.optional(),
|
|
1353
1251
|
url: webhookUrl.optional(),
|
|
1354
1252
|
filter: SubscriptionFilterSchema.optional(),
|
|
1355
1253
|
format: SubscriptionFormatSchema.optional(),
|
|
1356
1254
|
runtime: SubscriptionRuntimeSchema.nullable().optional(),
|
|
1357
|
-
authConfig:
|
|
1358
|
-
maxRetries:
|
|
1359
|
-
timeoutMs:
|
|
1360
|
-
concurrency:
|
|
1255
|
+
authConfig: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1256
|
+
maxRetries: z3.number().int().min(0).max(100).optional(),
|
|
1257
|
+
timeoutMs: z3.number().int().min(100).max(300000).optional(),
|
|
1258
|
+
concurrency: z3.number().int().min(1).max(100).optional()
|
|
1361
1259
|
}).refine((value) => Object.keys(value).length > 0, {
|
|
1362
1260
|
message: "At least one field must be provided"
|
|
1363
1261
|
});
|
|
1364
|
-
var ReplaySubscriptionRequestSchema =
|
|
1365
|
-
fromBlock:
|
|
1366
|
-
toBlock:
|
|
1367
|
-
force:
|
|
1262
|
+
var ReplaySubscriptionRequestSchema = z3.object({
|
|
1263
|
+
fromBlock: z3.number().int().nonnegative(),
|
|
1264
|
+
toBlock: z3.number().int().nonnegative(),
|
|
1265
|
+
force: z3.string().trim().min(1).max(64).optional()
|
|
1368
1266
|
}).refine((value) => value.fromBlock <= value.toBlock, {
|
|
1369
1267
|
message: "fromBlock must be less than or equal to toBlock",
|
|
1370
1268
|
path: ["toBlock"]
|
|
@@ -1992,19 +1890,10 @@ function verifyEd25519(payload, signatureBase64, publicKey) {
|
|
|
1992
1890
|
}
|
|
1993
1891
|
}
|
|
1994
1892
|
// src/event-types.ts
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
"stx_lock",
|
|
2000
|
-
"ft_transfer",
|
|
2001
|
-
"ft_mint",
|
|
2002
|
-
"ft_burn",
|
|
2003
|
-
"nft_transfer",
|
|
2004
|
-
"nft_mint",
|
|
2005
|
-
"nft_burn",
|
|
2006
|
-
"print"
|
|
2007
|
-
];
|
|
1893
|
+
import { DECODED_EVENT_TYPES } from "@secondlayer/stacks/filters";
|
|
1894
|
+
import {
|
|
1895
|
+
DECODED_EVENT_TYPES as DECODED_EVENT_TYPES2
|
|
1896
|
+
} from "@secondlayer/stacks/filters";
|
|
2008
1897
|
var STREAMS_EVENT_TYPES = DECODED_EVENT_TYPES;
|
|
2009
1898
|
// src/db-event-types.ts
|
|
2010
1899
|
var STREAMS_DB_EVENT_TYPES = [
|
|
@@ -2122,10 +2011,6 @@ export {
|
|
|
2122
2011
|
SubscriptionFilterPrimitiveSchema,
|
|
2123
2012
|
SubscriptionFilterOperatorSchema,
|
|
2124
2013
|
SubscriptionFilterClauseSchema,
|
|
2125
|
-
StxTransferFilterSchema,
|
|
2126
|
-
StxMintFilterSchema,
|
|
2127
|
-
StxLockFilterSchema,
|
|
2128
|
-
StxBurnFilterSchema,
|
|
2129
2014
|
SecondLayerError,
|
|
2130
2015
|
SUBSCRIPTION_STATUSES,
|
|
2131
2016
|
SUBSCRIPTION_RUNTIMES,
|
|
@@ -2139,28 +2024,18 @@ export {
|
|
|
2139
2024
|
SOURCE_READ_COLUMNS,
|
|
2140
2025
|
ReplaySubscriptionRequestSchema,
|
|
2141
2026
|
RateLimitError,
|
|
2142
|
-
PrintEventFilterSchema,
|
|
2143
2027
|
PaymentRequiredError,
|
|
2144
2028
|
NotFoundError,
|
|
2145
|
-
NftTransferFilterSchema,
|
|
2146
|
-
NftMintFilterSchema,
|
|
2147
|
-
NftBurnFilterSchema,
|
|
2148
2029
|
KeyRotatedError,
|
|
2149
|
-
FtTransferFilterSchema,
|
|
2150
|
-
FtMintFilterSchema,
|
|
2151
|
-
FtBurnFilterSchema,
|
|
2152
2030
|
ForbiddenError,
|
|
2153
|
-
EventFilterSchema,
|
|
2154
2031
|
ErrorCodes,
|
|
2155
2032
|
EMPTY_RANGE_EVENT_INDEX_SENTINEL,
|
|
2156
2033
|
DeploySubgraphRequestSchema,
|
|
2157
2034
|
DatabaseError,
|
|
2158
2035
|
DEFAULT_BTC_CONFIRMATIONS,
|
|
2159
|
-
DECODED_EVENT_TYPES,
|
|
2036
|
+
DECODED_EVENT_TYPES2 as DECODED_EVENT_TYPES,
|
|
2160
2037
|
DB_TO_STREAMS_EVENT_TYPE,
|
|
2161
2038
|
CreateSubscriptionRequestSchema,
|
|
2162
|
-
ContractDeployFilterSchema,
|
|
2163
|
-
ContractCallFilterSchema,
|
|
2164
2039
|
CODE_TO_STATUS,
|
|
2165
2040
|
CHAIN_TRIGGER_TYPES,
|
|
2166
2041
|
CHAIN_TRIGGER_FIELDS,
|
|
@@ -2168,5 +2043,5 @@ export {
|
|
|
2168
2043
|
AuthenticationError
|
|
2169
2044
|
};
|
|
2170
2045
|
|
|
2171
|
-
//# debugId=
|
|
2046
|
+
//# debugId=30519C35E76DA95E64756E2164756E21
|
|
2172
2047
|
//# sourceMappingURL=index.js.map
|