@secondlayer/cli 5.4.6 → 5.4.8
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 +32 -18
- package/dist/cli.js.map +5 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -32321,7 +32321,7 @@ var {
|
|
|
32321
32321
|
// package.json
|
|
32322
32322
|
var package_default = {
|
|
32323
32323
|
name: "@secondlayer/cli",
|
|
32324
|
-
version: "5.4.
|
|
32324
|
+
version: "5.4.8",
|
|
32325
32325
|
description: "CLI for subgraphs and blockchain indexing on Stacks",
|
|
32326
32326
|
type: "module",
|
|
32327
32327
|
bin: {
|
|
@@ -33203,18 +33203,20 @@ async function createSubscription(name, opts) {
|
|
|
33203
33203
|
}
|
|
33204
33204
|
const eventName = `${subgraph}.${table}.created`;
|
|
33205
33205
|
const targetDir = resolve(process.cwd(), name);
|
|
33206
|
-
if (
|
|
33207
|
-
|
|
33208
|
-
|
|
33206
|
+
if (!opts.noScaffold) {
|
|
33207
|
+
if (existsSync(targetDir)) {
|
|
33208
|
+
error(`Directory already exists: ${relative(process.cwd(), targetDir)}`);
|
|
33209
|
+
process.exit(1);
|
|
33210
|
+
}
|
|
33211
|
+
const tplRoot = templatesRoot();
|
|
33212
|
+
const tplDir = join4(tplRoot, runtime);
|
|
33213
|
+
info(`Scaffolding ${blue(runtime)} template at ${blue(targetDir)}`);
|
|
33214
|
+
copyTemplate(tplDir, targetDir, {
|
|
33215
|
+
NAME: name,
|
|
33216
|
+
EVENT_NAME: eventName,
|
|
33217
|
+
TASK_ID: `${subgraph}-${table}`
|
|
33218
|
+
});
|
|
33209
33219
|
}
|
|
33210
|
-
const tplRoot = templatesRoot();
|
|
33211
|
-
const tplDir = join4(tplRoot, runtime);
|
|
33212
|
-
info(`Scaffolding ${blue(runtime)} template at ${blue(targetDir)}`);
|
|
33213
|
-
copyTemplate(tplDir, targetDir, {
|
|
33214
|
-
NAME: name,
|
|
33215
|
-
EVENT_NAME: eventName,
|
|
33216
|
-
TASK_ID: `${subgraph}-${table}`
|
|
33217
|
-
});
|
|
33218
33220
|
let signingSecret = null;
|
|
33219
33221
|
let provisioningFailed = false;
|
|
33220
33222
|
if (!opts.skipApi) {
|
|
@@ -33250,7 +33252,7 @@ async function createSubscription(name, opts) {
|
|
|
33250
33252
|
subscriptionStatus = created?.status;
|
|
33251
33253
|
} catch {}
|
|
33252
33254
|
}
|
|
33253
|
-
if (signingSecret) {
|
|
33255
|
+
if (signingSecret && !opts.noScaffold) {
|
|
33254
33256
|
const envTarget = join4(targetDir, ".env");
|
|
33255
33257
|
const envExample = join4(targetDir, ".env.example");
|
|
33256
33258
|
if (existsSync(envExample) && !existsSync(envTarget)) {
|
|
@@ -33266,6 +33268,8 @@ SIGNING_SECRET=${signingSecret}
|
|
|
33266
33268
|
`);
|
|
33267
33269
|
}
|
|
33268
33270
|
success(`Signing secret written to ${relative(process.cwd(), envTarget)}`);
|
|
33271
|
+
} else if (signingSecret && opts.noScaffold) {
|
|
33272
|
+
info(`Signing secret (store securely): ${signingSecret}`);
|
|
33269
33273
|
}
|
|
33270
33274
|
console.log();
|
|
33271
33275
|
if (provisioningFailed) {
|
|
@@ -33283,10 +33287,12 @@ SIGNING_SECRET=${signingSecret}
|
|
|
33283
33287
|
const pausedLine = subscriptionStatus === "paused" ? `Subscription is paused. Resume:
|
|
33284
33288
|
sl subscriptions resume ${name}
|
|
33285
33289
|
` : "";
|
|
33286
|
-
|
|
33287
|
-
${
|
|
33290
|
+
const runHint = opts.noScaffold ? `View deliveries:
|
|
33291
|
+
sl subscriptions get ${name}` : `cd ${name}
|
|
33288
33292
|
bun install
|
|
33289
|
-
bun run dev
|
|
33293
|
+
bun run dev`;
|
|
33294
|
+
success(`Done. Next:
|
|
33295
|
+
${dashboardLine}${pausedLine}${runHint}`);
|
|
33290
33296
|
}
|
|
33291
33297
|
function resolveSubscriptionClientConfig(opts, env = process.env, resolved) {
|
|
33292
33298
|
const needsResolvedKey = !opts.serviceKey && !env.SL_SERVICE_KEY;
|
|
@@ -33321,7 +33327,7 @@ async function getSubscriptionClient(opts) {
|
|
|
33321
33327
|
}
|
|
33322
33328
|
function registerCreateCommand(program2) {
|
|
33323
33329
|
const create = program2.command("create").description("Scaffold new resources (subscription receivers, etc.)");
|
|
33324
|
-
create.command("subscription <name>").description("Scaffold a subscription receiver for a runtime").option("-r, --runtime <runtime>", "inngest | trigger | cloudflare | node").option("-s, --subgraph <name>", "Subgraph to subscribe to").option("-t, --table <name>", "Table to subscribe to").option("-u, --url <url>", "Webhook URL").option("--auth-token <token>", "Bearer token for receiver API auth").option("--filter <kv...>", "Filter as key=value (supports .eq/.neq/.gt/.gte/.lt/.lte suffixes)").option("--service-key <key>", "SL_SERVICE_KEY override").option("--base-url <url>", "SL_API_URL override").option("--skip-api", "Copy template only, don't call the API").action(async (name, options) => {
|
|
33330
|
+
create.command("subscription <name>").description("Scaffold a subscription receiver for a runtime").option("-r, --runtime <runtime>", "inngest | trigger | cloudflare | node").option("-s, --subgraph <name>", "Subgraph to subscribe to").option("-t, --table <name>", "Table to subscribe to").option("-u, --url <url>", "Webhook URL").option("--auth-token <token>", "Bearer token for receiver API auth").option("--filter <kv...>", "Filter as key=value (supports .eq/.neq/.gt/.gte/.lt/.lte suffixes)").option("--service-key <key>", "SL_SERVICE_KEY override").option("--base-url <url>", "SL_API_URL override").option("--skip-api", "Copy template only, don't call the API").option("--no-scaffold", "Skip the local runtime template directory (webhook-only setups)").action(async (name, options) => {
|
|
33325
33331
|
await createSubscription(name, options);
|
|
33326
33332
|
});
|
|
33327
33333
|
}
|
|
@@ -33750,6 +33756,10 @@ function printDead(rows) {
|
|
|
33750
33756
|
async function confirmOrExit(message, yes) {
|
|
33751
33757
|
if (yes)
|
|
33752
33758
|
return true;
|
|
33759
|
+
if (!process.stdin.isTTY) {
|
|
33760
|
+
error("Interactive prompt unavailable (stdin is not a TTY). Re-run with -y to skip confirmation.");
|
|
33761
|
+
process.exit(1);
|
|
33762
|
+
}
|
|
33753
33763
|
let ok = false;
|
|
33754
33764
|
try {
|
|
33755
33765
|
ok = await confirm({ message });
|
|
@@ -35826,6 +35836,10 @@ ${rows.length} row(s)`));
|
|
|
35826
35836
|
subgraphs.command("delete <name>").description("Delete a subgraph and its data").option("-y, --yes", "Skip confirmation").option("--force", "Cancel active operations and force delete").action(async (name, options2) => {
|
|
35827
35837
|
try {
|
|
35828
35838
|
if (!options2.yes && !options2.force) {
|
|
35839
|
+
if (!process.stdin.isTTY) {
|
|
35840
|
+
error("Interactive prompt unavailable (stdin is not a TTY). Re-run with -y to skip confirmation.");
|
|
35841
|
+
process.exit(1);
|
|
35842
|
+
}
|
|
35829
35843
|
const { confirm: confirm4 } = await import("@inquirer/prompts");
|
|
35830
35844
|
let ok = false;
|
|
35831
35845
|
try {
|
|
@@ -37127,5 +37141,5 @@ registerAccountCommand(program);
|
|
|
37127
37141
|
registerBillingCommand(program);
|
|
37128
37142
|
program.parse();
|
|
37129
37143
|
|
|
37130
|
-
//# debugId=
|
|
37144
|
+
//# debugId=3BA90AE1697DB54C64756E2164756E21
|
|
37131
37145
|
//# sourceMappingURL=cli.js.map
|