@tickernelz/wardmote 2026.1108.1 → 2026.1108.2
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/LICENSE +1 -1
- package/dist/index.js +14 -7
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2025 Paperclip AI
|
|
4
|
-
Copyright (c) 2026 Zhafron Adani Kautsar (
|
|
4
|
+
Copyright (c) 2026 Zhafron Adani Kautsar (Wardmote fork modifications)
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/dist/index.js
CHANGED
|
@@ -48159,8 +48159,13 @@ async function getAvailablePort() {
|
|
|
48159
48159
|
].join(", ")}`
|
|
48160
48160
|
);
|
|
48161
48161
|
}
|
|
48162
|
-
|
|
48162
|
+
function embeddedPostgresTemplateDir() {
|
|
48163
|
+
const dir = process.env[EMBEDDED_POSTGRES_TEMPLATE_DIR_ENV]?.trim();
|
|
48164
|
+
return dir && fs12.existsSync(path13.join(dir, "PG_VERSION")) ? dir : null;
|
|
48165
|
+
}
|
|
48166
|
+
async function createEmbeddedPostgresTestInstance(tempDirPrefix, templateDir = null) {
|
|
48163
48167
|
const dataDir = fs12.mkdtempSync(path13.join(os3.tmpdir(), tempDirPrefix));
|
|
48168
|
+
if (templateDir) fs12.cpSync(templateDir, dataDir, { recursive: true });
|
|
48164
48169
|
const port = await getAvailablePort();
|
|
48165
48170
|
const EmbeddedPostgres2 = await getEmbeddedPostgresCtor();
|
|
48166
48171
|
const logBuffer = createEmbeddedPostgresLogBuffer();
|
|
@@ -48204,12 +48209,12 @@ async function stopEmbeddedPostgresBounded(instance, cleanupFn) {
|
|
|
48204
48209
|
if (timer) clearTimeout(timer);
|
|
48205
48210
|
}
|
|
48206
48211
|
}
|
|
48207
|
-
async function startEmbeddedPostgresWithRetry(tempDirPrefix) {
|
|
48212
|
+
async function startEmbeddedPostgresWithRetry(tempDirPrefix, templateDir = null) {
|
|
48208
48213
|
let lastError = new Error("embedded Postgres startup failed");
|
|
48209
48214
|
for (let attempt = 1; attempt <= EMBEDDED_POSTGRES_START_MAX_ATTEMPTS; attempt += 1) {
|
|
48210
|
-
const created = await createEmbeddedPostgresTestInstance(tempDirPrefix);
|
|
48215
|
+
const created = await createEmbeddedPostgresTestInstance(tempDirPrefix, templateDir);
|
|
48211
48216
|
try {
|
|
48212
|
-
await created.instance.initialise();
|
|
48217
|
+
if (!templateDir) await created.instance.initialise();
|
|
48213
48218
|
await created.instance.start();
|
|
48214
48219
|
return { port: created.port, dataDir: created.dataDir, instance: created.instance };
|
|
48215
48220
|
} catch (error) {
|
|
@@ -48228,9 +48233,10 @@ async function startEmbeddedPostgresWithRetry(tempDirPrefix) {
|
|
|
48228
48233
|
);
|
|
48229
48234
|
}
|
|
48230
48235
|
async function probeEmbeddedPostgresSupport() {
|
|
48236
|
+
if (embeddedPostgresTemplateDir()) return { supported: true };
|
|
48231
48237
|
let started = null;
|
|
48232
48238
|
try {
|
|
48233
|
-
started = await startEmbeddedPostgresWithRetry("
|
|
48239
|
+
started = await startEmbeddedPostgresWithRetry("wardmote-embedded-postgres-probe-");
|
|
48234
48240
|
return { supported: true };
|
|
48235
48241
|
} catch (error) {
|
|
48236
48242
|
return {
|
|
@@ -48253,7 +48259,7 @@ async function getEmbeddedPostgresTestSupport() {
|
|
|
48253
48259
|
return await embeddedPostgresSupportPromise;
|
|
48254
48260
|
}
|
|
48255
48261
|
async function startEmbeddedPostgresTestDatabase(tempDirPrefix) {
|
|
48256
|
-
const { port, dataDir, instance } = await startEmbeddedPostgresWithRetry(tempDirPrefix);
|
|
48262
|
+
const { port, dataDir, instance } = await startEmbeddedPostgresWithRetry(tempDirPrefix, embeddedPostgresTemplateDir());
|
|
48257
48263
|
try {
|
|
48258
48264
|
const adminConnectionString = `postgres://paperclip:paperclip@127.0.0.1:${port}/postgres`;
|
|
48259
48265
|
await ensurePostgresDatabase(adminConnectionString, "paperclip");
|
|
@@ -48275,7 +48281,7 @@ async function startEmbeddedPostgresTestDatabase(tempDirPrefix) {
|
|
|
48275
48281
|
);
|
|
48276
48282
|
}
|
|
48277
48283
|
}
|
|
48278
|
-
var EMBEDDED_POSTGRES_TEST_TIMEOUT_MS, embeddedPostgresSupportPromise, DEFAULT_PAPERCLIP_EMBEDDED_POSTGRES_PORT, embeddedPostgresCtorProvider, EMBEDDED_POSTGRES_STOP_TIMEOUT_MS, EMBEDDED_POSTGRES_START_MAX_ATTEMPTS;
|
|
48284
|
+
var EMBEDDED_POSTGRES_TEST_TIMEOUT_MS, embeddedPostgresSupportPromise, DEFAULT_PAPERCLIP_EMBEDDED_POSTGRES_PORT, embeddedPostgresCtorProvider, EMBEDDED_POSTGRES_TEMPLATE_DIR_ENV, EMBEDDED_POSTGRES_STOP_TIMEOUT_MS, EMBEDDED_POSTGRES_START_MAX_ATTEMPTS;
|
|
48279
48285
|
var init_test_embedded_postgres = __esm({
|
|
48280
48286
|
"../packages/db/src/test-embedded-postgres.ts"() {
|
|
48281
48287
|
"use strict";
|
|
@@ -48286,6 +48292,7 @@ var init_test_embedded_postgres = __esm({
|
|
|
48286
48292
|
embeddedPostgresSupportPromise = null;
|
|
48287
48293
|
DEFAULT_PAPERCLIP_EMBEDDED_POSTGRES_PORT = 54329;
|
|
48288
48294
|
embeddedPostgresCtorProvider = loadEmbeddedPostgresCtor;
|
|
48295
|
+
EMBEDDED_POSTGRES_TEMPLATE_DIR_ENV = "WARDMOTE_TEST_EMBEDDED_POSTGRES_TEMPLATE_DIR";
|
|
48289
48296
|
EMBEDDED_POSTGRES_STOP_TIMEOUT_MS = 5e3;
|
|
48290
48297
|
EMBEDDED_POSTGRES_START_MAX_ATTEMPTS = 5;
|
|
48291
48298
|
}
|