postgresai 0.17.0-dev.1 → 0.17.0-rc.1

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.
@@ -13524,7 +13524,7 @@ var {
13524
13524
  // package.json
13525
13525
  var package_default = {
13526
13526
  name: "postgresai",
13527
- version: "0.17.0-dev.1",
13527
+ version: "0.17.0-rc.1",
13528
13528
  description: "postgres_ai CLI",
13529
13529
  license: "Apache-2.0",
13530
13530
  private: false,
@@ -13721,6 +13721,23 @@ function deleteConfigKeys(keys) {
13721
13721
  }
13722
13722
  }
13723
13723
 
13724
+ // lib/stdout.ts
13725
+ function writeStdout(text) {
13726
+ return new Promise((resolve, reject) => {
13727
+ process.stdout.write(text, (err) => {
13728
+ if (err) {
13729
+ process.stdout.once("error", () => {});
13730
+ reject(err);
13731
+ return;
13732
+ }
13733
+ resolve();
13734
+ });
13735
+ });
13736
+ }
13737
+ function isEpipe(err) {
13738
+ return err?.code === "EPIPE";
13739
+ }
13740
+
13724
13741
  // node_modules/js-yaml/dist/js-yaml.mjs
13725
13742
  function getDefaultExportFromCjs(x) {
13726
13743
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -16867,7 +16884,7 @@ var Result = import_lib.default.Result;
16867
16884
  var TypeOverrides = import_lib.default.TypeOverrides;
16868
16885
  var defaults = import_lib.default.defaults;
16869
16886
  // package.json
16870
- var version = "0.17.0-dev.1";
16887
+ var version = "0.17.0-rc.1";
16871
16888
  var package_default2 = {
16872
16889
  name: "postgresai",
16873
16890
  version,
@@ -38522,16 +38539,32 @@ function addInstanceToFile(file, instance) {
38522
38539
  throw new Error(`Monitoring target '${instance.name}' already exists`);
38523
38540
  }
38524
38541
  existing.push(instance);
38525
- fs8.writeFileSync(file, dump2(existing), "utf8");
38542
+ writeInstancesFile(file, existing);
38526
38543
  }
38527
38544
  function removeInstanceFromFile(file, name) {
38528
38545
  const instances = loadInstances2(file);
38529
38546
  const filtered = instances.filter((i) => i.name !== name);
38530
38547
  if (filtered.length === instances.length)
38531
38548
  return false;
38532
- fs8.writeFileSync(file, dump2(filtered), "utf8");
38549
+ writeInstancesFile(file, filtered);
38533
38550
  return true;
38534
38551
  }
38552
+ function writeInstancesFile(file, instances) {
38553
+ const content = dump2(instances);
38554
+ const fd = fs8.openSync(file, "w", 384);
38555
+ try {
38556
+ try {
38557
+ fs8.fchmodSync(fd, 384);
38558
+ } catch (err) {
38559
+ const message = err instanceof Error ? err.message : String(err);
38560
+ console.error(`Warning: could not restrict permissions on ${file}: ${message}`);
38561
+ console.error(" It may be readable by other users on this machine.");
38562
+ }
38563
+ fs8.writeFileSync(fd, content, "utf8");
38564
+ } finally {
38565
+ fs8.closeSync(fd);
38566
+ }
38567
+ }
38535
38568
  function extractSslmode(connStr) {
38536
38569
  try {
38537
38570
  return (new URL(connStr).searchParams.get("sslmode") || "").toLowerCase();
@@ -40358,7 +40391,14 @@ Usage: postgresai checkup ${checkId} postgresql://user@host:5432/dbname
40358
40391
  }
40359
40392
  }
40360
40393
  if (shouldPrintJson && !outputPath) {
40361
- console.log(JSON.stringify(reports, null, 2));
40394
+ try {
40395
+ await writeStdout(JSON.stringify(reports, null, 2) + `
40396
+ `);
40397
+ } catch (err) {
40398
+ if (isEpipe(err))
40399
+ return;
40400
+ throw err;
40401
+ }
40362
40402
  }
40363
40403
  const hadOutput = shouldPrintJson || shouldConvertMarkdown || outputPath || uploadSummary;
40364
40404
  if (!hadOutput) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postgresai",
3
- "version": "0.17.0-dev.1",
3
+ "version": "0.17.0-rc.1",
4
4
  "description": "postgres_ai CLI",
5
5
  "license": "Apache-2.0",
6
6
  "private": false,