@agenticmail/core 0.7.0 → 0.7.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.
- package/dist/index.cjs +10 -7
- package/dist/index.d.cts +3 -33
- package/dist/index.d.ts +3 -33
- package/dist/index.js +6 -4
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3190,13 +3190,16 @@ function buildInboundSecurityAdvisory(security, attachments) {
|
|
|
3190
3190
|
}
|
|
3191
3191
|
|
|
3192
3192
|
// src/storage/db.ts
|
|
3193
|
-
var
|
|
3193
|
+
var import_node_module = require("module");
|
|
3194
|
+
var import_meta = {};
|
|
3195
|
+
var require2 = (0, import_node_module.createRequire)(import_meta.url);
|
|
3196
|
+
var { DatabaseSync } = require2("node:sqlite");
|
|
3194
3197
|
var db = null;
|
|
3195
3198
|
function getDatabase(config) {
|
|
3196
3199
|
if (db) return db;
|
|
3197
3200
|
ensureDataDir(config);
|
|
3198
3201
|
const dbPath = `${config.dataDir}/agenticmail.db`;
|
|
3199
|
-
db = new
|
|
3202
|
+
db = new DatabaseSync(dbPath);
|
|
3200
3203
|
db.exec("PRAGMA journal_mode = WAL");
|
|
3201
3204
|
db.exec("PRAGMA foreign_keys = ON");
|
|
3202
3205
|
runMigrations(db);
|
|
@@ -3490,7 +3493,7 @@ function runMigrations(database) {
|
|
|
3490
3493
|
}
|
|
3491
3494
|
}
|
|
3492
3495
|
function createTestDatabase() {
|
|
3493
|
-
const testDb = new
|
|
3496
|
+
const testDb = new DatabaseSync(":memory:");
|
|
3494
3497
|
testDb.exec("PRAGMA journal_mode = WAL");
|
|
3495
3498
|
testDb.exec("PRAGMA foreign_keys = ON");
|
|
3496
3499
|
for (const sql of Object.values(MIGRATIONS)) {
|
|
@@ -7171,8 +7174,8 @@ var import_node_child_process4 = require("child_process");
|
|
|
7171
7174
|
var import_node_fs6 = require("fs");
|
|
7172
7175
|
var import_node_path7 = require("path");
|
|
7173
7176
|
var import_node_os6 = require("os");
|
|
7174
|
-
var
|
|
7175
|
-
var
|
|
7177
|
+
var import_node_module2 = require("module");
|
|
7178
|
+
var import_meta2 = {};
|
|
7176
7179
|
var PLIST_LABEL = "com.agenticmail.server";
|
|
7177
7180
|
var SYSTEMD_UNIT = "agenticmail.service";
|
|
7178
7181
|
var ServiceManager = class {
|
|
@@ -7216,7 +7219,7 @@ var ServiceManager = class {
|
|
|
7216
7219
|
*/
|
|
7217
7220
|
getApiEntryPath() {
|
|
7218
7221
|
try {
|
|
7219
|
-
const req = (0,
|
|
7222
|
+
const req = (0, import_node_module2.createRequire)(import_meta2.url);
|
|
7220
7223
|
const resolved = req.resolve("@agenticmail/api");
|
|
7221
7224
|
if ((0, import_node_fs6.existsSync)(resolved)) return resolved;
|
|
7222
7225
|
} catch {
|
|
@@ -7272,7 +7275,7 @@ var ServiceManager = class {
|
|
|
7272
7275
|
*/
|
|
7273
7276
|
getVersion() {
|
|
7274
7277
|
try {
|
|
7275
|
-
const req = (0,
|
|
7278
|
+
const req = (0, import_node_module2.createRequire)(import_meta2.url);
|
|
7276
7279
|
const pkgJson = req.resolve("@agenticmail/cli/package.json");
|
|
7277
7280
|
if ((0, import_node_fs6.existsSync)(pkgJson)) {
|
|
7278
7281
|
const pkg = JSON.parse((0, import_node_fs6.readFileSync)(pkgJson, "utf-8"));
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
-
import
|
|
2
|
+
import * as node_sqlite from 'node:sqlite';
|
|
3
3
|
import { ImapFlow } from 'imapflow';
|
|
4
4
|
|
|
5
5
|
interface SendMailOptions {
|
|
@@ -291,38 +291,8 @@ declare class StalwartAdmin {
|
|
|
291
291
|
}): Promise<void>;
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
*
|
|
297
|
-
* Migrated from `better-sqlite3` to Node's built-in `node:sqlite` module
|
|
298
|
-
* (stable since Node 22). The migration eliminates native compilation
|
|
299
|
-
* entirely — `better-sqlite3` ships pre-built binaries per
|
|
300
|
-
* NODE_MODULE_VERSION and intermittently lags new Node releases (Node
|
|
301
|
-
* 25.5.0 was a real example: prebuilds missing, node-gyp fails on the
|
|
302
|
-
* fallback compile-from-source path, fresh `npm install -g
|
|
303
|
-
* @agenticmail/cli` fails for users on bleeding-edge Node). `node:sqlite`
|
|
304
|
-
* is part of Node itself, so by definition it always matches the
|
|
305
|
-
* runtime — no prebuilds, no gyp, no binding errors.
|
|
306
|
-
*
|
|
307
|
-
* # API shape differences this file accommodates
|
|
308
|
-
*
|
|
309
|
-
* - `new DatabaseSync(path)` instead of `new Database(path)`.
|
|
310
|
-
* - No `db.pragma(x)` — use `db.exec("PRAGMA " + x)`.
|
|
311
|
-
* - No `db.transaction(fn)` — wrap in BEGIN/COMMIT manually (see
|
|
312
|
-
* `runTransactionally` below). Migrations are the only transaction
|
|
313
|
-
* site in core right now; if more callers need transactions later
|
|
314
|
-
* they should reuse the same helper.
|
|
315
|
-
* - `stmt.run(...)` still returns `{ changes, lastInsertRowid }`.
|
|
316
|
-
* One subtle gotcha: `lastInsertRowid` is a `bigint` in node:sqlite
|
|
317
|
-
* where better-sqlite3 returned a `number`. Consumers that compare
|
|
318
|
-
* with `===` or pass it to `Number(...)` need to be aware, but no
|
|
319
|
-
* site inside AgenticMail today does that — all our rowids are
|
|
320
|
-
* opaque or string-typed.
|
|
321
|
-
* - The class type is `DatabaseSync`; we re-export it as `Database`
|
|
322
|
-
* so consumer files can keep saying `Database` instead of plumbing
|
|
323
|
-
* `DatabaseSync` through everywhere.
|
|
324
|
-
*/
|
|
325
|
-
|
|
294
|
+
declare const DatabaseSync: typeof node_sqlite.DatabaseSync;
|
|
295
|
+
type DatabaseSync = InstanceType<typeof node_sqlite.DatabaseSync>;
|
|
326
296
|
/**
|
|
327
297
|
* Public type alias for the database instance. Consumers should
|
|
328
298
|
* `import { type Database } from '@agenticmail/core'` rather than
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
-
import
|
|
2
|
+
import * as node_sqlite from 'node:sqlite';
|
|
3
3
|
import { ImapFlow } from 'imapflow';
|
|
4
4
|
|
|
5
5
|
interface SendMailOptions {
|
|
@@ -291,38 +291,8 @@ declare class StalwartAdmin {
|
|
|
291
291
|
}): Promise<void>;
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
*
|
|
297
|
-
* Migrated from `better-sqlite3` to Node's built-in `node:sqlite` module
|
|
298
|
-
* (stable since Node 22). The migration eliminates native compilation
|
|
299
|
-
* entirely — `better-sqlite3` ships pre-built binaries per
|
|
300
|
-
* NODE_MODULE_VERSION and intermittently lags new Node releases (Node
|
|
301
|
-
* 25.5.0 was a real example: prebuilds missing, node-gyp fails on the
|
|
302
|
-
* fallback compile-from-source path, fresh `npm install -g
|
|
303
|
-
* @agenticmail/cli` fails for users on bleeding-edge Node). `node:sqlite`
|
|
304
|
-
* is part of Node itself, so by definition it always matches the
|
|
305
|
-
* runtime — no prebuilds, no gyp, no binding errors.
|
|
306
|
-
*
|
|
307
|
-
* # API shape differences this file accommodates
|
|
308
|
-
*
|
|
309
|
-
* - `new DatabaseSync(path)` instead of `new Database(path)`.
|
|
310
|
-
* - No `db.pragma(x)` — use `db.exec("PRAGMA " + x)`.
|
|
311
|
-
* - No `db.transaction(fn)` — wrap in BEGIN/COMMIT manually (see
|
|
312
|
-
* `runTransactionally` below). Migrations are the only transaction
|
|
313
|
-
* site in core right now; if more callers need transactions later
|
|
314
|
-
* they should reuse the same helper.
|
|
315
|
-
* - `stmt.run(...)` still returns `{ changes, lastInsertRowid }`.
|
|
316
|
-
* One subtle gotcha: `lastInsertRowid` is a `bigint` in node:sqlite
|
|
317
|
-
* where better-sqlite3 returned a `number`. Consumers that compare
|
|
318
|
-
* with `===` or pass it to `Number(...)` need to be aware, but no
|
|
319
|
-
* site inside AgenticMail today does that — all our rowids are
|
|
320
|
-
* opaque or string-typed.
|
|
321
|
-
* - The class type is `DatabaseSync`; we re-export it as `Database`
|
|
322
|
-
* so consumer files can keep saying `Database` instead of plumbing
|
|
323
|
-
* `DatabaseSync` through everywhere.
|
|
324
|
-
*/
|
|
325
|
-
|
|
294
|
+
declare const DatabaseSync: typeof node_sqlite.DatabaseSync;
|
|
295
|
+
type DatabaseSync = InstanceType<typeof node_sqlite.DatabaseSync>;
|
|
326
296
|
/**
|
|
327
297
|
* Public type alias for the database instance. Consumers should
|
|
328
298
|
* `import { type Database } from '@agenticmail/core'` rather than
|
package/dist/index.js
CHANGED
|
@@ -2433,7 +2433,9 @@ function buildInboundSecurityAdvisory(security, attachments) {
|
|
|
2433
2433
|
}
|
|
2434
2434
|
|
|
2435
2435
|
// src/storage/db.ts
|
|
2436
|
-
import {
|
|
2436
|
+
import { createRequire } from "module";
|
|
2437
|
+
var require2 = createRequire(import.meta.url);
|
|
2438
|
+
var { DatabaseSync } = require2("node:sqlite");
|
|
2437
2439
|
var db = null;
|
|
2438
2440
|
function getDatabase(config) {
|
|
2439
2441
|
if (db) return db;
|
|
@@ -6413,7 +6415,7 @@ import { execFileSync as execFileSync3, execSync as execSync2 } from "child_proc
|
|
|
6413
6415
|
import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync4, unlinkSync, mkdirSync as mkdirSync5, chmodSync } from "fs";
|
|
6414
6416
|
import { join as join8 } from "path";
|
|
6415
6417
|
import { homedir as homedir7, platform as platform4 } from "os";
|
|
6416
|
-
import { createRequire } from "module";
|
|
6418
|
+
import { createRequire as createRequire2 } from "module";
|
|
6417
6419
|
var PLIST_LABEL = "com.agenticmail.server";
|
|
6418
6420
|
var SYSTEMD_UNIT = "agenticmail.service";
|
|
6419
6421
|
var ServiceManager = class {
|
|
@@ -6457,7 +6459,7 @@ var ServiceManager = class {
|
|
|
6457
6459
|
*/
|
|
6458
6460
|
getApiEntryPath() {
|
|
6459
6461
|
try {
|
|
6460
|
-
const req =
|
|
6462
|
+
const req = createRequire2(import.meta.url);
|
|
6461
6463
|
const resolved = req.resolve("@agenticmail/api");
|
|
6462
6464
|
if (existsSync6(resolved)) return resolved;
|
|
6463
6465
|
} catch {
|
|
@@ -6513,7 +6515,7 @@ var ServiceManager = class {
|
|
|
6513
6515
|
*/
|
|
6514
6516
|
getVersion() {
|
|
6515
6517
|
try {
|
|
6516
|
-
const req =
|
|
6518
|
+
const req = createRequire2(import.meta.url);
|
|
6517
6519
|
const pkgJson = req.resolve("@agenticmail/cli/package.json");
|
|
6518
6520
|
if (existsSync6(pkgJson)) {
|
|
6519
6521
|
const pkg = JSON.parse(readFileSync3(pkgJson, "utf-8"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agenticmail/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Core SDK for AgenticMail — email, SMS, and phone number access for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"LICENSE"
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
|
-
"build": "tsup
|
|
24
|
-
"dev": "tsup
|
|
23
|
+
"build": "tsup --config tsup.config.ts",
|
|
24
|
+
"dev": "tsup --config tsup.config.ts --watch",
|
|
25
25
|
"test": "vitest run",
|
|
26
26
|
"test:watch": "vitest",
|
|
27
27
|
"prepublishOnly": "npm run build"
|