@axiom-lattice/local-stores 3.2.5 → 3.2.6
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +7 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +49 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/LocalA2AApiKeyStore.test.ts +33 -4
- package/src/__tests__/LocalConnectionStore.test.ts +34 -4
- package/src/__tests__/LocalMcpServerConfigStore.test.ts +28 -0
- package/src/__tests__/LocalModelProviderStore.test.ts +65 -0
- package/src/stores/LocalA2AApiKeyStore.ts +2 -4
- package/src/stores/LocalConnectionStore.ts +45 -1
- package/src/stores/LocalMcpServerConfigStore.ts +9 -19
- package/src/stores/LocalModelProviderStore.ts +2 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/local-stores@3.2.
|
|
2
|
+
> @axiom-lattice/local-stores@3.2.6 build /home/runner/work/agentic/agentic/packages/local-stores
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2020
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
12
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m244.66 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m443.82 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 637ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m240.04 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m440.11 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 646ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 10963ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m45.28 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m45.28 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -468,6 +468,17 @@ declare class LocalConnectionStore implements ConnectionStore {
|
|
|
468
468
|
private db;
|
|
469
469
|
constructor(db: DatabaseWrapper);
|
|
470
470
|
private ensureColumn;
|
|
471
|
+
/**
|
|
472
|
+
* Re-encrypt declared secret fields that are still stored as plaintext.
|
|
473
|
+
*
|
|
474
|
+
* A plugin can mark a field as a secret after connections already exist (e.g.
|
|
475
|
+
* a field renamed from a plaintext key to a password), leaving legacy rows
|
|
476
|
+
* with plaintext where ciphertext is now expected. This one-time, idempotent
|
|
477
|
+
* pass encrypts any declared secret field that does not look like our
|
|
478
|
+
* ciphertext; values that do look encrypted are left untouched, so genuine
|
|
479
|
+
* ciphertext written under another key is never destroyed.
|
|
480
|
+
*/
|
|
481
|
+
private reencryptLegacySecrets;
|
|
471
482
|
listByTenant(tenantId: string): Promise<ConnectionEntry[]>;
|
|
472
483
|
listByType(tenantId: string, type: string): Promise<ConnectionEntry[]>;
|
|
473
484
|
getByKey(tenantId: string, type: string, key: string): Promise<ConnectionEntry | null>;
|
package/dist/index.d.ts
CHANGED
|
@@ -468,6 +468,17 @@ declare class LocalConnectionStore implements ConnectionStore {
|
|
|
468
468
|
private db;
|
|
469
469
|
constructor(db: DatabaseWrapper);
|
|
470
470
|
private ensureColumn;
|
|
471
|
+
/**
|
|
472
|
+
* Re-encrypt declared secret fields that are still stored as plaintext.
|
|
473
|
+
*
|
|
474
|
+
* A plugin can mark a field as a secret after connections already exist (e.g.
|
|
475
|
+
* a field renamed from a plaintext key to a password), leaving legacy rows
|
|
476
|
+
* with plaintext where ciphertext is now expected. This one-time, idempotent
|
|
477
|
+
* pass encrypts any declared secret field that does not look like our
|
|
478
|
+
* ciphertext; values that do look encrypted are left untouched, so genuine
|
|
479
|
+
* ciphertext written under another key is never destroyed.
|
|
480
|
+
*/
|
|
481
|
+
private reencryptLegacySecrets;
|
|
471
482
|
listByTenant(tenantId: string): Promise<ConnectionEntry[]>;
|
|
472
483
|
listByType(tenantId: string, type: string): Promise<ConnectionEntry[]>;
|
|
473
484
|
getByKey(tenantId: string, type: string, key: string): Promise<ConnectionEntry | null>;
|
package/dist/index.js
CHANGED
|
@@ -2108,6 +2108,7 @@ var LocalConnectionStore = class {
|
|
|
2108
2108
|
this.db = db;
|
|
2109
2109
|
ensureTable(db, DDL9);
|
|
2110
2110
|
this.ensureColumn("connection_configs", "secret_fields", "secret_fields TEXT");
|
|
2111
|
+
this.reencryptLegacySecrets();
|
|
2111
2112
|
}
|
|
2112
2113
|
ensureColumn(table, column, ddl2) {
|
|
2113
2114
|
const cols = this.db.prepare(`PRAGMA table_info(${table})`).all();
|
|
@@ -2115,6 +2116,44 @@ var LocalConnectionStore = class {
|
|
|
2115
2116
|
this.db.exec(`ALTER TABLE ${table} ADD COLUMN ${ddl2}`);
|
|
2116
2117
|
}
|
|
2117
2118
|
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Re-encrypt declared secret fields that are still stored as plaintext.
|
|
2121
|
+
*
|
|
2122
|
+
* A plugin can mark a field as a secret after connections already exist (e.g.
|
|
2123
|
+
* a field renamed from a plaintext key to a password), leaving legacy rows
|
|
2124
|
+
* with plaintext where ciphertext is now expected. This one-time, idempotent
|
|
2125
|
+
* pass encrypts any declared secret field that does not look like our
|
|
2126
|
+
* ciphertext; values that do look encrypted are left untouched, so genuine
|
|
2127
|
+
* ciphertext written under another key is never destroyed.
|
|
2128
|
+
*/
|
|
2129
|
+
reencryptLegacySecrets() {
|
|
2130
|
+
const rows2 = this.db.prepare(
|
|
2131
|
+
`SELECT id, tenant_id, config, secret_fields FROM connection_configs WHERE secret_fields IS NOT NULL`
|
|
2132
|
+
).all();
|
|
2133
|
+
for (const row of rows2) {
|
|
2134
|
+
const secretFields = parseSecretFields(row.secret_fields);
|
|
2135
|
+
if (!secretFields?.length) continue;
|
|
2136
|
+
let config;
|
|
2137
|
+
try {
|
|
2138
|
+
config = JSON.parse(row.config);
|
|
2139
|
+
} catch {
|
|
2140
|
+
continue;
|
|
2141
|
+
}
|
|
2142
|
+
let changed = false;
|
|
2143
|
+
for (const field of secretFields) {
|
|
2144
|
+
const value = config[field];
|
|
2145
|
+
if (typeof value === "string" && value.length > 0 && !(0, import_core2.isEncryptedValue)(value)) {
|
|
2146
|
+
config[field] = (0, import_core2.encrypt)(value);
|
|
2147
|
+
changed = true;
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
if (changed) {
|
|
2151
|
+
this.db.prepare(
|
|
2152
|
+
`UPDATE connection_configs SET config = ?, updated_at = ? WHERE tenant_id = ? AND id = ?`
|
|
2153
|
+
).run(JSON.stringify(config), nowISO(), row.tenant_id, row.id);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2118
2157
|
async listByTenant(tenantId) {
|
|
2119
2158
|
const rows2 = this.db.prepare(
|
|
2120
2159
|
`SELECT * FROM connection_configs WHERE tenant_id = ? ORDER BY created_at`
|
|
@@ -2480,28 +2519,18 @@ var LocalMcpServerConfigStore = class {
|
|
|
2480
2519
|
function mapRowToEntry3(row) {
|
|
2481
2520
|
const config = JSON.parse(row.config);
|
|
2482
2521
|
if (config.env && row.is_env_encrypted) {
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
decryptedEnv[key] = (0, import_core3.decrypt)(value);
|
|
2487
|
-
}
|
|
2488
|
-
config.env = decryptedEnv;
|
|
2489
|
-
} catch (error) {
|
|
2490
|
-
console.error("Failed to decrypt MCP server env:", error);
|
|
2491
|
-
throw new Error("Failed to decrypt MCP server configuration");
|
|
2522
|
+
const decryptedEnv = {};
|
|
2523
|
+
for (const [key, value] of Object.entries(config.env)) {
|
|
2524
|
+
decryptedEnv[key] = (0, import_core3.safeDecrypt)(value);
|
|
2492
2525
|
}
|
|
2526
|
+
config.env = decryptedEnv;
|
|
2493
2527
|
}
|
|
2494
2528
|
if (config.headers && row.is_env_encrypted) {
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
decryptedHeaders[key] = (0, import_core3.decrypt)(value);
|
|
2499
|
-
}
|
|
2500
|
-
config.headers = decryptedHeaders;
|
|
2501
|
-
} catch (error) {
|
|
2502
|
-
console.error("Failed to decrypt MCP server headers:", error);
|
|
2503
|
-
throw new Error("Failed to decrypt MCP server configuration");
|
|
2529
|
+
const decryptedHeaders = {};
|
|
2530
|
+
for (const [key, value] of Object.entries(config.headers)) {
|
|
2531
|
+
decryptedHeaders[key] = (0, import_core3.safeDecrypt)(value);
|
|
2504
2532
|
}
|
|
2533
|
+
config.headers = decryptedHeaders;
|
|
2505
2534
|
}
|
|
2506
2535
|
return {
|
|
2507
2536
|
id: row.id,
|
|
@@ -2817,12 +2846,7 @@ var LocalModelProviderStore = class {
|
|
|
2817
2846
|
function mapRowToEntry4(row) {
|
|
2818
2847
|
let apiKey;
|
|
2819
2848
|
if (row.api_key_enc) {
|
|
2820
|
-
|
|
2821
|
-
apiKey = (0, import_core4.decrypt)(row.api_key_enc);
|
|
2822
|
-
} catch (error) {
|
|
2823
|
-
console.error("Failed to decrypt model provider API key:", error);
|
|
2824
|
-
throw new Error("Failed to decrypt model provider API key");
|
|
2825
|
-
}
|
|
2849
|
+
apiKey = (0, import_core4.safeDecrypt)(row.api_key_enc);
|
|
2826
2850
|
}
|
|
2827
2851
|
return {
|
|
2828
2852
|
id: row.id,
|
|
@@ -4488,15 +4512,9 @@ var LocalA2AApiKeyStore = class {
|
|
|
4488
4512
|
}
|
|
4489
4513
|
};
|
|
4490
4514
|
function mapRowToRecord(row) {
|
|
4491
|
-
let key = "";
|
|
4492
|
-
try {
|
|
4493
|
-
key = (0, import_core5.decrypt)(row.key_value);
|
|
4494
|
-
} catch {
|
|
4495
|
-
key = row.key_value;
|
|
4496
|
-
}
|
|
4497
4515
|
return {
|
|
4498
4516
|
id: row.id,
|
|
4499
|
-
key,
|
|
4517
|
+
key: (0, import_core5.safeDecrypt)(row.key_value),
|
|
4500
4518
|
tenantId: row.tenant_id,
|
|
4501
4519
|
projectId: row.project_id,
|
|
4502
4520
|
assistantIds: parseAssistantIds(row.assistant_ids),
|