neon 8.23.4 → 9.1.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/README.md +67 -8
- package/dist/_chunks/{checkout-OEE3GTc_.js → checkout-B_gbS0nD.js} +3 -3
- package/dist/_chunks/{claim-C-9or54_.js → claim-BVEwQ65H.js} +1 -1
- package/dist/_chunks/{config-DPuP7ywm.js → config-BClSMzco.js} +1 -1
- package/dist/_chunks/{deploy-CpF33Ij-.js → deploy-CJ22hy3i.js} +1 -1
- package/dist/_chunks/{dev-BE5TL7ZH.js → dev-CSoQfCuS.js} +19 -20
- package/dist/_chunks/{env-CIFMBEon.js → env-CFBmcKyo.js} +18 -45
- package/dist/_chunks/{env-C4-EYFmE.js → env-DxcO3oJk.js} +21 -23
- package/dist/_chunks/{env-JgoSsmyt.js → env-EJU-0InB.js} +49 -110
- package/dist/_chunks/{git-R8RebFpF.js → git-C6XPViK5.js} +2 -2
- package/dist/_chunks/{link-PLk7-vwB.js → link-n40BxbmK.js} +2 -2
- package/dist/_chunks/{logs-BB4uvblR.js → logs-Zf8mcRVE.js} +7 -4
- package/dist/_chunks/{status-BjaHpnTV.js → status-TDYLPWRO.js} +1 -1
- package/dist/api.js +1 -0
- package/dist/commands/checkout.js +1 -1
- package/dist/commands/claim.js +1 -1
- package/dist/commands/config.js +1 -1
- package/dist/commands/deploy.js +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/env.js +1 -1
- package/dist/commands/env_output.js +4 -4
- package/dist/commands/functions_new.js +1 -1
- package/dist/commands/git.js +1 -1
- package/dist/commands/index.js +10 -10
- package/dist/commands/link.js +1 -1
- package/dist/commands/logs.js +1 -1
- package/dist/commands/loki.js +125 -0
- package/dist/commands/manifest.js +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/subscribe.js +1 -1
- package/dist/dev/env.js +1 -1
- package/dist/env_services.js +30 -23
- package/dist/errors.js +2 -1
- package/dist/init/auth.js +1 -1
- package/dist/init/choices.js +8 -6
- package/dist/init/deploy.js +1 -1
- package/dist/init/link.js +1 -1
- package/dist/init/run.js +3 -3
- package/dist/utils/hooks.js +9 -4
- package/package.json +8 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as defaultConnectionRole, t as NEON_DEFAULT_OWNER_ROLE } from "./roles-Bd9r8_pX.js";
|
|
2
|
-
import { ErrorCode, PlatformError, createNeonApiFromOptions, deriveCredentialScopes,
|
|
2
|
+
import { ErrorCode, PlatformError, createNeonApiFromOptions, deriveCredentialScopes, resolveConfig } from "@neon/config/v1";
|
|
3
3
|
// ../../internals/env-core/dist/env.js
|
|
4
4
|
/**
|
|
5
5
|
* The Neon env core — resolving a branch's env from the Neon API, and projecting it into
|
|
@@ -28,13 +28,27 @@ import { ErrorCode, PlatformError, createNeonApiFromOptions, deriveCredentialSco
|
|
|
28
28
|
* user added a second database next to `neondb`) auto-picks without asking.
|
|
29
29
|
*/
|
|
30
30
|
const NEON_DEFAULT_DATABASE = "neondb";
|
|
31
|
+
/**
|
|
32
|
+
* Set only by `neon dev`: a JSON object mapping each function it serves to its localhost port,
|
|
33
|
+
* which `functionBaseUrl` prefers over the deployed hostname.
|
|
34
|
+
*/
|
|
35
|
+
const NEON_DEV_FUNCTION_PORTS = "NEON_DEV_FUNCTION_PORTS";
|
|
31
36
|
const NEON_ENV_VAR_KEYS = {
|
|
32
37
|
/**
|
|
33
38
|
* Branch identity. `NEON_BRANCH` carries the branch **name** and is injected into the
|
|
34
39
|
* Neon Functions runtime on every branch (including the default) by default. `env pull` /
|
|
35
40
|
* `neon dev` / `neon-env run` emit it too so local dev mirrors the deployed runtime.
|
|
36
41
|
*/
|
|
37
|
-
branch: {
|
|
42
|
+
branch: {
|
|
43
|
+
name: "NEON_BRANCH",
|
|
44
|
+
id: "NEON_BRANCH_ID",
|
|
45
|
+
/**
|
|
46
|
+
* Shared by every function on the branch, with a leading dot
|
|
47
|
+
* (`.compute.c-2.us-east-2.aws.neon.tech`). A function's host is
|
|
48
|
+
* `<NEON_BRANCH_ID>-<slug><NEON_FUNCTION_HOST_SUFFIX>`.
|
|
49
|
+
*/
|
|
50
|
+
functionHostSuffix: "NEON_FUNCTION_HOST_SUFFIX"
|
|
51
|
+
},
|
|
38
52
|
postgres: {
|
|
39
53
|
databaseUrl: "DATABASE_URL",
|
|
40
54
|
databaseUrlUnpooled: "DATABASE_URL_UNPOOLED"
|
|
@@ -71,19 +85,6 @@ const NEON_ENV_VAR_KEYS = {
|
|
|
71
85
|
baseUrl: "NEON_AI_GATEWAY_BASE_URL"
|
|
72
86
|
}
|
|
73
87
|
};
|
|
74
|
-
const FUNCTION_SLUG = /^[a-z0-9]{1,20}$/;
|
|
75
|
-
const FUNCTION_BASE_URL_KEY = /^NEON_FUNCTION_([A-Z0-9]{1,20})_BASE_URL$/;
|
|
76
|
-
function functionBaseUrlKey(slug) {
|
|
77
|
-
if (!FUNCTION_SLUG.test(slug)) throw new Error(`functionBaseUrlKey: ${JSON.stringify(slug)} is not a function slug ([a-z0-9]{1,20}).`);
|
|
78
|
-
return `NEON_FUNCTION_${slug.toUpperCase()}_BASE_URL`;
|
|
79
|
-
}
|
|
80
|
-
function parseFunctionBaseUrlKey(key) {
|
|
81
|
-
const match = FUNCTION_BASE_URL_KEY.exec(key);
|
|
82
|
-
return match ? match[1].toLowerCase() : null;
|
|
83
|
-
}
|
|
84
|
-
function isFunctionBaseUrlKey(key) {
|
|
85
|
-
return parseFunctionBaseUrlKey(key) !== null;
|
|
86
|
-
}
|
|
87
88
|
/**
|
|
88
89
|
* Starts a read now and keeps an unread rejection from crashing the process; the caller
|
|
89
90
|
* awaits it (and sees the error) when its turn comes. The read is called synchronously and
|
|
@@ -185,24 +186,13 @@ async function fetchEnvKeysState(config, options, keys, policy) {
|
|
|
185
186
|
const wantsDataApi = desired.dataApiEnabled && wants(K.dataApi.url);
|
|
186
187
|
const wantsRealtime = desired.realtimePolicy === "enabled" && (wants(K.realtime.url) || wants(K.realtime.secret));
|
|
187
188
|
const gatewayEnabled = desired.preview?.aiGatewayEnabled ?? false;
|
|
188
|
-
const
|
|
189
|
-
const declaredSlugs = (desired.preview?.functions ?? []).map((fn) => fn.slug);
|
|
190
|
-
const selectedFunctionKeys = selection === null ? [] : [...selection].filter(isFunctionBaseUrlKey);
|
|
191
|
-
const constructSlugs = functionUrlSlugsToConstruct({
|
|
192
|
-
functionUrlMode,
|
|
193
|
-
selection,
|
|
194
|
-
declaredSlugs,
|
|
195
|
-
selectedFunctionKeys,
|
|
196
|
-
wants
|
|
197
|
-
});
|
|
198
|
-
const wantsAnyFunctionUrl = selection === null || selectedFunctionKeys.length > 0;
|
|
189
|
+
const wantsFunctionHostSuffix = wants(K.branch.functionHostSuffix) && (selection !== null || options.functionHostSuffix === "always" || (desired.preview?.functions.length ?? 0) > 0);
|
|
199
190
|
const storageEnabled = (desired.preview?.buckets.length ?? 0) > 0;
|
|
200
191
|
const wantsStorage = storageEnabled && (wants(K.storage.accessKeyId) || wants(K.storage.secretAccessKey) || wants(K.storage.endpoint) || wants(K.storage.region));
|
|
201
|
-
const
|
|
202
|
-
functionsRead?.catch(() => void 0);
|
|
203
|
-
const storageRead = wantsStorage ? started(() => api.getProjectBranchStorage(projectId, branch.id)) : null;
|
|
204
|
-
const needsUnpooled = wantsUnpooled || gatewayEnabled && wants(K.aiGateway.baseUrl) || constructSlugs.length > 0;
|
|
192
|
+
const needsUnpooled = wantsUnpooled || gatewayEnabled && wants(K.aiGateway.baseUrl);
|
|
205
193
|
const needsConnectionTarget = wantsPooled || needsUnpooled;
|
|
194
|
+
const storageRead = wantsStorage ? started(() => api.getProjectBranchStorage(projectId, branch.id)) : null;
|
|
195
|
+
const endpointsRead = wantsFunctionHostSuffix && !needsConnectionTarget ? started(() => api.listEndpoints(projectId)) : null;
|
|
206
196
|
const needsDatabase = needsConnectionTarget || wantsDataApi;
|
|
207
197
|
const [roles, databases] = await Promise.all([needsConnectionTarget ? api.listBranchRoles(projectId, branch.id) : Promise.resolve([]), needsDatabase ? api.listBranchDatabases(projectId, branch.id) : Promise.resolve([])]);
|
|
208
198
|
const databaseName = needsDatabase ? pickDatabaseName(databases, branch, options.databaseName) : null;
|
|
@@ -228,7 +218,16 @@ async function fetchEnvKeysState(config, options, keys, policy) {
|
|
|
228
218
|
if (wantsPooled) postgres.databaseUrl = requiredValue(pooled, "pooled connection URI response").uri;
|
|
229
219
|
if (wantsUnpooled) postgres.databaseUrlUnpooled = requiredValue(unpooled, "direct connection URI response").uri;
|
|
230
220
|
if (Object.keys(postgres).length > 0) result.postgres = postgres;
|
|
231
|
-
if (wants(K.branch.name)
|
|
221
|
+
if (wants(K.branch.name) || wants(K.branch.id) || wantsFunctionHostSuffix) {
|
|
222
|
+
const branchEnv = {};
|
|
223
|
+
if (wants(K.branch.name)) branchEnv.name = branch.name;
|
|
224
|
+
if (wants(K.branch.id)) branchEnv.id = branch.id;
|
|
225
|
+
if (wantsFunctionHostSuffix) {
|
|
226
|
+
const connectionUri = unpooled?.uri ?? pooled?.uri;
|
|
227
|
+
branchEnv.functionHostSuffix = functionHostSuffix(connectionUri !== void 0 ? new URL(connectionUri).hostname : branchComputeHost(await requiredValue(endpointsRead, "branch endpoint list"), branch));
|
|
228
|
+
}
|
|
229
|
+
result.branch = branchEnv;
|
|
230
|
+
}
|
|
232
231
|
if (wantsAuth) {
|
|
233
232
|
if (!authSnapshot) throw new PlatformError(ErrorCode.NotFound, [`fetchEnv: branch policy enables auth but no Neon Auth integration is enabled on branch ${branch.name} (${branch.id}).`, "Enable it via `apply(config, { projectId, branchId })` (or `npx neon …`), in the Neon Console — then re-run fetchEnv. Or return auth.enabled=false."].join(" "), { details: {
|
|
234
233
|
projectId,
|
|
@@ -301,66 +300,7 @@ async function fetchEnvKeysState(config, options, keys, policy) {
|
|
|
301
300
|
result.aiGateway = gateway;
|
|
302
301
|
}
|
|
303
302
|
}
|
|
304
|
-
|
|
305
|
-
let functionUrlsUnavailable = false;
|
|
306
|
-
if (functionUrlMode === "all-live" && wantsAnyFunctionUrl) {
|
|
307
|
-
const listed = options.listedFunctions === void 0 ? await requiredValue(functionsRead, "function listing") : listedFromSnapshots(options.listedFunctions);
|
|
308
|
-
if (listed.status === "unavailable") {
|
|
309
|
-
if (selection === null) functionUrlsUnavailable = true;
|
|
310
|
-
} else for (const fn of listed.functions) {
|
|
311
|
-
if (!wants(functionBaseUrlKey(fn.slug))) continue;
|
|
312
|
-
functions[fn.slug] = { baseUrl: asEnvBaseUrl(fn.invocationUrl) };
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
const missingConstructSlugs = constructSlugs.filter((slug) => functions[slug] === void 0);
|
|
316
|
-
if (missingConstructSlugs.length > 0) {
|
|
317
|
-
const uri = requiredValue(unpooled, "direct connection URI for function invocation URLs").uri;
|
|
318
|
-
for (const slug of missingConstructSlugs) functions[slug] = { baseUrl: functionInvocationUrl(branch.id, slug, uri) };
|
|
319
|
-
}
|
|
320
|
-
assertSelectedFunctionUrls(selectedFunctionKeys, functions);
|
|
321
|
-
if (Object.keys(functions).length > 0) result.functions = functions;
|
|
322
|
-
return {
|
|
323
|
-
env: result,
|
|
324
|
-
functionUrlsUnavailable
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
function functionUrlSlugsToConstruct(args) {
|
|
328
|
-
const slugs = [];
|
|
329
|
-
if (args.functionUrlMode === "policy" && args.selection === null) {
|
|
330
|
-
for (const slug of args.declaredSlugs) if (args.wants(functionBaseUrlKey(slug))) slugs.push(slug);
|
|
331
|
-
return slugs;
|
|
332
|
-
}
|
|
333
|
-
for (const key of args.selectedFunctionKeys) {
|
|
334
|
-
const slug = parseFunctionBaseUrlKey(key);
|
|
335
|
-
if (slug !== null) slugs.push(slug);
|
|
336
|
-
}
|
|
337
|
-
return slugs;
|
|
338
|
-
}
|
|
339
|
-
function listedFromSnapshots(snapshots) {
|
|
340
|
-
return {
|
|
341
|
-
status: "ok",
|
|
342
|
-
functions: snapshots.filter((fn) => fn.invocationUrl !== "").map((fn) => ({
|
|
343
|
-
slug: fn.slug,
|
|
344
|
-
invocationUrl: fn.invocationUrl
|
|
345
|
-
})).sort((left, right) => left.slug.localeCompare(right.slug))
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
function assertSelectedFunctionUrls(keys, functions) {
|
|
349
|
-
for (const key of keys) {
|
|
350
|
-
const slug = parseFunctionBaseUrlKey(key);
|
|
351
|
-
if (slug === null || functions[slug] === void 0) throw new Error(`fetchEnv: missing ${key}.`);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
async function listFunctionInvocationUrls(api, projectId, branchId) {
|
|
355
|
-
try {
|
|
356
|
-
return listedFromSnapshots(await api.listBranchFunctions(projectId, branchId));
|
|
357
|
-
} catch (error) {
|
|
358
|
-
if (isPlatformError(error) && error.code === ErrorCode.FeatureUnavailable) return {
|
|
359
|
-
status: "unavailable",
|
|
360
|
-
error
|
|
361
|
-
};
|
|
362
|
-
throw error;
|
|
363
|
-
}
|
|
303
|
+
return { env: result };
|
|
364
304
|
}
|
|
365
305
|
/**
|
|
366
306
|
* Resolve the target branch and evaluate the policy against it — the first thing any
|
|
@@ -425,6 +365,8 @@ function policyEnvKeys(desired) {
|
|
|
425
365
|
K.postgres.databaseUrl,
|
|
426
366
|
K.postgres.databaseUrlUnpooled,
|
|
427
367
|
K.branch.name,
|
|
368
|
+
K.branch.id,
|
|
369
|
+
...(desired.preview?.functions.length ?? 0) > 0 ? [K.branch.functionHostSuffix] : [],
|
|
428
370
|
...desired.authEnabled ? [K.auth.baseUrl, K.auth.jwksUrl] : [],
|
|
429
371
|
...desired.dataApiEnabled ? [K.dataApi.url] : [],
|
|
430
372
|
...desired.realtimePolicy === "enabled" ? [K.realtime.url, K.realtime.secret] : [],
|
|
@@ -539,24 +481,20 @@ function aiGatewayHost(branchId, connectionUri) {
|
|
|
539
481
|
return `${branchId}-api.ai.${connectionHostSuffix(connectionUri)}`;
|
|
540
482
|
}
|
|
541
483
|
/**
|
|
542
|
-
*
|
|
543
|
-
*
|
|
484
|
+
* `NEON_FUNCTION_HOST_SUFFIX` from a compute host: the endpoint label is replaced by
|
|
485
|
+
* `compute`, as the Functions runtime does (`.compute.c-2.us-east-2.aws.neon.tech`).
|
|
544
486
|
*/
|
|
545
|
-
function
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
function functionInvocationUrl(branchId, slug, connectionUri) {
|
|
557
|
-
const suffix = connectionHostSuffix(connectionUri);
|
|
558
|
-
if (suffix === "") throw new Error(`fetchEnv: cannot derive the invocation URL for function "${slug}": the direct connection URI has no host suffix.`);
|
|
559
|
-
return `https://${branchId}-${slug}.compute.${suffix}`;
|
|
487
|
+
function functionHostSuffix(computeHost) {
|
|
488
|
+
const suffix = computeHost.split(".").slice(1).join(".");
|
|
489
|
+
if (suffix === "") throw new Error(`fetchEnv: cannot derive NEON_FUNCTION_HOST_SUFFIX from compute host ${JSON.stringify(computeHost)}.`);
|
|
490
|
+
return `.compute.${suffix}`;
|
|
491
|
+
}
|
|
492
|
+
/** The branch's read-write compute host, else its first compute host. */
|
|
493
|
+
function branchComputeHost(endpoints, branch) {
|
|
494
|
+
const own = endpoints.filter((endpoint) => endpoint.branchId === branch.id);
|
|
495
|
+
const endpoint = own.find((candidate) => candidate.type === "read_write") ?? own[0];
|
|
496
|
+
if (!endpoint?.host) throw new PlatformError(ErrorCode.NotFound, `fetchEnv: branch ${branch.name} (${branch.id}) has no compute endpoint, so NEON_FUNCTION_HOST_SUFFIX cannot be derived. Add a compute to the branch, then re-run.`, { details: { branchId: branch.id } });
|
|
497
|
+
return endpoint.host;
|
|
560
498
|
}
|
|
561
499
|
/** The AI Gateway's bare base URL (`NEON_AI_GATEWAY_BASE_URL`) on the branch gateway host. */
|
|
562
500
|
function aiGatewayBaseUrl(branchId, connectionUri) {
|
|
@@ -637,6 +575,8 @@ function toEntries(env) {
|
|
|
637
575
|
put(K.postgres.databaseUrl, env.postgres?.databaseUrl);
|
|
638
576
|
put(K.postgres.databaseUrlUnpooled, env.postgres?.databaseUrlUnpooled);
|
|
639
577
|
put(K.branch.name, env.branch?.name);
|
|
578
|
+
put(K.branch.id, env.branch?.id);
|
|
579
|
+
put(K.branch.functionHostSuffix, env.branch?.functionHostSuffix);
|
|
640
580
|
put(K.auth.baseUrl, env.auth?.baseUrl);
|
|
641
581
|
put(K.auth.jwksUrl, env.auth?.jwksUrl);
|
|
642
582
|
put(K.dataApi.url, env.dataApi?.url);
|
|
@@ -648,7 +588,6 @@ function toEntries(env) {
|
|
|
648
588
|
put(K.storage.region, env.storage?.region);
|
|
649
589
|
put(K.aiGateway.apiKey, env.aiGateway?.apiKey);
|
|
650
590
|
put(K.aiGateway.baseUrl, env.aiGateway?.baseUrl);
|
|
651
|
-
if (env.functions) for (const slug of Object.keys(env.functions).sort()) put(functionBaseUrlKey(slug), env.functions[slug]?.baseUrl);
|
|
652
591
|
return out;
|
|
653
592
|
}
|
|
654
|
-
export {
|
|
593
|
+
export { credentialName as a, fetchEnvKeys as c, policyEnvKeys as d, resolveBranchPolicy as f, credentialEnvKeys as i, fetchEnvKeysState as l, NEON_ENV_VAR_KEYS as n, defaultAiGatewayCredential as o, toEntries as p, createApiFromOptions as r, defaultStorageCredential as s, NEON_DEV_FUNCTION_PORTS as t, isLiveCredential as u };
|
|
@@ -5,8 +5,8 @@ import { CONTEXT_FILE, contextBranch, gitBranchMap, gitBranchMapping, isUnfollow
|
|
|
5
5
|
import { writer } from "../writer.js";
|
|
6
6
|
import { neonSafeBranchName } from "../utils/branch_name.js";
|
|
7
7
|
import { currentGitBranch, gitPull, gitRepoRoot, hasUpstream, installPostCheckoutHook, isGitRepo, isManagedHook, localGitBranches, postCheckoutHookPath, readGitContext, removePostCheckoutHook } from "../utils/git.js";
|
|
8
|
-
import { o as quoteFlagValue } from "./link-
|
|
9
|
-
import { o as handler$1 } from "./checkout-
|
|
8
|
+
import { o as quoteFlagValue } from "./link-n40BxbmK.js";
|
|
9
|
+
import { o as handler$1 } from "./checkout-B_gbS0nD.js";
|
|
10
10
|
import { existsSync } from "node:fs";
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import chalk from "chalk";
|
|
@@ -13,8 +13,8 @@ import { writer } from "../writer.js";
|
|
|
13
13
|
import { createBranch, pickBranchInteractively } from "../utils/branch_picker.js";
|
|
14
14
|
import { looksLikeBranchId } from "../utils/formats.js";
|
|
15
15
|
import { listAllProjectBranches } from "../utils/enrichers.js";
|
|
16
|
-
import { n as autoPullEnvAfterPin } from "./env-
|
|
17
|
-
import { h as initCmd } from "./config-
|
|
16
|
+
import { n as autoPullEnvAfterPin } from "./env-DxcO3oJk.js";
|
|
17
|
+
import { h as initCmd } from "./config-BClSMzco.js";
|
|
18
18
|
import { formatLinkSummary } from "../commands/link_output.js";
|
|
19
19
|
import { r as REGIONS } from "./projects-a3X4OFEJ.js";
|
|
20
20
|
import prompts from "prompts";
|
|
@@ -4,6 +4,7 @@ import { isNeonApiError } from "../api.js";
|
|
|
4
4
|
import { writer } from "../writer.js";
|
|
5
5
|
import { noPassthrough, single } from "../utils/flags.js";
|
|
6
6
|
import { branchIdFromProps, fillSingleProject } from "../utils/enrichers.js";
|
|
7
|
+
import { builder as builder$1, command as command$1, describe as describe$1, handler as handler$1 } from "../commands/loki.js";
|
|
7
8
|
// src/commands/logs.ts
|
|
8
9
|
var logs_exports = /* @__PURE__ */ __exportAll({
|
|
9
10
|
assertReachableLogsPage: () => assertReachableLogsPage,
|
|
@@ -18,7 +19,9 @@ var logs_exports = /* @__PURE__ */ __exportAll({
|
|
|
18
19
|
const LOGS_EPILOG = `
|
|
19
20
|
Logs are currently available only for projects in aws-us-east-2, aws-us-east-1, aws-eu-central-1, and aws-ap-southeast-1.
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
Use neon logs query for structured filters, human-readable tables and cursor pagination. Use neon logs loki for the Loki read API and its complete JSON response envelope.
|
|
23
|
+
|
|
24
|
+
For more information, visit https://neon.com/docs/cli/logs`;
|
|
22
25
|
const LOG_SOURCES = [
|
|
23
26
|
"function",
|
|
24
27
|
"storage",
|
|
@@ -91,8 +94,8 @@ const windowOptions = (defaultWindow) => ({
|
|
|
91
94
|
}
|
|
92
95
|
});
|
|
93
96
|
const command = "logs";
|
|
94
|
-
const describe = "Query branch logs";
|
|
95
|
-
const builder = (argv) => argv.usage("$0 logs <sub-command> [options]").options(scopeOptions).middleware(fillSingleProject).command("query", "Query log records
|
|
97
|
+
const describe = "Query branch logs with structured filters, LogQL, or the Loki API";
|
|
98
|
+
const builder = (argv) => argv.usage("$0 logs <sub-command> [options]").options(scopeOptions).middleware(fillSingleProject).command("query", "Query log records with structured filters or LogQL", (yargs) => yargs.epilogue(LOGS_EPILOG).options({
|
|
96
99
|
...windowOptions("1h"),
|
|
97
100
|
limit: {
|
|
98
101
|
describe: "Maximum number of records to return per page (1-1000)",
|
|
@@ -174,7 +177,7 @@ const builder = (argv) => argv.usage("$0 logs <sub-command> [options]").options(
|
|
|
174
177
|
type: "number",
|
|
175
178
|
coerce: logLimit
|
|
176
179
|
}
|
|
177
|
-
}).conflicts("since", "start-time").example([["$0 logs field-values service_name --since 6h", "Service names seen in the last six hours"]]).strict().check(noPassthrough("logs field-values")), (args) => fieldValues(args)).epilogue(LOGS_EPILOG);
|
|
180
|
+
}).conflicts("since", "start-time").example([["$0 logs field-values service_name --since 6h", "Service names seen in the last six hours"]]).strict().check(noPassthrough("logs field-values")), (args) => fieldValues(args)).command(command$1, describe$1, builder$1, (args) => handler$1(args)).epilogue(LOGS_EPILOG);
|
|
178
181
|
const handler = (args) => {
|
|
179
182
|
return args;
|
|
180
183
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
2
|
import { fillSingleProject } from "../utils/enrichers.js";
|
|
3
|
-
import { y as status } from "./config-
|
|
3
|
+
import { y as status } from "./config-BClSMzco.js";
|
|
4
4
|
// src/commands/status.ts
|
|
5
5
|
var status_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
builder: () => builder,
|
package/dist/api.js
CHANGED
|
@@ -64,6 +64,7 @@ function messageFromBody(body) {
|
|
|
64
64
|
}
|
|
65
65
|
if (body && typeof body === "object" && "error" in body) {
|
|
66
66
|
const error = body.error;
|
|
67
|
+
if (typeof error === "string") return error;
|
|
67
68
|
if (error && typeof error === "object" && "message" in error) {
|
|
68
69
|
const message = error.message;
|
|
69
70
|
if (typeof message === "string") return message;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-
|
|
1
|
+
export { t as builder, r as command, i as describe, a as formatCheckoutPolicyFailure, o as handler } from "../_chunks/checkout-B_gbS0nD.js";
|
package/dist/commands/claim.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-
|
|
1
|
+
export { t as CLAIM_CREATE_FIELDS, n as CLAIM_LIST_FIELDS, r as aliases, i as builder, a as claimCreateFields, s as claimableCapabilities, c as command, l as create, u as describe, d as handler } from "../_chunks/claim-BVEwQ65H.js";
|
package/dist/commands/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-
|
|
1
|
+
export { t as ConfigInstallFailed, n as addCmd, r as applyCmd, i as applyFlags, a as applyPolicyOnCreate, o as builder, s as command, l as createBranchFromPolicyOnCheckout, u as describe, d as ensureConfigPackages, f as envFlag, p as envPullFlag, m as handler, h as initCmd, g as installCommandFrom, _ as missingDependencies, v as planCmd, y as status } from "../_chunks/config-BClSMzco.js";
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-
|
|
1
|
+
export { t as builder, n as command, i as describe, a as handler } from "../_chunks/deploy-CJ22hy3i.js";
|
package/dist/commands/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as
|
|
1
|
+
export { t as builder, n as captureShellEnv, r as command, i as describe, a as devBundleDir, o as devEnvContext, c as diffUnits, l as formatEnvFiles, u as formatEnvSummary, d as handler, f as loadDevEnvFiles, p as localFunctionPortsEnv, m as planFunctionsToUnits, h as reportDevCredential, g as sourceFunctionUrlOverlay } from "../_chunks/dev-CSoQfCuS.js";
|
package/dist/commands/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-
|
|
1
|
+
export { t as ENV_PULL_SKIPPED_HINT, n as autoPullEnvAfterPin, r as builder, i as command, a as describe, s as handler, c as pull } from "../_chunks/env-DxcO3oJk.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NEON_SERVICES, NEON_SERVICE_LABELS } from "../neon_services.js";
|
|
2
|
-
import {
|
|
3
|
-
import { BRANCH_ENV_KEY, ENV_PULL_KEYS, serviceForEnvKey } from "../env_services.js";
|
|
2
|
+
import { BRANCH_ENV_KEYS, ENV_PULL_KEYS, isLegacyFunctionBaseUrlKey, serviceForEnvKey } from "../env_services.js";
|
|
4
3
|
import { isAbsolute, relative } from "node:path";
|
|
5
4
|
import { homedir } from "node:os";
|
|
6
5
|
import chalk from "chalk";
|
|
@@ -24,8 +23,8 @@ const GROUP_ORDER = [
|
|
|
24
23
|
OTHER_GROUP
|
|
25
24
|
];
|
|
26
25
|
const groupOf = (key) => {
|
|
27
|
-
if (key
|
|
28
|
-
if (
|
|
26
|
+
if (BRANCH_ENV_KEYS.includes(key)) return BRANCH_GROUP;
|
|
27
|
+
if (isLegacyFunctionBaseUrlKey(key)) return NEON_SERVICE_LABELS.functions;
|
|
29
28
|
const pullKey = ENV_PULL_KEYS.find((candidate) => candidate === key);
|
|
30
29
|
const service = pullKey ? serviceForEnvKey(pullKey) : null;
|
|
31
30
|
return service ? NEON_SERVICE_LABELS[service] : OTHER_GROUP;
|
|
@@ -57,6 +56,7 @@ const formatPulledEnv = (outcome, cwd, branch) => {
|
|
|
57
56
|
lines.push(row(group, keys.map((key) => fresh.has(key) ? `${key}*` : key).join(", ")));
|
|
58
57
|
}
|
|
59
58
|
if (outcome.removed.length > 0) lines.push(row("Removed", `${outcome.removed.join(", ")} (not produced by this pull)`));
|
|
59
|
+
if (outcome.removed.some(isLegacyFunctionBaseUrlKey)) lines.push(row("", "Use functionBaseUrl(\"<slug>\") from @neon/env instead."));
|
|
60
60
|
if (fresh.size > 0) lines.push(" * new credential value");
|
|
61
61
|
const credential = outcome.credential;
|
|
62
62
|
if (credential?.issued && credential.revoked.length > 0) lines.push(`Revoked the credential it replaced (${credential.revoked.join(", ")}).`);
|
|
@@ -8,7 +8,7 @@ import { writer } from "../writer.js";
|
|
|
8
8
|
import { formatInitDone, printInitDone } from "../init/chrome.js";
|
|
9
9
|
import { FUNCTION_SLUG_PATTERN, deriveFunctionSlug } from "../utils/function_slug.js";
|
|
10
10
|
import { displayPath } from "./env_output.js";
|
|
11
|
-
import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-
|
|
11
|
+
import { _ as missingDependencies, d as ensureConfigPackages, g as installCommandFrom } from "../_chunks/config-BClSMzco.js";
|
|
12
12
|
import { recommendedOperations } from "../functions/registry.js";
|
|
13
13
|
import { collidingFiles, operationsFromFlags, planConfigRegistration, planEnvExample, planScaffold, writeScaffold } from "../functions/scaffold.js";
|
|
14
14
|
import { describeRegistrySource, openRegistry } from "../functions/source.js";
|
package/dist/commands/git.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-
|
|
1
|
+
export { t as aliases, n as builder, r as cleanup, i as command, a as describe, s as handler, c as install, l as partitionBranchesToPrune, u as status, d as sync, f as uninstall } from "../_chunks/git-C6XPViK5.js";
|
package/dist/commands/index.js
CHANGED
|
@@ -2,33 +2,33 @@ import { r as auth_exports } from "../_chunks/auth-rup6nemJ.js";
|
|
|
2
2
|
import { t as api_exports } from "../_chunks/api-1MKsfpY3.js";
|
|
3
3
|
import { n as api_keys_exports } from "../_chunks/api_keys-CTFHd5m_.js";
|
|
4
4
|
import { n as ask_exports } from "../_chunks/ask-Xlek1Pxh.js";
|
|
5
|
-
import { o as env_exports } from "../_chunks/env-
|
|
6
|
-
import { c as config_exports } from "../_chunks/config-
|
|
5
|
+
import { o as env_exports } from "../_chunks/env-DxcO3oJk.js";
|
|
6
|
+
import { c as config_exports } from "../_chunks/config-BClSMzco.js";
|
|
7
7
|
import { u as projects_exports } from "../_chunks/projects-a3X4OFEJ.js";
|
|
8
|
-
import { a as link_exports } from "../_chunks/link-
|
|
8
|
+
import { a as link_exports } from "../_chunks/link-n40BxbmK.js";
|
|
9
9
|
import { o as mcp_exports } from "../_chunks/mcp-SvqWzHnT.js";
|
|
10
10
|
import { c as plugins_exports } from "../_chunks/plugins-BwUZQ6Ic.js";
|
|
11
11
|
import { l as skills_exports } from "../_chunks/skills-Bv8oKKwE.js";
|
|
12
12
|
import { t as bootstrap_exports } from "../_chunks/bootstrap-B73qVB39.js";
|
|
13
13
|
import { r as branches_exports } from "../_chunks/branches-Bp-5z1lM.js";
|
|
14
14
|
import { n as bucket_exports } from "../_chunks/bucket-D06bvDSa.js";
|
|
15
|
-
import { n as checkout_exports } from "../_chunks/checkout-
|
|
16
|
-
import { o as claim_exports } from "../_chunks/claim-
|
|
15
|
+
import { n as checkout_exports } from "../_chunks/checkout-B_gbS0nD.js";
|
|
16
|
+
import { o as claim_exports } from "../_chunks/claim-BVEwQ65H.js";
|
|
17
17
|
import { o as connection_string_exports } from "../_chunks/connection_string-6WhV4WFx.js";
|
|
18
18
|
import { a as credentials_exports } from "../_chunks/credentials-BMBNmW0t.js";
|
|
19
19
|
import { r as data_api_exports } from "../_chunks/data_api-CHDwvMTG.js";
|
|
20
20
|
import { s as databases_exports } from "../_chunks/databases-B-qY303S.js";
|
|
21
|
-
import { r as deploy_exports } from "../_chunks/deploy-
|
|
22
|
-
import { s as dev_exports } from "../_chunks/dev-
|
|
21
|
+
import { r as deploy_exports } from "../_chunks/deploy-CJ22hy3i.js";
|
|
22
|
+
import { s as dev_exports } from "../_chunks/dev-CSoQfCuS.js";
|
|
23
23
|
import { i as diff_exports } from "../_chunks/diff-dnxneH0u.js";
|
|
24
24
|
import { c as docs_exports } from "../_chunks/docs-BpLiSTmm.js";
|
|
25
25
|
import { o as feedback_exports } from "../_chunks/feedback-mQmdTRFn.js";
|
|
26
26
|
import { o as functions_exports } from "../_chunks/functions-PHaU-kRb.js";
|
|
27
|
-
import { o as git_exports } from "../_chunks/git-
|
|
27
|
+
import { o as git_exports } from "../_chunks/git-C6XPViK5.js";
|
|
28
28
|
import { a as init_exports } from "../_chunks/init-D2fClHtC.js";
|
|
29
29
|
import { o as inspect_exports } from "../_chunks/inspect-yFAb61qo.js";
|
|
30
30
|
import { a as ip_allow_exports } from "../_chunks/ip_allow-DBdxNEUa.js";
|
|
31
|
-
import { l as logs_exports } from "../_chunks/logs-
|
|
31
|
+
import { l as logs_exports } from "../_chunks/logs-Zf8mcRVE.js";
|
|
32
32
|
import { a as neon_auth_exports } from "../_chunks/neon_auth-C4AXiUR6.js";
|
|
33
33
|
import { a as open_exports } from "../_chunks/open-T2nI89Oh.js";
|
|
34
34
|
import { c as operations_exports } from "../_chunks/operations-D7qGkKo3.js";
|
|
@@ -40,7 +40,7 @@ import { o as profile_exports } from "../_chunks/profile-CArcjyS4.js";
|
|
|
40
40
|
import { s as realtime_exports } from "../_chunks/realtime-BwtzYf5a.js";
|
|
41
41
|
import { a as set_context_exports } from "../_chunks/set_context-ompB6d2D.js";
|
|
42
42
|
import { s as snapshots_exports } from "../_chunks/snapshots-DxNhjcco.js";
|
|
43
|
-
import { a as status_exports } from "../_chunks/status-
|
|
43
|
+
import { a as status_exports } from "../_chunks/status-TDYLPWRO.js";
|
|
44
44
|
import { d as triggers_exports } from "../_chunks/triggers-BfvyeJUC.js";
|
|
45
45
|
import { s as user_exports } from "../_chunks/user-D9mC430O.js";
|
|
46
46
|
import { i as vpc_endpoints_exports } from "../_chunks/vpc_endpoints-C-Y4WK2M.js";
|
package/dist/commands/link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, r as describe, i as handler, o as quoteFlagValue, s as runLink, c as shouldOfferConfigInit } from "../_chunks/link-
|
|
1
|
+
export { t as builder, n as command, r as describe, i as handler, o as quoteFlagValue, s as runLink, c as shouldOfferConfigInit } from "../_chunks/link-n40BxbmK.js";
|
package/dist/commands/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as assertReachableLogsPage, n as buildLogsQueryBody, r as builder, i as command, a as describe, o as escapeLogSingleLine, s as escapeLogTableCell, c as handler } from "../_chunks/logs-
|
|
1
|
+
export { t as assertReachableLogsPage, n as buildLogsQueryBody, r as builder, i as command, a as describe, o as escapeLogSingleLine, s as escapeLogTableCell, c as handler } from "../_chunks/logs-Zf8mcRVE.js";
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { NeonApiError } from "../api.js";
|
|
2
|
+
import { writer } from "../writer.js";
|
|
3
|
+
import { noPassthrough, single } from "../utils/flags.js";
|
|
4
|
+
import { branchIdFromProps } from "../utils/enrichers.js";
|
|
5
|
+
// src/commands/loki.ts
|
|
6
|
+
const LABEL_VALUES = /^label\/([a-zA-Z_][a-zA-Z0-9_]*)\/values$/;
|
|
7
|
+
const endpoint = (value) => {
|
|
8
|
+
const path = single("endpoint")(value);
|
|
9
|
+
if (path === void 0 || !(path === "query_range" || path === "labels" || LABEL_VALUES.test(path))) throw new Error("--endpoint must be query_range, labels, or label/<name>/values. See neon logs loki --help.");
|
|
10
|
+
return path;
|
|
11
|
+
};
|
|
12
|
+
const limit = (value) => {
|
|
13
|
+
if (value === void 0) return void 0;
|
|
14
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1) throw new Error("--limit must be a positive integer.");
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
const rangeQuery = ({ query }) => {
|
|
18
|
+
if (!query?.trim()) throw new Error("Pass a LogQL query, e.g. neon logs loki '{entity_type=\"function\"}'. See neon logs loki --help.");
|
|
19
|
+
return query;
|
|
20
|
+
};
|
|
21
|
+
const validate = (props) => {
|
|
22
|
+
if (props.endpoint === "query_range") {
|
|
23
|
+
rangeQuery(props);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
for (const name of ["limit", "direction"]) if (props[name] !== void 0) throw new Error(`--${name} applies only to --endpoint query_range.`);
|
|
27
|
+
};
|
|
28
|
+
const command = "loki [query]";
|
|
29
|
+
const describe = "Call the branch's Loki read API and return its JSON response";
|
|
30
|
+
const builder = (argv) => argv.usage("$0 logs loki [query] [options]").positional("query", {
|
|
31
|
+
describe: "LogQL expression. With a label endpoint, an optional stream selector that scopes the labels.",
|
|
32
|
+
type: "string",
|
|
33
|
+
coerce: single("query")
|
|
34
|
+
}).options({
|
|
35
|
+
"project-id": {
|
|
36
|
+
describe: "Project ID",
|
|
37
|
+
type: "string",
|
|
38
|
+
coerce: single("project-id")
|
|
39
|
+
},
|
|
40
|
+
branch: {
|
|
41
|
+
describe: "Branch ID or name (defaults to the project's default branch)",
|
|
42
|
+
type: "string",
|
|
43
|
+
coerce: single("branch")
|
|
44
|
+
},
|
|
45
|
+
since: {
|
|
46
|
+
describe: "Lookback window as a positive Go duration, e.g. 30m or 24h. Defaults to 1h for queries and 6h for label values. Explicit --start takes precedence.",
|
|
47
|
+
type: "string",
|
|
48
|
+
coerce: single("since")
|
|
49
|
+
},
|
|
50
|
+
start: {
|
|
51
|
+
describe: "Window start as RFC 3339 or Unix nanoseconds (kept as a string)",
|
|
52
|
+
type: "string",
|
|
53
|
+
coerce: single("start")
|
|
54
|
+
},
|
|
55
|
+
end: {
|
|
56
|
+
describe: "Window end as RFC 3339 or Unix nanoseconds (kept as a string). Defaults to now.",
|
|
57
|
+
type: "string",
|
|
58
|
+
coerce: single("end")
|
|
59
|
+
},
|
|
60
|
+
limit: {
|
|
61
|
+
describe: "Maximum number of log lines (query_range only); the server enforces its cap",
|
|
62
|
+
type: "number",
|
|
63
|
+
coerce: limit
|
|
64
|
+
},
|
|
65
|
+
direction: {
|
|
66
|
+
describe: "Timestamp order (query_range only): forward (oldest first) or backward (newest first)",
|
|
67
|
+
type: "string",
|
|
68
|
+
choices: ["forward", "backward"],
|
|
69
|
+
coerce: single("direction")
|
|
70
|
+
},
|
|
71
|
+
endpoint: {
|
|
72
|
+
describe: "Read endpoint: query_range, labels, or label/<name>/values",
|
|
73
|
+
type: "string",
|
|
74
|
+
default: "query_range",
|
|
75
|
+
coerce: endpoint
|
|
76
|
+
}
|
|
77
|
+
}).default("output", "json").middleware((args) => {
|
|
78
|
+
noPassthrough("logs loki")(args);
|
|
79
|
+
if (args.output !== "json" && args.output !== "yaml") throw new Error("--output must be json or yaml for neon logs loki.");
|
|
80
|
+
validate(args);
|
|
81
|
+
}, true).strict().example("$0 logs loki '{entity_type=\"function\"} |= \"error\"' --since 30m --limit 100", "Query function logs with a bounded time window and line count").example("$0 logs loki --endpoint labels", "Discover stream labels").example("$0 logs loki --endpoint label/service_name/values --since 6h", "Discover service names before choosing a selector").example("$0 logs loki '{entity_type=\"function\"}' --endpoint label/severity_text/values", "List the severities function logs carry").example("$0 logs loki '{entity_type=\"function\"}' --project-id <id> --branch <id|name> --start 2026-11-01T00:00:00Z --end 2026-11-01T01:00:00Z", "Query an explicit branch and absolute time window").epilogue([
|
|
82
|
+
"query_range requires a LogQL query and accepts --since, --start, --end, --limit and --direction. labels and label/<name>/values accept the time bounds and an optional stream selector without line filters. Use entity_type, not source, in Loki selectors.",
|
|
83
|
+
"Output: --output json (default) or --output yaml. data.result groups lines by stream labels; each values entry is [timestamp, line], with timestamps kept as nanosecond strings. There is no continuation cursor: a result with --limit lines, or the server's cap of 10,000, may be incomplete, and the cap adds no warnings entry. Narrow the time window or selector to retrieve complete results.",
|
|
84
|
+
"Neon supports stream selectors and line filters; metric queries, parser stages and live tailing are unsupported. Instant queries are unsupported.",
|
|
85
|
+
"For structured filters, human-readable tables and cursor pagination, use neon logs query --help.",
|
|
86
|
+
"Uses /telemetry/v1 on the origin selected by --api-host or NEON_API_HOST. Availability depends on the project's region and telemetry rollout. See https://neon.com/docs/cli/logs#loki-read-api"
|
|
87
|
+
].join("\n\n"));
|
|
88
|
+
const handler = async (props) => {
|
|
89
|
+
const branchId = await branchIdFromProps(props);
|
|
90
|
+
const { fromSdkError, getNeonClient } = await import("../neon_client.js");
|
|
91
|
+
const { loki } = getNeonClient(props).logs;
|
|
92
|
+
const scope = {
|
|
93
|
+
projectId: props.projectId,
|
|
94
|
+
branchId,
|
|
95
|
+
since: props.since,
|
|
96
|
+
start: props.start,
|
|
97
|
+
end: props.end
|
|
98
|
+
};
|
|
99
|
+
const label = LABEL_VALUES.exec(props.endpoint)?.[1];
|
|
100
|
+
const data = await (props.endpoint === "query_range" ? loki.queryRange({
|
|
101
|
+
...scope,
|
|
102
|
+
query: rangeQuery(props),
|
|
103
|
+
limit: props.limit,
|
|
104
|
+
direction: props.direction
|
|
105
|
+
}) : label === void 0 ? loki.labels({
|
|
106
|
+
...scope,
|
|
107
|
+
query: props.query
|
|
108
|
+
}) : loki.labelValues({
|
|
109
|
+
...scope,
|
|
110
|
+
name: label,
|
|
111
|
+
query: props.query
|
|
112
|
+
})).catch((error) => {
|
|
113
|
+
const failure = fromSdkError(error, new URL("/telemetry/v1", props.apiHost ?? "https://console.neon.tech/api/v2").toString());
|
|
114
|
+
if (!(failure instanceof NeonApiError) || failure.status === void 0 || failure.status < 400) throw failure;
|
|
115
|
+
throw new NeonApiError(`Loki request failed with status ${failure.status}`, {
|
|
116
|
+
status: failure.status,
|
|
117
|
+
statusText: failure.statusText,
|
|
118
|
+
data: failure.data,
|
|
119
|
+
headers: failure.headers,
|
|
120
|
+
requestPath: failure.requestPath
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
writer({ output: props.output }).end(data, { fields: [] });
|
|
124
|
+
};
|
|
125
|
+
export { builder, command, describe, handler };
|
package/dist/commands/status.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-
|
|
1
|
+
export { t as builder, n as command, r as describe, i as handler } from "../_chunks/status-TDYLPWRO.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { writer } from "../writer.js";
|
|
2
2
|
import { branchIdFromProps } from "../utils/enrichers.js";
|
|
3
|
-
import { o as resolveNeonEnvVars } from "../_chunks/env-
|
|
3
|
+
import { o as resolveNeonEnvVars } from "../_chunks/env-CFBmcKyo.js";
|
|
4
4
|
import YAML from "yaml";
|
|
5
5
|
// src/commands/subscribe.ts
|
|
6
6
|
const builder = (argv) => argv.usage("$0 realtime subscribe \"<query>\" [options]").positional("query", {
|
package/dist/dev/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as DevEnvMismatchError, n as MissingBranchContextError, r as ServiceNotOnBranchError, i as dropClaimableUnsupported, a as resolveDevEnv, o as resolveNeonEnvVars } from "../_chunks/env-
|
|
1
|
+
export { t as DevEnvMismatchError, n as MissingBranchContextError, r as ServiceNotOnBranchError, i as dropClaimableUnsupported, a as resolveDevEnv, o as resolveNeonEnvVars } from "../_chunks/env-CFBmcKyo.js";
|