@workglow/storage 0.0.103 → 0.0.105
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/browser.js +570 -219
- package/dist/browser.js.map +13 -11
- package/dist/bun.js +671 -288
- package/dist/bun.js.map +15 -13
- package/dist/common.d.ts +2 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/credentials/EncryptedKvCredentialStore.d.ts +52 -0
- package/dist/credentials/EncryptedKvCredentialStore.d.ts.map +1 -0
- package/dist/node.js +671 -288
- package/dist/node.js.map +15 -13
- package/dist/tabular/BaseTabularStorage.d.ts +21 -7
- package/dist/tabular/BaseTabularStorage.d.ts.map +1 -1
- package/dist/tabular/CachedTabularStorage.d.ts +14 -10
- package/dist/tabular/CachedTabularStorage.d.ts.map +1 -1
- package/dist/tabular/FsFolderTabularStorage.d.ts +6 -6
- package/dist/tabular/FsFolderTabularStorage.d.ts.map +1 -1
- package/dist/tabular/HuggingFaceTabularStorage.d.ts +11 -6
- package/dist/tabular/HuggingFaceTabularStorage.d.ts.map +1 -1
- package/dist/tabular/ITabularStorage.d.ts +22 -3
- package/dist/tabular/ITabularStorage.d.ts.map +1 -1
- package/dist/tabular/InMemoryTabularStorage.d.ts +12 -10
- package/dist/tabular/InMemoryTabularStorage.d.ts.map +1 -1
- package/dist/tabular/IndexedDbTabularStorage.d.ts +12 -10
- package/dist/tabular/IndexedDbTabularStorage.d.ts.map +1 -1
- package/dist/tabular/PostgresTabularStorage.d.ts +12 -11
- package/dist/tabular/PostgresTabularStorage.d.ts.map +1 -1
- package/dist/tabular/SharedInMemoryTabularStorage.d.ts +12 -10
- package/dist/tabular/SharedInMemoryTabularStorage.d.ts.map +1 -1
- package/dist/tabular/SqliteTabularStorage.d.ts +12 -11
- package/dist/tabular/SqliteTabularStorage.d.ts.map +1 -1
- package/dist/tabular/StorageError.d.ts +31 -0
- package/dist/tabular/StorageError.d.ts.map +1 -0
- package/dist/tabular/SupabaseTabularStorage.d.ts +12 -10
- package/dist/tabular/SupabaseTabularStorage.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/common.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./tabular/CachedTabularStorage";
|
|
|
8
8
|
export * from "./tabular/HuggingFaceTabularStorage";
|
|
9
9
|
export * from "./tabular/InMemoryTabularStorage";
|
|
10
10
|
export * from "./tabular/ITabularStorage";
|
|
11
|
+
export * from "./tabular/StorageError";
|
|
11
12
|
export * from "./tabular/TabularStorageRegistry";
|
|
12
13
|
export * from "./kv/IKvStorage";
|
|
13
14
|
export * from "./kv/InMemoryKvStorage";
|
|
@@ -21,4 +22,5 @@ export * from "./util/HybridSubscriptionManager";
|
|
|
21
22
|
export * from "./util/PollingSubscriptionManager";
|
|
22
23
|
export * from "./vector/InMemoryVectorStorage";
|
|
23
24
|
export * from "./vector/IVectorStorage";
|
|
25
|
+
export * from "./credentials/EncryptedKvCredentialStore";
|
|
24
26
|
//# sourceMappingURL=common.d.ts.map
|
package/dist/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AAEjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AAEzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AAEpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAElD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AAEjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AAEzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AAEpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAElD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AAExC,cAAc,0CAA0C,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { CredentialPutOptions, ICredentialStore } from "@workglow/util";
|
|
7
|
+
import type { IKvStorage } from "../kv/IKvStorage";
|
|
8
|
+
/**
|
|
9
|
+
* Serialized form of a credential stored in the KV backend
|
|
10
|
+
*/
|
|
11
|
+
interface StoredCredential {
|
|
12
|
+
readonly encrypted: string;
|
|
13
|
+
readonly iv: string;
|
|
14
|
+
readonly label: string | undefined;
|
|
15
|
+
readonly provider: string | undefined;
|
|
16
|
+
readonly createdAt: string;
|
|
17
|
+
readonly updatedAt: string;
|
|
18
|
+
readonly expiresAt: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Credential store that encrypts values with AES-256-GCM before persisting
|
|
22
|
+
* them to an {@link IKvStorage} backend.
|
|
23
|
+
*
|
|
24
|
+
* Works with any KV backend (SQLite, PostgreSQL, IndexedDB, in-memory, etc.).
|
|
25
|
+
* Uses the Web Crypto API (available in Node 20+, Bun, and browsers).
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { SqliteKvStorage } from "@workglow/storage";
|
|
30
|
+
*
|
|
31
|
+
* const kv = new SqliteKvStorage(":memory:");
|
|
32
|
+
* const store = new EncryptedKvCredentialStore(kv, "my-encryption-key");
|
|
33
|
+
*
|
|
34
|
+
* await store.put("openai-api-key", "sk-...", { provider: "openai" });
|
|
35
|
+
* const key = await store.get("openai-api-key"); // "sk-..."
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare class EncryptedKvCredentialStore implements ICredentialStore {
|
|
39
|
+
private readonly kv;
|
|
40
|
+
private readonly passphrase;
|
|
41
|
+
/** Per-instance cache of derived CryptoKey instances keyed by base64(salt). */
|
|
42
|
+
private readonly keyCache;
|
|
43
|
+
constructor(kv: IKvStorage<string, StoredCredential>, passphrase: string);
|
|
44
|
+
get(key: string): Promise<string | undefined>;
|
|
45
|
+
put(key: string, value: string, options?: CredentialPutOptions): Promise<void>;
|
|
46
|
+
delete(key: string): Promise<boolean>;
|
|
47
|
+
has(key: string): Promise<boolean>;
|
|
48
|
+
keys(): Promise<readonly string[]>;
|
|
49
|
+
deleteAll(): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=EncryptedKvCredentialStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EncryptedKvCredentialStore.d.ts","sourceRoot":"","sources":["../../src/credentials/EncryptedKvCredentialStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAExB,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