@fiber-pay/runtime 0.1.0-rc.7 → 0.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/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -218,16 +218,20 @@ var AlertManager = class {
|
|
|
218
218
|
};
|
|
219
219
|
|
|
220
220
|
// src/alerts/backends/file-jsonl.ts
|
|
221
|
-
import {
|
|
221
|
+
import { appendFile, mkdir } from "fs/promises";
|
|
222
222
|
import { dirname, join } from "path";
|
|
223
223
|
var JsonlFileAlertBackend = class {
|
|
224
224
|
path;
|
|
225
|
+
initialized = false;
|
|
225
226
|
constructor(path) {
|
|
226
227
|
this.path = path;
|
|
227
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
228
228
|
}
|
|
229
229
|
async send(alert) {
|
|
230
|
-
|
|
230
|
+
if (!this.initialized) {
|
|
231
|
+
await mkdir(dirname(this.path), { recursive: true });
|
|
232
|
+
this.initialized = true;
|
|
233
|
+
}
|
|
234
|
+
await appendFile(this.path, `${JSON.stringify(alert)}
|
|
231
235
|
`, "utf-8");
|
|
232
236
|
}
|
|
233
237
|
};
|
|
@@ -247,8 +251,8 @@ var DailyJsonlFileAlertBackend = class {
|
|
|
247
251
|
}
|
|
248
252
|
async send(alert) {
|
|
249
253
|
const dateDir = join(this.baseLogsDir, todayDateString());
|
|
250
|
-
|
|
251
|
-
|
|
254
|
+
await mkdir(dateDir, { recursive: true });
|
|
255
|
+
await appendFile(join(dateDir, this.filename), `${JSON.stringify(alert)}
|
|
252
256
|
`, "utf-8");
|
|
253
257
|
}
|
|
254
258
|
};
|
|
@@ -2941,7 +2945,7 @@ function normalizeHost(host) {
|
|
|
2941
2945
|
}
|
|
2942
2946
|
|
|
2943
2947
|
// src/storage/memory-store.ts
|
|
2944
|
-
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
2948
|
+
import { mkdir as mkdir2, readFile, writeFile } from "fs/promises";
|
|
2945
2949
|
import { dirname as dirname2 } from "path";
|
|
2946
2950
|
function nowMs() {
|
|
2947
2951
|
return Date.now();
|
|
@@ -2985,7 +2989,7 @@ var MemoryStore = class {
|
|
|
2985
2989
|
trackedPayments: toRecord2(this.trackedPayments),
|
|
2986
2990
|
alerts: this.alerts
|
|
2987
2991
|
};
|
|
2988
|
-
await
|
|
2992
|
+
await mkdir2(dirname2(this.config.stateFilePath), { recursive: true });
|
|
2989
2993
|
await writeFile(this.config.stateFilePath, JSON.stringify(state, null, 2), "utf-8");
|
|
2990
2994
|
}
|
|
2991
2995
|
startAutoFlush() {
|
|
@@ -3130,7 +3134,7 @@ function isTerminalPaymentStatus2(status) {
|
|
|
3130
3134
|
|
|
3131
3135
|
// src/storage/sqlite-store.ts
|
|
3132
3136
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
3133
|
-
import { mkdirSync
|
|
3137
|
+
import { mkdirSync } from "fs";
|
|
3134
3138
|
import { dirname as dirname3 } from "path";
|
|
3135
3139
|
import Database from "better-sqlite3";
|
|
3136
3140
|
var MIGRATIONS = [
|
|
@@ -3174,7 +3178,7 @@ var MIGRATIONS = [
|
|
|
3174
3178
|
var SqliteJobStore = class {
|
|
3175
3179
|
db;
|
|
3176
3180
|
constructor(dbPath) {
|
|
3177
|
-
|
|
3181
|
+
mkdirSync(dirname3(dbPath), { recursive: true });
|
|
3178
3182
|
this.db = new Database(dbPath);
|
|
3179
3183
|
this.db.pragma("journal_mode = WAL");
|
|
3180
3184
|
this.db.pragma("foreign_keys = ON");
|