postgresai 0.14.0-dev.44 → 0.14.0-dev.45
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/bin/postgres-ai.js
CHANGED
|
@@ -13064,7 +13064,7 @@ var {
|
|
|
13064
13064
|
// package.json
|
|
13065
13065
|
var package_default = {
|
|
13066
13066
|
name: "postgresai",
|
|
13067
|
-
version: "0.14.0-dev.
|
|
13067
|
+
version: "0.14.0-dev.45",
|
|
13068
13068
|
description: "postgres_ai CLI",
|
|
13069
13069
|
license: "Apache-2.0",
|
|
13070
13070
|
private: false,
|
|
@@ -15881,7 +15881,7 @@ var Result = import_lib.default.Result;
|
|
|
15881
15881
|
var TypeOverrides = import_lib.default.TypeOverrides;
|
|
15882
15882
|
var defaults = import_lib.default.defaults;
|
|
15883
15883
|
// package.json
|
|
15884
|
-
var version = "0.14.0-dev.
|
|
15884
|
+
var version = "0.14.0-dev.45";
|
|
15885
15885
|
var package_default2 = {
|
|
15886
15886
|
name: "postgresai",
|
|
15887
15887
|
version,
|
|
@@ -26956,7 +26956,7 @@ function parseVersionNum(versionNum) {
|
|
|
26956
26956
|
function formatBytes(bytes) {
|
|
26957
26957
|
if (bytes === 0)
|
|
26958
26958
|
return "0 B";
|
|
26959
|
-
const units = ["B", "
|
|
26959
|
+
const units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
|
|
26960
26960
|
const i3 = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
26961
26961
|
return `${(bytes / Math.pow(1024, i3)).toFixed(2)} ${units[i3]}`;
|
|
26962
26962
|
}
|
package/lib/checkup.ts
CHANGED
|
@@ -186,11 +186,15 @@ export function parseVersionNum(versionNum: string): { major: string; minor: str
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
/**
|
|
189
|
-
* Format bytes to human readable string
|
|
189
|
+
* Format bytes to human readable string using binary units (1024-based).
|
|
190
|
+
* Uses IEC standard: KiB, MiB, GiB, etc.
|
|
191
|
+
*
|
|
192
|
+
* Note: PostgreSQL's pg_size_pretty() uses kB/MB/GB with 1024 base (technically
|
|
193
|
+
* incorrect SI usage), but we follow IEC binary units per project style guide.
|
|
190
194
|
*/
|
|
191
195
|
export function formatBytes(bytes: number): string {
|
|
192
196
|
if (bytes === 0) return "0 B";
|
|
193
|
-
const units = ["B", "
|
|
197
|
+
const units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
|
|
194
198
|
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
195
199
|
return `${(bytes / Math.pow(1024, i)).toFixed(2)} ${units[i]}`;
|
|
196
200
|
}
|
package/package.json
CHANGED
package/test/checkup.test.ts
CHANGED
|
@@ -269,17 +269,17 @@ describe("formatBytes", () => {
|
|
|
269
269
|
expect(checkup.formatBytes(500)).toBe("500.00 B");
|
|
270
270
|
});
|
|
271
271
|
|
|
272
|
-
test("formats
|
|
273
|
-
expect(checkup.formatBytes(1024)).toBe("1.00
|
|
274
|
-
expect(checkup.formatBytes(1536)).toBe("1.50
|
|
272
|
+
test("formats kibibytes", () => {
|
|
273
|
+
expect(checkup.formatBytes(1024)).toBe("1.00 KiB");
|
|
274
|
+
expect(checkup.formatBytes(1536)).toBe("1.50 KiB");
|
|
275
275
|
});
|
|
276
276
|
|
|
277
|
-
test("formats
|
|
278
|
-
expect(checkup.formatBytes(1048576)).toBe("1.00
|
|
277
|
+
test("formats mebibytes", () => {
|
|
278
|
+
expect(checkup.formatBytes(1048576)).toBe("1.00 MiB");
|
|
279
279
|
});
|
|
280
280
|
|
|
281
|
-
test("formats
|
|
282
|
-
expect(checkup.formatBytes(1073741824)).toBe("1.00
|
|
281
|
+
test("formats gibibytes", () => {
|
|
282
|
+
expect(checkup.formatBytes(1073741824)).toBe("1.00 GiB");
|
|
283
283
|
});
|
|
284
284
|
});
|
|
285
285
|
|
|
@@ -213,7 +213,7 @@ describe.skipIf(skipTests)("integration: prepare-db", () => {
|
|
|
213
213
|
} finally {
|
|
214
214
|
await pg.cleanup();
|
|
215
215
|
}
|
|
216
|
-
});
|
|
216
|
+
}, { timeout: 30000 });
|
|
217
217
|
|
|
218
218
|
test("requires explicit monitoring password in non-interactive mode", async () => {
|
|
219
219
|
pg = await createTempPostgres();
|
|
@@ -237,7 +237,7 @@ describe.skipIf(skipTests)("integration: prepare-db", () => {
|
|
|
237
237
|
} finally {
|
|
238
238
|
await pg.cleanup();
|
|
239
239
|
}
|
|
240
|
-
});
|
|
240
|
+
}, { timeout: 30000 });
|
|
241
241
|
|
|
242
242
|
test("fixes slightly-off permissions idempotently", async () => {
|
|
243
243
|
pg = await createTempPostgres();
|
|
@@ -291,7 +291,7 @@ describe.skipIf(skipTests)("integration: prepare-db", () => {
|
|
|
291
291
|
} finally {
|
|
292
292
|
await pg.cleanup();
|
|
293
293
|
}
|
|
294
|
-
});
|
|
294
|
+
}, { timeout: 30000 });
|
|
295
295
|
|
|
296
296
|
test("reports nicely when lacking permissions", async () => {
|
|
297
297
|
pg = await createTempPostgres();
|
|
@@ -324,7 +324,7 @@ describe.skipIf(skipTests)("integration: prepare-db", () => {
|
|
|
324
324
|
} finally {
|
|
325
325
|
await pg.cleanup();
|
|
326
326
|
}
|
|
327
|
-
});
|
|
327
|
+
}, { timeout: 30000 });
|
|
328
328
|
|
|
329
329
|
test("--verify returns 0 when ok and non-zero when missing", async () => {
|
|
330
330
|
pg = await createTempPostgres();
|
|
@@ -360,7 +360,7 @@ describe.skipIf(skipTests)("integration: prepare-db", () => {
|
|
|
360
360
|
} finally {
|
|
361
361
|
await pg.cleanup();
|
|
362
362
|
}
|
|
363
|
-
});
|
|
363
|
+
}, { timeout: 30000 });
|
|
364
364
|
|
|
365
365
|
test("--reset-password updates the monitoring role login password", async () => {
|
|
366
366
|
pg = await createTempPostgres();
|
|
@@ -392,5 +392,5 @@ describe.skipIf(skipTests)("integration: prepare-db", () => {
|
|
|
392
392
|
} finally {
|
|
393
393
|
await pg.cleanup();
|
|
394
394
|
}
|
|
395
|
-
});
|
|
395
|
+
}, { timeout: 30000 });
|
|
396
396
|
});
|