@secondlayer/cli 5.4.2 → 5.4.3
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 +16 -26
- package/dist/cli.js.map +10 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2518,8 +2518,8 @@ var init_session = __esm(() => {
|
|
|
2518
2518
|
SESSION_PATH = join(SESSION_DIR, "session.json");
|
|
2519
2519
|
});
|
|
2520
2520
|
|
|
2521
|
-
// src/lib/resolve-
|
|
2522
|
-
async function
|
|
2521
|
+
// src/lib/resolve-auth.ts
|
|
2522
|
+
async function resolveAuth() {
|
|
2523
2523
|
const envUrl = process.env.SL_API_URL;
|
|
2524
2524
|
const envKey = process.env.SL_SERVICE_KEY;
|
|
2525
2525
|
if (envUrl && envKey) {
|
|
@@ -2538,7 +2538,7 @@ async function resolveActiveTenant(_opts = {}) {
|
|
|
2538
2538
|
};
|
|
2539
2539
|
}
|
|
2540
2540
|
var PLATFORM_API_URL2;
|
|
2541
|
-
var
|
|
2541
|
+
var init_resolve_auth = __esm(() => {
|
|
2542
2542
|
init_session();
|
|
2543
2543
|
PLATFORM_API_URL2 = process.env.SL_PLATFORM_API_URL ?? "https://api.secondlayer.tools";
|
|
2544
2544
|
});
|
|
@@ -12888,7 +12888,7 @@ class StacksApiClient {
|
|
|
12888
12888
|
async ensureProxy() {
|
|
12889
12889
|
if (!this.useProxy || this.baseUrl)
|
|
12890
12890
|
return;
|
|
12891
|
-
const { apiUrl, ephemeralKey } = await
|
|
12891
|
+
const { apiUrl, ephemeralKey } = await resolveAuth();
|
|
12892
12892
|
this.baseUrl = apiUrl.replace(/\/$/, "");
|
|
12893
12893
|
this.headers = { authorization: `Bearer ${ephemeralKey}` };
|
|
12894
12894
|
}
|
|
@@ -12937,7 +12937,7 @@ class StacksApiClient {
|
|
|
12937
12937
|
var contractFetch;
|
|
12938
12938
|
var init_api = __esm(() => {
|
|
12939
12939
|
init_source3();
|
|
12940
|
-
|
|
12940
|
+
init_resolve_auth();
|
|
12941
12941
|
contractFetch = source_default2.extend({
|
|
12942
12942
|
timeout: { request: 15000 },
|
|
12943
12943
|
retry: {
|
|
@@ -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.3",
|
|
32325
32325
|
description: "CLI for subgraphs and blockchain indexing on Stacks",
|
|
32326
32326
|
type: "module",
|
|
32327
32327
|
bin: {
|
|
@@ -32451,7 +32451,7 @@ async function httpPlatformAnon(path2, opts = {}) {
|
|
|
32451
32451
|
}
|
|
32452
32452
|
|
|
32453
32453
|
// src/lib/api-client.ts
|
|
32454
|
-
|
|
32454
|
+
init_resolve_auth();
|
|
32455
32455
|
function handleApiError(err, action) {
|
|
32456
32456
|
if (err instanceof CliHttpError) {
|
|
32457
32457
|
if (err.code === "SESSION_EXPIRED") {
|
|
@@ -32480,7 +32480,7 @@ function withErrorHandling(fn, options) {
|
|
|
32480
32480
|
};
|
|
32481
32481
|
}
|
|
32482
32482
|
async function getPlatformClient() {
|
|
32483
|
-
const { apiUrl, ephemeralKey } = await
|
|
32483
|
+
const { apiUrl, ephemeralKey } = await resolveAuth();
|
|
32484
32484
|
return new SecondLayer({ baseUrl: apiUrl, apiKey: ephemeralKey });
|
|
32485
32485
|
}
|
|
32486
32486
|
async function listSubgraphsApi() {
|
|
@@ -33075,7 +33075,7 @@ function parseSubscriptionFilter(args) {
|
|
|
33075
33075
|
|
|
33076
33076
|
// src/commands/create.ts
|
|
33077
33077
|
init_output();
|
|
33078
|
-
|
|
33078
|
+
init_resolve_auth();
|
|
33079
33079
|
|
|
33080
33080
|
// src/lib/subscription-validation.ts
|
|
33081
33081
|
import {
|
|
@@ -33274,7 +33274,7 @@ SIGNING_SECRET=${signingSecret}
|
|
|
33274
33274
|
}
|
|
33275
33275
|
let dashboardLine = "";
|
|
33276
33276
|
try {
|
|
33277
|
-
const { apiUrl } = await
|
|
33277
|
+
const { apiUrl } = await resolveAuth();
|
|
33278
33278
|
const base = deriveBaseUrl(apiUrl);
|
|
33279
33279
|
dashboardLine = subscriptionId ? `Dashboard: ${base}/platform/subgraphs/${subgraph}/subscriptions/${subscriptionId}
|
|
33280
33280
|
` : `Dashboard: ${base}/platform/subgraphs/${subgraph}/subscriptions
|
|
@@ -33300,7 +33300,7 @@ function resolveSubscriptionClientConfig(opts, env = process.env, resolved) {
|
|
|
33300
33300
|
throw new Error("No service key available. Run `sl login` from an active project or pass --service-key.");
|
|
33301
33301
|
}
|
|
33302
33302
|
if (!baseUrl) {
|
|
33303
|
-
throw new Error("No
|
|
33303
|
+
throw new Error("No API URL available. Run `sl login` or pass --base-url.");
|
|
33304
33304
|
}
|
|
33305
33305
|
return { needsTenantResolution: false, baseUrl, apiKey };
|
|
33306
33306
|
}
|
|
@@ -33309,10 +33309,10 @@ async function getSubscriptionClient(opts) {
|
|
|
33309
33309
|
if (!config.needsTenantResolution) {
|
|
33310
33310
|
return new SecondLayer2({ baseUrl: config.baseUrl, apiKey: config.apiKey });
|
|
33311
33311
|
}
|
|
33312
|
-
const resolved = await
|
|
33312
|
+
const resolved = await resolveAuth();
|
|
33313
33313
|
const resolvedConfig = resolveSubscriptionClientConfig(opts, process.env, resolved);
|
|
33314
33314
|
if (resolvedConfig.needsTenantResolution) {
|
|
33315
|
-
throw new Error("Could not resolve
|
|
33315
|
+
throw new Error("Could not resolve credentials — run `sl login`.");
|
|
33316
33316
|
}
|
|
33317
33317
|
return new SecondLayer2({
|
|
33318
33318
|
baseUrl: resolvedConfig.baseUrl,
|
|
@@ -35031,7 +35031,7 @@ function decodeBuffUtf8(value: unknown): string | null {
|
|
|
35031
35031
|
|
|
35032
35032
|
// src/commands/subgraphs.ts
|
|
35033
35033
|
init_api();
|
|
35034
|
-
|
|
35034
|
+
init_resolve_auth();
|
|
35035
35035
|
async function loadSubgraphWithDepCheck(absPath) {
|
|
35036
35036
|
try {
|
|
35037
35037
|
return await import(absPath);
|
|
@@ -35443,7 +35443,7 @@ Stopped watching.`);
|
|
|
35443
35443
|
});
|
|
35444
35444
|
const printDeployFooter = async () => {
|
|
35445
35445
|
try {
|
|
35446
|
-
const { apiUrl } = await
|
|
35446
|
+
const { apiUrl } = await resolveAuth();
|
|
35447
35447
|
const baseUrl = deriveBaseUrl(apiUrl);
|
|
35448
35448
|
const firstTable = Object.keys(effectiveDef.schema ?? {})[0];
|
|
35449
35449
|
info(` Dashboard: ${baseUrl}/platform/subgraphs/${effectiveDef.name}`);
|
|
@@ -36927,16 +36927,6 @@ function registerWhoamiCommand(program2) {
|
|
|
36927
36927
|
} else {
|
|
36928
36928
|
rows.push(["Project", dim("(none — run `sl project create <name>`)")]);
|
|
36929
36929
|
}
|
|
36930
|
-
try {
|
|
36931
|
-
const tenant = await httpPlatform("/api/tenants/me");
|
|
36932
|
-
if (tenant.tenant) {
|
|
36933
|
-
rows.push(["Instance", tenant.tenant.apiUrl]);
|
|
36934
|
-
rows.push(["Plan", tenant.tenant.plan]);
|
|
36935
|
-
rows.push(["Status", tenant.tenant.status]);
|
|
36936
|
-
} else {
|
|
36937
|
-
rows.push(["Plan", dim("open beta (shared platform)")]);
|
|
36938
|
-
}
|
|
36939
|
-
} catch {}
|
|
36940
36930
|
console.log(formatKeyValue(rows));
|
|
36941
36931
|
});
|
|
36942
36932
|
}
|
|
@@ -37104,5 +37094,5 @@ registerAccountCommand(program);
|
|
|
37104
37094
|
registerBillingCommand(program);
|
|
37105
37095
|
program.parse();
|
|
37106
37096
|
|
|
37107
|
-
//# debugId=
|
|
37097
|
+
//# debugId=28D6666040039CE464756E2164756E21
|
|
37108
37098
|
//# sourceMappingURL=cli.js.map
|