@secondlayer/cli 8.2.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +28 -14
- package/dist/cli.js.map +3 -3
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -32354,7 +32354,7 @@ var {
|
|
|
32354
32354
|
// package.json
|
|
32355
32355
|
var package_default = {
|
|
32356
32356
|
name: "@secondlayer/cli",
|
|
32357
|
-
version: "8.
|
|
32357
|
+
version: "8.3.0",
|
|
32358
32358
|
repository: {
|
|
32359
32359
|
type: "git",
|
|
32360
32360
|
url: "git+https://github.com/ryanwaits/secondlayer.git",
|
|
@@ -32403,8 +32403,8 @@ var package_default = {
|
|
|
32403
32403
|
dependencies: {
|
|
32404
32404
|
"@inquirer/prompts": "^8.2.0",
|
|
32405
32405
|
"@secondlayer/bundler": "^0.3.7",
|
|
32406
|
-
"@secondlayer/sdk": "^
|
|
32407
|
-
"@secondlayer/shared": "^6.
|
|
32406
|
+
"@secondlayer/sdk": "^6.0.0",
|
|
32407
|
+
"@secondlayer/shared": "^6.12.0",
|
|
32408
32408
|
"@secondlayer/stacks": "^2.3.0",
|
|
32409
32409
|
"@secondlayer/subgraphs": "^3.5.0",
|
|
32410
32410
|
"@biomejs/js-api": "^0.7.0",
|
|
@@ -36379,17 +36379,25 @@ function dumpsClient(dumpsUrl) {
|
|
|
36379
36379
|
dumpsBaseUrl
|
|
36380
36380
|
});
|
|
36381
36381
|
}
|
|
36382
|
-
function parseTypes(value) {
|
|
36382
|
+
function parseTypes(value, flag = "--types") {
|
|
36383
36383
|
if (!value)
|
|
36384
36384
|
return;
|
|
36385
36385
|
const parts = value.split(",").map((s) => s.trim());
|
|
36386
36386
|
for (const p of parts) {
|
|
36387
36387
|
if (!VALID_TYPES.includes(p)) {
|
|
36388
|
-
throw new Error(`invalid
|
|
36388
|
+
throw new Error(`invalid ${flag} value "${p}"; expected one of: ${VALID_TYPES.join(", ")}`);
|
|
36389
36389
|
}
|
|
36390
36390
|
}
|
|
36391
36391
|
return parts;
|
|
36392
36392
|
}
|
|
36393
|
+
function parseList(value) {
|
|
36394
|
+
if (value === undefined)
|
|
36395
|
+
return;
|
|
36396
|
+
const parts = value.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
36397
|
+
if (parts.length === 0)
|
|
36398
|
+
return;
|
|
36399
|
+
return parts.length === 1 ? parts[0] : parts;
|
|
36400
|
+
}
|
|
36393
36401
|
function parseLimit(value) {
|
|
36394
36402
|
if (value === undefined)
|
|
36395
36403
|
return;
|
|
@@ -36419,15 +36427,19 @@ function registerStreamsCommand(program2) {
|
|
|
36419
36427
|
process.exit(1);
|
|
36420
36428
|
}
|
|
36421
36429
|
});
|
|
36422
|
-
streams.command("events").description("List events (cursor-paginated; one page per call)").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--
|
|
36430
|
+
streams.command("events").description("List events (cursor-paginated; one page per call)").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--not-types <types>", "comma-separated event types to exclude").option("--contract-id <ids>", "comma-separated contract identifier(s)").option("--sender <addrs>", "comma-separated sender principal(s)").option("--recipient <addrs>", "comma-separated recipient principal(s)").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--from-block <n>", "filter to blocks >= n").option("--to-block <n>", "filter to blocks <= n").option("--limit <n>", "page size (1-1000, default 100)", "100").addHelpText("after", `
|
|
36423
36431
|
Examples:
|
|
36424
36432
|
$ sl streams events --types stx_transfer,print --limit 50
|
|
36425
|
-
$ sl streams events --contract-id SP00....token
|
|
36433
|
+
$ sl streams events --not-types print --contract-id SP00....token,SP01....token
|
|
36434
|
+
$ sl streams events --sender SP1...,SP2... --from-block 150000 --to-block 160000
|
|
36426
36435
|
$ sl streams events --cursor 150000:3`).action(async (options2) => {
|
|
36427
36436
|
try {
|
|
36428
36437
|
const envelope = await client().events.list({
|
|
36429
36438
|
types: parseTypes(options2.types),
|
|
36430
|
-
|
|
36439
|
+
notTypes: parseTypes(options2.notTypes, "--not-types"),
|
|
36440
|
+
contractId: parseList(options2.contractId),
|
|
36441
|
+
sender: parseList(options2.sender),
|
|
36442
|
+
recipient: parseList(options2.recipient),
|
|
36431
36443
|
cursor: options2.cursor,
|
|
36432
36444
|
fromHeight: parseHeight(options2.fromBlock, "--from-block"),
|
|
36433
36445
|
toHeight: parseHeight(options2.toBlock, "--to-block"),
|
|
@@ -36439,19 +36451,21 @@ Examples:
|
|
|
36439
36451
|
process.exit(1);
|
|
36440
36452
|
}
|
|
36441
36453
|
});
|
|
36442
|
-
streams.command("consume").description("Long-running pull from a cursor; emits one event per line (jsonl) until SIGINT or --max-pages").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--
|
|
36454
|
+
streams.command("consume").description("Long-running pull from a cursor; emits one event per line (jsonl) until SIGINT or --max-pages").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--not-types <types>", "comma-separated event types to exclude").option("--contract-id <ids>", "comma-separated contract identifier(s)").option("--sender <addrs>", "comma-separated sender principal(s)").option("--recipient <addrs>", "comma-separated recipient principal(s)").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--batch-size <n>", "events per batch (1-1000, default 100)", "100").option("--max-pages <n>", "stop after N pages (default: run until SIGINT)").addHelpText("after", `
|
|
36443
36455
|
Examples:
|
|
36444
36456
|
$ sl streams consume --types print --cursor 150000:0
|
|
36445
|
-
$ sl streams consume --types
|
|
36457
|
+
$ sl streams consume --not-types print --sender SP1...,SP2... --batch-size 500 --max-pages 10`).action(async (options2) => {
|
|
36446
36458
|
try {
|
|
36447
|
-
const types6 = parseTypes(options2.types);
|
|
36448
36459
|
const batchSize = parseLimit(options2.batchSize) ?? 100;
|
|
36449
36460
|
const maxPages = options2.maxPages ? Number.parseInt(options2.maxPages, 10) : undefined;
|
|
36450
36461
|
note("# streaming events to stdout (jsonl); next_cursor printed to stderr");
|
|
36451
36462
|
await client().events.consume({
|
|
36452
36463
|
fromCursor: options2.cursor,
|
|
36453
|
-
types:
|
|
36454
|
-
|
|
36464
|
+
types: parseTypes(options2.types),
|
|
36465
|
+
notTypes: parseTypes(options2.notTypes, "--not-types"),
|
|
36466
|
+
contractId: parseList(options2.contractId),
|
|
36467
|
+
sender: parseList(options2.sender),
|
|
36468
|
+
recipient: parseList(options2.recipient),
|
|
36455
36469
|
batchSize,
|
|
36456
36470
|
mode: "tail",
|
|
36457
36471
|
maxPages,
|
|
@@ -38067,5 +38081,5 @@ program.commandsGroup("Account:");
|
|
|
38067
38081
|
registerAccountCommand(program);
|
|
38068
38082
|
program.parse();
|
|
38069
38083
|
|
|
38070
|
-
//# debugId=
|
|
38084
|
+
//# debugId=67F4C351C45DEDAA64756E2164756E21
|
|
38071
38085
|
//# sourceMappingURL=cli.js.map
|