@secondlayer/cli 8.4.0 → 8.4.2
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/README.md +11 -0
- package/dist/cli.js +27 -8
- package/dist/cli.js.map +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -69,6 +69,7 @@ sl subscriptions create my-hook \
|
|
|
69
69
|
| `sl projects list` | List projects |
|
|
70
70
|
| `sl projects use <slug>` | Bind cwd to a project (writes `./.secondlayer/project`) |
|
|
71
71
|
| `sl projects get` | Show resolved project + source file |
|
|
72
|
+
| `sl projects delete <slug>` (alias `rm`) | Delete a project (`-y` to skip confirm) |
|
|
72
73
|
|
|
73
74
|
Project binding is per-directory: `.secondlayer/project` in cwd takes
|
|
74
75
|
precedence over `~/.secondlayer/config.json:defaultProject`. The walk-up stops
|
|
@@ -90,6 +91,16 @@ at `.git`.
|
|
|
90
91
|
| `sl subgraphs client <name> -o <path>` | Generate a typed query client for a deployed subgraph |
|
|
91
92
|
| `sl subgraphs reindex/backfill/cancel/delete <name>` | Manage processing |
|
|
92
93
|
|
|
94
|
+
### Data products (reads)
|
|
95
|
+
|
|
96
|
+
| Command | What it does |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `sl datasets list` / `query <dataset> [--filter k=v] [--cursor] [--limit] [--json]` | Foundation Datasets (sBTC, BNS, PoX-4, STX transfers). Public — no key |
|
|
99
|
+
| `sl index ft-transfers` / `nft-transfers` / `events --event-type <t>` / `contract-calls` | Decoded L2 layer. Anonymous reads OK; free-tier keys rejected (Build+ for keyed) |
|
|
100
|
+
| `sl streams tip` / `events` / `consume` / `reorgs` / `canonical <h>` / `pull` | Raw L1 event firehose. **Requires `SL_API_KEY`** |
|
|
101
|
+
|
|
102
|
+
Reads emit JSON to stdout (`--json` accepted across all read commands); `-o/--output` is a file path, not a format.
|
|
103
|
+
|
|
93
104
|
### Subscriptions
|
|
94
105
|
|
|
95
106
|
| Command | What it does |
|
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.4.
|
|
32357
|
+
version: "8.4.2",
|
|
32358
32358
|
repository: {
|
|
32359
32359
|
type: "git",
|
|
32360
32360
|
url: "git+https://github.com/ryanwaits/secondlayer.git",
|
|
@@ -32403,7 +32403,7 @@ var package_default = {
|
|
|
32403
32403
|
dependencies: {
|
|
32404
32404
|
"@inquirer/prompts": "^8.2.0",
|
|
32405
32405
|
"@secondlayer/bundler": "^0.3.7",
|
|
32406
|
-
"@secondlayer/sdk": "^6.2.
|
|
32406
|
+
"@secondlayer/sdk": "^6.2.1",
|
|
32407
32407
|
"@secondlayer/shared": "^6.12.0",
|
|
32408
32408
|
"@secondlayer/stacks": "^2.3.0",
|
|
32409
32409
|
"@secondlayer/subgraphs": "^3.5.0",
|
|
@@ -33774,10 +33774,22 @@ function shellQuote(value) {
|
|
|
33774
33774
|
}
|
|
33775
33775
|
function buildSubscriptionTestFixture(input2) {
|
|
33776
33776
|
const nowSeconds = input2.nowSeconds ?? Math.floor(Date.now() / 1000);
|
|
33777
|
+
const sub = input2.subscription;
|
|
33778
|
+
const isChain = sub.kind === "chain";
|
|
33779
|
+
const type = isChain ? `chain.${sub.triggers?.[0]?.type ?? "event"}.apply` : `${sub.subgraphName}.${sub.tableName}.created`;
|
|
33780
|
+
const data = isChain ? {
|
|
33781
|
+
action: "apply",
|
|
33782
|
+
canonical: true,
|
|
33783
|
+
block_hash: "0xexampleblock",
|
|
33784
|
+
block_height: 0,
|
|
33785
|
+
tx_id: input2.row.tx_id ?? "0xexampletransaction",
|
|
33786
|
+
trigger: sub.triggers?.[0]?.type ?? "event",
|
|
33787
|
+
event: input2.row
|
|
33788
|
+
} : input2.row;
|
|
33777
33789
|
const body = JSON.stringify({
|
|
33778
|
-
type
|
|
33790
|
+
type,
|
|
33779
33791
|
timestamp: new Date(nowSeconds * 1000).toISOString(),
|
|
33780
|
-
data
|
|
33792
|
+
data
|
|
33781
33793
|
});
|
|
33782
33794
|
const headers = {
|
|
33783
33795
|
"content-type": "application/json",
|
|
@@ -33797,6 +33809,13 @@ function buildSubscriptionTestFixture(input2) {
|
|
|
33797
33809
|
return { body, headers, curl };
|
|
33798
33810
|
}
|
|
33799
33811
|
async function representativeRow(client, sub, subgraph) {
|
|
33812
|
+
if (sub.kind === "chain" || !sub.subgraphName || !sub.tableName) {
|
|
33813
|
+
return {
|
|
33814
|
+
tx_id: "0xexampletransaction",
|
|
33815
|
+
contract_id: "SP000000000000000000002Q6VF78.example",
|
|
33816
|
+
...sub.triggers?.[0]?.type === "contract_call" ? { function_name: "example-fn" } : {}
|
|
33817
|
+
};
|
|
33818
|
+
}
|
|
33800
33819
|
try {
|
|
33801
33820
|
const rows = await client.subgraphs.queryTable(sub.subgraphName, sub.tableName, {
|
|
33802
33821
|
sort: "_block_height",
|
|
@@ -33911,7 +33930,7 @@ Examples:
|
|
|
33911
33930
|
const client = await getSubscriptionClient();
|
|
33912
33931
|
const patch = buildUpdatePatch(options);
|
|
33913
33932
|
const { id, detail } = await resolveSubscriptionRef(client, idOrName);
|
|
33914
|
-
if (patch.filter !== undefined) {
|
|
33933
|
+
if (patch.filter !== undefined && detail.subgraphName && detail.tableName) {
|
|
33915
33934
|
await validateSubscriptionTargetFromApi(client, {
|
|
33916
33935
|
subgraphName: detail.subgraphName,
|
|
33917
33936
|
tableName: detail.tableName,
|
|
@@ -34068,7 +34087,7 @@ Examples:
|
|
|
34068
34087
|
const [deliveries, dead, subgraph] = await Promise.allSettled([
|
|
34069
34088
|
client.subscriptions.recentDeliveries(id),
|
|
34070
34089
|
client.subscriptions.dead(id),
|
|
34071
|
-
client.subgraphs.get(detail.subgraphName)
|
|
34090
|
+
detail.subgraphName ? client.subgraphs.get(detail.subgraphName) : Promise.resolve(null)
|
|
34072
34091
|
]);
|
|
34073
34092
|
const report = buildDoctorReport({
|
|
34074
34093
|
subscription: detail,
|
|
@@ -34089,7 +34108,7 @@ Examples:
|
|
|
34089
34108
|
const signingSecret = resolveSigningSecret(options);
|
|
34090
34109
|
const client = await getSubscriptionClient();
|
|
34091
34110
|
const { detail } = await resolveSubscriptionRef(client, idOrName);
|
|
34092
|
-
const subgraph = await client.subgraphs.get(detail.subgraphName).catch(() => null);
|
|
34111
|
+
const subgraph = detail.subgraphName ? await client.subgraphs.get(detail.subgraphName).catch(() => null) : null;
|
|
34093
34112
|
const row = await representativeRow(client, detail, subgraph);
|
|
34094
34113
|
const fixture = buildSubscriptionTestFixture({
|
|
34095
34114
|
subscription: detail,
|
|
@@ -38206,5 +38225,5 @@ program.commandsGroup("Account:");
|
|
|
38206
38225
|
registerAccountCommand(program);
|
|
38207
38226
|
program.parse();
|
|
38208
38227
|
|
|
38209
|
-
//# debugId=
|
|
38228
|
+
//# debugId=1CE2C8D6E9B70EC764756E2164756E21
|
|
38210
38229
|
//# sourceMappingURL=cli.js.map
|