@dbx-tools/appkit-autopg 0.1.12 → 0.1.18
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/src/autopg.js +1 -1
- package/dist/src/resolver.d.ts +1 -1
- package/dist/src/resolver.js +7 -7
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/autopg.ts +1 -1
- package/src/resolver.ts +7 -7
package/dist/src/autopg.js
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* picks them up. Pass `{ exportEnv: false }` to keep `process.env`
|
|
33
33
|
* untouched and just inspect the returned record.
|
|
34
34
|
*/
|
|
35
|
-
import { logUtils } from "@dbx-tools/
|
|
35
|
+
import { logUtils } from "@dbx-tools/shared";
|
|
36
36
|
import { applyToEnv, resolveConnection, } from "./resolver.js";
|
|
37
37
|
/**
|
|
38
38
|
* Resolve Lakebase Postgres connection info from config + env (and the
|
package/dist/src/resolver.d.ts
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
*
|
|
33
33
|
* @see https://docs.databricks.com/api/workspace/postgres
|
|
34
34
|
*/
|
|
35
|
-
import { type logUtils } from "@dbx-tools/
|
|
35
|
+
import { type logUtils } from "@dbx-tools/shared";
|
|
36
36
|
/** Postgres TLS mode passed through to `pg`. */
|
|
37
37
|
export type SslMode = "require" | "disable" | "prefer";
|
|
38
38
|
/**
|
package/dist/src/resolver.js
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* @see https://docs.databricks.com/api/workspace/postgres
|
|
34
34
|
*/
|
|
35
35
|
import { getWorkspaceClient } from "@databricks/appkit";
|
|
36
|
-
import { projectUtils, stringUtils } from "@dbx-tools/
|
|
36
|
+
import { projectUtils, stringUtils } from "@dbx-tools/shared";
|
|
37
37
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
38
38
|
import { parseAddress } from "./address.js";
|
|
39
39
|
const API_BASE = "/api/2.0/postgres";
|
|
@@ -140,7 +140,7 @@ export async function resolveConnection(config, log) {
|
|
|
140
140
|
if (parsed) {
|
|
141
141
|
const ep = await waitEndpointReady(ws, parsed.project, parsed.branch, parsed.endpointId, log);
|
|
142
142
|
host = ep.status?.hosts?.host;
|
|
143
|
-
log.
|
|
143
|
+
log.debug("autopg: resolved host from endpoint", { host });
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
if (!database) {
|
|
@@ -263,7 +263,7 @@ async function findEndpointByHost(ws, host, log) {
|
|
|
263
263
|
const endpoints = await listEndpoints(ws, projectId, branchId);
|
|
264
264
|
const match = endpoints.find((e) => e.status?.hosts?.host === host);
|
|
265
265
|
if (match?.name) {
|
|
266
|
-
log.
|
|
266
|
+
log.debug("autopg: matched endpoint by host", {
|
|
267
267
|
host,
|
|
268
268
|
endpoint: match.name,
|
|
269
269
|
});
|
|
@@ -294,7 +294,7 @@ async function pickOrCreateProject(ws, autoCreate, log) {
|
|
|
294
294
|
if (projects.length === 1) {
|
|
295
295
|
const id = projectIdFromName(projects[0].name);
|
|
296
296
|
if (id) {
|
|
297
|
-
log.
|
|
297
|
+
log.debug("autopg: using only project", { project: id });
|
|
298
298
|
return id;
|
|
299
299
|
}
|
|
300
300
|
}
|
|
@@ -455,7 +455,7 @@ async function pickBranch(ws, project, log) {
|
|
|
455
455
|
.join(", ");
|
|
456
456
|
throw new Error(`autopg: project '${project}' has multiple branches and none marked default; set LAKEBASE_BRANCH or config.branch. Candidates: ${candidates}`);
|
|
457
457
|
}
|
|
458
|
-
log.
|
|
458
|
+
log.debug("autopg: resolved branch", { project, branch: choice });
|
|
459
459
|
return choice;
|
|
460
460
|
}
|
|
461
461
|
/**
|
|
@@ -477,7 +477,7 @@ async function pickEndpoint(ws, project, branch, log) {
|
|
|
477
477
|
throw new Error(`autopg: branch has no primary READ_WRITE endpoint; set LAKEBASE_ENDPOINT or config.endpoint. Candidates: ${names.join(", ")}`);
|
|
478
478
|
}
|
|
479
479
|
const host = primary.status?.hosts?.host;
|
|
480
|
-
log.
|
|
480
|
+
log.debug("autopg: resolved endpoint", { endpoint: primary.name, host });
|
|
481
481
|
return { name: primary.name, host };
|
|
482
482
|
}
|
|
483
483
|
/**
|
|
@@ -502,6 +502,6 @@ async function pickDatabase(ws, project, branch, log) {
|
|
|
502
502
|
if (!choice) {
|
|
503
503
|
throw new Error(`autopg: multiple databases and no 'databricks_postgres'; set PGDATABASE or config.database. Candidates: ${names.join(", ")}`);
|
|
504
504
|
}
|
|
505
|
-
log.
|
|
505
|
+
log.debug("autopg: resolved database", { database: choice });
|
|
506
506
|
return choice;
|
|
507
507
|
}
|