@dexto/storage 1.6.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/LICENSE +44 -0
- package/README.md +80 -0
- package/dist/blob/factories/index.cjs +31 -0
- package/dist/blob/factories/index.d.cts +6 -0
- package/dist/blob/factories/index.d.ts +6 -0
- package/dist/blob/factories/index.d.ts.map +1 -0
- package/dist/blob/factories/index.js +6 -0
- package/dist/blob/factories/local.cjs +38 -0
- package/dist/blob/factories/local.d.cts +21 -0
- package/dist/blob/factories/local.d.ts +17 -0
- package/dist/blob/factories/local.d.ts.map +1 -0
- package/dist/blob/factories/local.js +14 -0
- package/dist/blob/factories/memory.cjs +44 -0
- package/dist/blob/factories/memory.d.cts +21 -0
- package/dist/blob/factories/memory.d.ts +17 -0
- package/dist/blob/factories/memory.d.ts.map +1 -0
- package/dist/blob/factories/memory.js +20 -0
- package/dist/blob/factory.cjs +16 -0
- package/dist/blob/factory.d.cts +36 -0
- package/dist/blob/factory.d.ts +35 -0
- package/dist/blob/factory.d.ts.map +1 -0
- package/dist/blob/factory.js +0 -0
- package/dist/blob/index.cjs +45 -0
- package/dist/blob/index.d.cts +8 -0
- package/dist/blob/index.d.ts +26 -0
- package/dist/blob/index.d.ts.map +1 -0
- package/dist/blob/index.js +19 -0
- package/dist/blob/local-blob-store.cjs +532 -0
- package/dist/blob/local-blob-store.d.cts +56 -0
- package/dist/blob/local-blob-store.d.ts +54 -0
- package/dist/blob/local-blob-store.d.ts.map +1 -0
- package/dist/blob/local-blob-store.js +498 -0
- package/dist/blob/memory-blob-store.cjs +327 -0
- package/dist/blob/memory-blob-store.d.cts +69 -0
- package/dist/blob/memory-blob-store.d.ts +67 -0
- package/dist/blob/memory-blob-store.d.ts.map +1 -0
- package/dist/blob/memory-blob-store.js +303 -0
- package/dist/blob/schemas.cjs +52 -0
- package/dist/blob/schemas.d.cts +87 -0
- package/dist/blob/schemas.d.ts +86 -0
- package/dist/blob/schemas.d.ts.map +1 -0
- package/dist/blob/schemas.js +25 -0
- package/dist/blob/types.cjs +16 -0
- package/dist/blob/types.d.cts +1 -0
- package/dist/blob/types.d.ts +2 -0
- package/dist/blob/types.d.ts.map +1 -0
- package/dist/blob/types.js +0 -0
- package/dist/cache/factories/index.cjs +31 -0
- package/dist/cache/factories/index.d.cts +6 -0
- package/dist/cache/factories/index.d.ts +6 -0
- package/dist/cache/factories/index.d.ts.map +1 -0
- package/dist/cache/factories/index.js +6 -0
- package/dist/cache/factories/memory.cjs +39 -0
- package/dist/cache/factories/memory.d.cts +21 -0
- package/dist/cache/factories/memory.d.ts +17 -0
- package/dist/cache/factories/memory.d.ts.map +1 -0
- package/dist/cache/factories/memory.js +15 -0
- package/dist/cache/factories/redis.cjs +65 -0
- package/dist/cache/factories/redis.d.cts +24 -0
- package/dist/cache/factories/redis.d.ts +20 -0
- package/dist/cache/factories/redis.d.ts.map +1 -0
- package/dist/cache/factories/redis.js +31 -0
- package/dist/cache/factory.cjs +16 -0
- package/dist/cache/factory.d.cts +42 -0
- package/dist/cache/factory.d.ts +41 -0
- package/dist/cache/factory.d.ts.map +1 -0
- package/dist/cache/factory.js +0 -0
- package/dist/cache/index.cjs +42 -0
- package/dist/cache/index.d.cts +7 -0
- package/dist/cache/index.d.ts +25 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +17 -0
- package/dist/cache/memory-cache-store.cjs +106 -0
- package/dist/cache/memory-cache-store.d.cts +27 -0
- package/dist/cache/memory-cache-store.d.ts +25 -0
- package/dist/cache/memory-cache-store.d.ts.map +1 -0
- package/dist/cache/memory-cache-store.js +82 -0
- package/dist/cache/redis-store.cjs +176 -0
- package/dist/cache/redis-store.d.cts +34 -0
- package/dist/cache/redis-store.d.ts +32 -0
- package/dist/cache/redis-store.d.ts.map +1 -0
- package/dist/cache/redis-store.js +152 -0
- package/dist/cache/schemas.cjs +70 -0
- package/dist/cache/schemas.d.cts +93 -0
- package/dist/cache/schemas.d.ts +91 -0
- package/dist/cache/schemas.d.ts.map +1 -0
- package/dist/cache/schemas.js +43 -0
- package/dist/cache/types.cjs +16 -0
- package/dist/cache/types.d.cts +1 -0
- package/dist/cache/types.d.ts +2 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cache/types.js +0 -0
- package/dist/database/factories/index.cjs +34 -0
- package/dist/database/factories/index.d.cts +7 -0
- package/dist/database/factories/index.d.ts +7 -0
- package/dist/database/factories/index.d.ts.map +1 -0
- package/dist/database/factories/index.js +8 -0
- package/dist/database/factories/memory.cjs +39 -0
- package/dist/database/factories/memory.d.cts +20 -0
- package/dist/database/factories/memory.d.ts +16 -0
- package/dist/database/factories/memory.d.ts.map +1 -0
- package/dist/database/factories/memory.js +15 -0
- package/dist/database/factories/postgres.cjs +61 -0
- package/dist/database/factories/postgres.d.cts +23 -0
- package/dist/database/factories/postgres.d.ts +19 -0
- package/dist/database/factories/postgres.d.ts.map +1 -0
- package/dist/database/factories/postgres.js +27 -0
- package/dist/database/factories/sqlite.cjs +65 -0
- package/dist/database/factories/sqlite.d.cts +24 -0
- package/dist/database/factories/sqlite.d.ts +20 -0
- package/dist/database/factories/sqlite.d.ts.map +1 -0
- package/dist/database/factories/sqlite.js +31 -0
- package/dist/database/factory.cjs +16 -0
- package/dist/database/factory.d.cts +42 -0
- package/dist/database/factory.d.ts +41 -0
- package/dist/database/factory.d.ts.map +1 -0
- package/dist/database/factory.js +0 -0
- package/dist/database/index.cjs +46 -0
- package/dist/database/index.d.cts +8 -0
- package/dist/database/index.d.ts +26 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +24 -0
- package/dist/database/memory-database-store.cjs +121 -0
- package/dist/database/memory-database-store.d.cts +30 -0
- package/dist/database/memory-database-store.d.ts +28 -0
- package/dist/database/memory-database-store.d.ts.map +1 -0
- package/dist/database/memory-database-store.js +97 -0
- package/dist/database/postgres-store.cjs +342 -0
- package/dist/database/postgres-store.d.cts +57 -0
- package/dist/database/postgres-store.d.ts +55 -0
- package/dist/database/postgres-store.d.ts.map +1 -0
- package/dist/database/postgres-store.js +318 -0
- package/dist/database/schemas.cjs +82 -0
- package/dist/database/schemas.d.cts +127 -0
- package/dist/database/schemas.d.ts +125 -0
- package/dist/database/schemas.d.ts.map +1 -0
- package/dist/database/schemas.js +54 -0
- package/dist/database/sqlite-store.cjs +270 -0
- package/dist/database/sqlite-store.d.cts +35 -0
- package/dist/database/sqlite-store.d.ts +33 -0
- package/dist/database/sqlite-store.d.ts.map +1 -0
- package/dist/database/sqlite-store.js +236 -0
- package/dist/database/types.cjs +16 -0
- package/dist/database/types.d.cts +1 -0
- package/dist/database/types.d.ts +2 -0
- package/dist/database/types.d.ts.map +1 -0
- package/dist/database/types.js +0 -0
- package/dist/index.cjs +82 -0
- package/dist/index.d.cts +24 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +50 -0
- package/dist/schemas.cjs +67 -0
- package/dist/schemas.d.cts +72 -0
- package/dist/schemas.d.ts +70 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +46 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Elastic License 2.0 (ELv2)
|
|
2
|
+
|
|
3
|
+
**Acceptance**
|
|
4
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
5
|
+
|
|
6
|
+
**Copyright License**
|
|
7
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
|
|
8
|
+
|
|
9
|
+
**Limitations**
|
|
10
|
+
You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
|
|
11
|
+
|
|
12
|
+
You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
|
|
13
|
+
|
|
14
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
15
|
+
|
|
16
|
+
**Patents**
|
|
17
|
+
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
18
|
+
|
|
19
|
+
**Notices**
|
|
20
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
21
|
+
|
|
22
|
+
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
23
|
+
|
|
24
|
+
**No Other Rights**
|
|
25
|
+
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
26
|
+
|
|
27
|
+
**Termination**
|
|
28
|
+
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
29
|
+
|
|
30
|
+
**No Liability**
|
|
31
|
+
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
|
|
32
|
+
|
|
33
|
+
**Definitions**
|
|
34
|
+
The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
|
|
35
|
+
|
|
36
|
+
_you_ refers to the individual or entity agreeing to these terms.
|
|
37
|
+
|
|
38
|
+
_your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
39
|
+
|
|
40
|
+
_your licenses_ are all the licenses granted to you for the software under these terms.
|
|
41
|
+
|
|
42
|
+
_use_ means anything you do with the software requiring one of your licenses.
|
|
43
|
+
|
|
44
|
+
_trademark_ means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# `@dexto/storage`
|
|
2
|
+
|
|
3
|
+
Concrete storage backends (blob store, database, cache) and their config schemas/factories.
|
|
4
|
+
|
|
5
|
+
Core (`@dexto/core`) owns the **interfaces** (`BlobStore`, `Database`, `Cache`) and `StorageManager`.
|
|
6
|
+
Product layers (CLI/server/apps) choose which concrete backends are available by including factories
|
|
7
|
+
in an image (`DextoImage.storage.*`) and resolving config via `@dexto/agent-config`.
|
|
8
|
+
|
|
9
|
+
## What this package exports
|
|
10
|
+
|
|
11
|
+
- **Factories** (for image modules):
|
|
12
|
+
- Blob: `localBlobStoreFactory`, `inMemoryBlobStoreFactory`
|
|
13
|
+
- Database: `sqliteDatabaseFactory`, `postgresDatabaseFactory`, `inMemoryDatabaseFactory`
|
|
14
|
+
- Cache: `inMemoryCacheFactory`, `redisCacheFactory`
|
|
15
|
+
- **Schemas** (for config parsing + UI):
|
|
16
|
+
- Import from `@dexto/storage/schemas` for browser-safe schema-only exports.
|
|
17
|
+
- **Concrete implementations** (Node runtime):
|
|
18
|
+
- `LocalBlobStore`, `MemoryBlobStore`, `SQLiteStore`, `PostgresStore`, `RedisStore`, etc.
|
|
19
|
+
|
|
20
|
+
## Using factories in an image
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import type { DextoImage } from '@dexto/agent-config';
|
|
24
|
+
import {
|
|
25
|
+
localBlobStoreFactory,
|
|
26
|
+
sqliteDatabaseFactory,
|
|
27
|
+
inMemoryCacheFactory,
|
|
28
|
+
} from '@dexto/storage';
|
|
29
|
+
|
|
30
|
+
export const myImage: DextoImage = {
|
|
31
|
+
/* metadata/defaults/tools/hooks/compaction/logger ... */
|
|
32
|
+
storage: {
|
|
33
|
+
blob: { local: localBlobStoreFactory },
|
|
34
|
+
database: { sqlite: sqliteDatabaseFactory },
|
|
35
|
+
cache: { 'in-memory': inMemoryCacheFactory },
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Schemas and `.passthrough()`
|
|
41
|
+
|
|
42
|
+
Agent config parsing needs to accept **custom** backends with provider-specific fields, so the
|
|
43
|
+
top-level storage config schemas are *envelopes* that validate only the discriminator:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
storage:
|
|
47
|
+
blob:
|
|
48
|
+
type: local
|
|
49
|
+
storePath: ./data/blobs
|
|
50
|
+
database:
|
|
51
|
+
type: sqlite
|
|
52
|
+
path: ./data/agent.db
|
|
53
|
+
cache:
|
|
54
|
+
type: in-memory
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Those envelope schemas use `.passthrough()` so extra fields survive initial parsing. Detailed
|
|
58
|
+
validation happens later in `@dexto/agent-config` by selecting the right factory from the loaded
|
|
59
|
+
image and validating against that factory’s `configSchema`.
|
|
60
|
+
|
|
61
|
+
## Optional dependencies
|
|
62
|
+
|
|
63
|
+
Some backends rely on optional peer dependencies:
|
|
64
|
+
|
|
65
|
+
- SQLite: `better-sqlite3`
|
|
66
|
+
- Postgres: `pg`
|
|
67
|
+
- Redis: `ioredis`
|
|
68
|
+
|
|
69
|
+
Factories load these lazily and throw an actionable error if the dependency is missing.
|
|
70
|
+
|
|
71
|
+
## Browser safety
|
|
72
|
+
|
|
73
|
+
If you only need schemas/types (e.g., WebUI), import from:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { StorageSchema } from '@dexto/storage/schemas';
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Do not import from `@dexto/storage` in browser bundles, since the root entry also exports Node
|
|
80
|
+
implementations.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var factories_exports = {};
|
|
20
|
+
__export(factories_exports, {
|
|
21
|
+
inMemoryBlobStoreFactory: () => import_memory.inMemoryBlobStoreFactory,
|
|
22
|
+
localBlobStoreFactory: () => import_local.localBlobStoreFactory
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(factories_exports);
|
|
25
|
+
var import_local = require("./local.js");
|
|
26
|
+
var import_memory = require("./memory.js");
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
inMemoryBlobStoreFactory,
|
|
30
|
+
localBlobStoreFactory
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/blob/factories/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var local_exports = {};
|
|
20
|
+
__export(local_exports, {
|
|
21
|
+
localBlobStoreFactory: () => localBlobStoreFactory
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(local_exports);
|
|
24
|
+
var import_schemas = require("../schemas.js");
|
|
25
|
+
var import_local_blob_store = require("../local-blob-store.js");
|
|
26
|
+
const localBlobStoreFactory = {
|
|
27
|
+
configSchema: import_schemas.LocalBlobStoreSchema,
|
|
28
|
+
create: (config, logger) => new import_local_blob_store.LocalBlobStore(config, logger),
|
|
29
|
+
metadata: {
|
|
30
|
+
displayName: "Local Filesystem",
|
|
31
|
+
description: "Store blobs on the local filesystem with automatic deduplication",
|
|
32
|
+
requiresNetwork: false
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
localBlobStoreFactory
|
|
38
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LocalBlobStoreConfig } from '../schemas.cjs';
|
|
2
|
+
import { BlobStoreFactory } from '../factory.cjs';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import '@dexto/core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Factory for local filesystem blob storage.
|
|
8
|
+
*
|
|
9
|
+
* This factory stores blobs on the local filesystem with content-based
|
|
10
|
+
* deduplication and metadata tracking. It's ideal for development and
|
|
11
|
+
* single-machine deployments.
|
|
12
|
+
*
|
|
13
|
+
* Features:
|
|
14
|
+
* - Zero external dependencies (uses Node.js fs module)
|
|
15
|
+
* - Content-based deduplication (same hash = same blob)
|
|
16
|
+
* - Automatic cleanup of old blobs
|
|
17
|
+
* - No network required
|
|
18
|
+
*/
|
|
19
|
+
declare const localBlobStoreFactory: BlobStoreFactory<LocalBlobStoreConfig>;
|
|
20
|
+
|
|
21
|
+
export { localBlobStoreFactory };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LocalBlobStoreConfig } from '../schemas.js';
|
|
2
|
+
import type { BlobStoreFactory } from '../factory.js';
|
|
3
|
+
/**
|
|
4
|
+
* Factory for local filesystem blob storage.
|
|
5
|
+
*
|
|
6
|
+
* This factory stores blobs on the local filesystem with content-based
|
|
7
|
+
* deduplication and metadata tracking. It's ideal for development and
|
|
8
|
+
* single-machine deployments.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Zero external dependencies (uses Node.js fs module)
|
|
12
|
+
* - Content-based deduplication (same hash = same blob)
|
|
13
|
+
* - Automatic cleanup of old blobs
|
|
14
|
+
* - No network required
|
|
15
|
+
*/
|
|
16
|
+
export declare const localBlobStoreFactory: BlobStoreFactory<LocalBlobStoreConfig>;
|
|
17
|
+
//# sourceMappingURL=local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/blob/factories/local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAAC,oBAAoB,CAQxE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LocalBlobStoreSchema } from "../schemas.js";
|
|
2
|
+
import { LocalBlobStore } from "../local-blob-store.js";
|
|
3
|
+
const localBlobStoreFactory = {
|
|
4
|
+
configSchema: LocalBlobStoreSchema,
|
|
5
|
+
create: (config, logger) => new LocalBlobStore(config, logger),
|
|
6
|
+
metadata: {
|
|
7
|
+
displayName: "Local Filesystem",
|
|
8
|
+
description: "Store blobs on the local filesystem with automatic deduplication",
|
|
9
|
+
requiresNetwork: false
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
localBlobStoreFactory
|
|
14
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var memory_exports = {};
|
|
20
|
+
__export(memory_exports, {
|
|
21
|
+
inMemoryBlobStoreFactory: () => inMemoryBlobStoreFactory
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(memory_exports);
|
|
24
|
+
var import_schemas = require("../schemas.js");
|
|
25
|
+
var import_memory_blob_store = require("../memory-blob-store.js");
|
|
26
|
+
const inMemoryBlobStoreFactory = {
|
|
27
|
+
configSchema: import_schemas.InMemoryBlobStoreSchema,
|
|
28
|
+
create: (config, logger) => new import_memory_blob_store.MemoryBlobStore(
|
|
29
|
+
{
|
|
30
|
+
maxBlobSize: config.maxBlobSize,
|
|
31
|
+
maxTotalSize: config.maxTotalSize
|
|
32
|
+
},
|
|
33
|
+
logger
|
|
34
|
+
),
|
|
35
|
+
metadata: {
|
|
36
|
+
displayName: "In-Memory",
|
|
37
|
+
description: "Store blobs in RAM (ephemeral, for testing and development)",
|
|
38
|
+
requiresNetwork: false
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
inMemoryBlobStoreFactory
|
|
44
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InMemoryBlobStoreConfig } from '../schemas.cjs';
|
|
2
|
+
import { BlobStoreFactory } from '../factory.cjs';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import '@dexto/core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Factory for in-memory blob storage.
|
|
8
|
+
*
|
|
9
|
+
* This factory stores blobs in RAM, making it ideal for testing and
|
|
10
|
+
* development. All data is lost when the process exits.
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* - Zero dependencies
|
|
14
|
+
* - Extremely fast (no I/O)
|
|
15
|
+
* - Configurable size limits
|
|
16
|
+
* - No network required
|
|
17
|
+
* - Perfect for unit tests
|
|
18
|
+
*/
|
|
19
|
+
declare const inMemoryBlobStoreFactory: BlobStoreFactory<InMemoryBlobStoreConfig>;
|
|
20
|
+
|
|
21
|
+
export { inMemoryBlobStoreFactory };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InMemoryBlobStoreConfig } from '../schemas.js';
|
|
2
|
+
import type { BlobStoreFactory } from '../factory.js';
|
|
3
|
+
/**
|
|
4
|
+
* Factory for in-memory blob storage.
|
|
5
|
+
*
|
|
6
|
+
* This factory stores blobs in RAM, making it ideal for testing and
|
|
7
|
+
* development. All data is lost when the process exits.
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Zero dependencies
|
|
11
|
+
* - Extremely fast (no I/O)
|
|
12
|
+
* - Configurable size limits
|
|
13
|
+
* - No network required
|
|
14
|
+
* - Perfect for unit tests
|
|
15
|
+
*/
|
|
16
|
+
export declare const inMemoryBlobStoreFactory: BlobStoreFactory<InMemoryBlobStoreConfig>;
|
|
17
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/blob/factories/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,EAAE,gBAAgB,CAAC,uBAAuB,CAe9E,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { InMemoryBlobStoreSchema } from "../schemas.js";
|
|
2
|
+
import { MemoryBlobStore } from "../memory-blob-store.js";
|
|
3
|
+
const inMemoryBlobStoreFactory = {
|
|
4
|
+
configSchema: InMemoryBlobStoreSchema,
|
|
5
|
+
create: (config, logger) => new MemoryBlobStore(
|
|
6
|
+
{
|
|
7
|
+
maxBlobSize: config.maxBlobSize,
|
|
8
|
+
maxTotalSize: config.maxTotalSize
|
|
9
|
+
},
|
|
10
|
+
logger
|
|
11
|
+
),
|
|
12
|
+
metadata: {
|
|
13
|
+
displayName: "In-Memory",
|
|
14
|
+
description: "Store blobs in RAM (ephemeral, for testing and development)",
|
|
15
|
+
requiresNetwork: false
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
inMemoryBlobStoreFactory
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var factory_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(factory_exports);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Logger, BlobStore } from '@dexto/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Factory interface for creating blob store instances.
|
|
6
|
+
*
|
|
7
|
+
* Factories are plain exports (no global registries). Images decide which factories are
|
|
8
|
+
* available by including them in `image.storage.blob`.
|
|
9
|
+
*/
|
|
10
|
+
interface BlobStoreFactory<TConfig = unknown> {
|
|
11
|
+
/**
|
|
12
|
+
* Zod schema for validating factory-specific configuration.
|
|
13
|
+
* The schema must output the `TConfig` type.
|
|
14
|
+
*/
|
|
15
|
+
configSchema: z.ZodType<TConfig, z.ZodTypeDef, unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* Factory function to create a BlobStore instance.
|
|
18
|
+
* @param config - Validated configuration specific to this backend
|
|
19
|
+
* @param logger - Logger instance for the blob store
|
|
20
|
+
* @returns A BlobStore implementation
|
|
21
|
+
*/
|
|
22
|
+
create(config: TConfig, logger: Logger): BlobStore | Promise<BlobStore>;
|
|
23
|
+
/**
|
|
24
|
+
* Optional metadata for documentation, UIs, and discovery.
|
|
25
|
+
*/
|
|
26
|
+
metadata?: {
|
|
27
|
+
/** Human-readable name (e.g., "Local Filesystem", "Amazon S3") */
|
|
28
|
+
displayName: string;
|
|
29
|
+
/** Brief description of this storage backend */
|
|
30
|
+
description: string;
|
|
31
|
+
/** Whether this backend requires network connectivity */
|
|
32
|
+
requiresNetwork?: boolean;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type { BlobStoreFactory };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BlobStore } from './types.js';
|
|
2
|
+
import type { Logger } from '@dexto/core';
|
|
3
|
+
import type { z } from 'zod';
|
|
4
|
+
/**
|
|
5
|
+
* Factory interface for creating blob store instances.
|
|
6
|
+
*
|
|
7
|
+
* Factories are plain exports (no global registries). Images decide which factories are
|
|
8
|
+
* available by including them in `image.storage.blob`.
|
|
9
|
+
*/
|
|
10
|
+
export interface BlobStoreFactory<TConfig = unknown> {
|
|
11
|
+
/**
|
|
12
|
+
* Zod schema for validating factory-specific configuration.
|
|
13
|
+
* The schema must output the `TConfig` type.
|
|
14
|
+
*/
|
|
15
|
+
configSchema: z.ZodType<TConfig, z.ZodTypeDef, unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* Factory function to create a BlobStore instance.
|
|
18
|
+
* @param config - Validated configuration specific to this backend
|
|
19
|
+
* @param logger - Logger instance for the blob store
|
|
20
|
+
* @returns A BlobStore implementation
|
|
21
|
+
*/
|
|
22
|
+
create(config: TConfig, logger: Logger): BlobStore | Promise<BlobStore>;
|
|
23
|
+
/**
|
|
24
|
+
* Optional metadata for documentation, UIs, and discovery.
|
|
25
|
+
*/
|
|
26
|
+
metadata?: {
|
|
27
|
+
/** Human-readable name (e.g., "Local Filesystem", "Amazon S3") */
|
|
28
|
+
displayName: string;
|
|
29
|
+
/** Brief description of this storage backend */
|
|
30
|
+
description: string;
|
|
31
|
+
/** Whether this backend requires network connectivity */
|
|
32
|
+
requiresNetwork?: boolean;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/blob/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,OAAO,GAAG,OAAO;IAC/C;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAExD;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAExE;;OAEG;IACH,QAAQ,CAAC,EAAE;QACP,kEAAkE;QAClE,WAAW,EAAE,MAAM,CAAC;QACpB,gDAAgD;QAChD,WAAW,EAAE,MAAM,CAAC;QACpB,yDAAyD;QACzD,eAAe,CAAC,EAAE,OAAO,CAAC;KAC7B,CAAC;CACL"}
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var blob_exports = {};
|
|
20
|
+
__export(blob_exports, {
|
|
21
|
+
BLOB_STORE_TYPES: () => import_schemas.BLOB_STORE_TYPES,
|
|
22
|
+
BlobStoreConfigSchema: () => import_schemas.BlobStoreConfigSchema,
|
|
23
|
+
InMemoryBlobStoreSchema: () => import_schemas.InMemoryBlobStoreSchema,
|
|
24
|
+
LocalBlobStore: () => import_local_blob_store.LocalBlobStore,
|
|
25
|
+
LocalBlobStoreSchema: () => import_schemas.LocalBlobStoreSchema,
|
|
26
|
+
MemoryBlobStore: () => import_memory_blob_store.MemoryBlobStore,
|
|
27
|
+
inMemoryBlobStoreFactory: () => import_factories.inMemoryBlobStoreFactory,
|
|
28
|
+
localBlobStoreFactory: () => import_factories.localBlobStoreFactory
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(blob_exports);
|
|
31
|
+
var import_factories = require("./factories/index.js");
|
|
32
|
+
var import_schemas = require("./schemas.js");
|
|
33
|
+
var import_local_blob_store = require("./local-blob-store.js");
|
|
34
|
+
var import_memory_blob_store = require("./memory-blob-store.js");
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
BLOB_STORE_TYPES,
|
|
38
|
+
BlobStoreConfigSchema,
|
|
39
|
+
InMemoryBlobStoreSchema,
|
|
40
|
+
LocalBlobStore,
|
|
41
|
+
LocalBlobStoreSchema,
|
|
42
|
+
MemoryBlobStore,
|
|
43
|
+
inMemoryBlobStoreFactory,
|
|
44
|
+
localBlobStoreFactory
|
|
45
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { BlobStoreFactory } from './factory.cjs';
|
|
2
|
+
export { BlobData, BlobInput, BlobMetadata, BlobReference, BlobStats, BlobStore, StoredBlobMetadata } from '@dexto/core';
|
|
3
|
+
export { localBlobStoreFactory } from './factories/local.cjs';
|
|
4
|
+
export { inMemoryBlobStoreFactory } from './factories/memory.cjs';
|
|
5
|
+
export { BLOB_STORE_TYPES, BlobStoreConfig, BlobStoreConfigSchema, BlobStoreType, InMemoryBlobStoreConfig, InMemoryBlobStoreConfigInput, InMemoryBlobStoreSchema, LocalBlobStoreConfig, LocalBlobStoreConfigInput, LocalBlobStoreSchema } from './schemas.cjs';
|
|
6
|
+
export { LocalBlobStore } from './local-blob-store.cjs';
|
|
7
|
+
export { MemoryBlobStore } from './memory-blob-store.cjs';
|
|
8
|
+
import 'zod';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blob Storage Module
|
|
3
|
+
*
|
|
4
|
+
* This module provides a flexible blob storage system with support for
|
|
5
|
+
* multiple backends through a factory pattern.
|
|
6
|
+
*
|
|
7
|
+
* ## Built-in Factories
|
|
8
|
+
* - `local`: Store blobs on the local filesystem
|
|
9
|
+
* - `in-memory`: Store blobs in RAM (for testing/development)
|
|
10
|
+
*
|
|
11
|
+
* ## Custom Factories
|
|
12
|
+
* Product layers (CLI/server/platform) decide which factories are available by including them
|
|
13
|
+
* in images (`DextoImage.storage.blob`).
|
|
14
|
+
*
|
|
15
|
+
* ## Usage
|
|
16
|
+
* Blob stores are typically constructed by the product-layer resolver (`@dexto/agent-config`)
|
|
17
|
+
* via image-provided factory maps. For direct usage, call a factory's `create()` after validating
|
|
18
|
+
* config with its `configSchema`.
|
|
19
|
+
*/
|
|
20
|
+
export type { BlobStoreFactory } from './factory.js';
|
|
21
|
+
export type { BlobStore, BlobInput, BlobMetadata, BlobReference, BlobData, BlobStats, StoredBlobMetadata, } from './types.js';
|
|
22
|
+
export { localBlobStoreFactory, inMemoryBlobStoreFactory } from './factories/index.js';
|
|
23
|
+
export { BLOB_STORE_TYPES, BlobStoreConfigSchema, InMemoryBlobStoreSchema, LocalBlobStoreSchema, type BlobStoreType, type BlobStoreConfig, type InMemoryBlobStoreConfigInput, type InMemoryBlobStoreConfig, type LocalBlobStoreConfigInput, type LocalBlobStoreConfig, } from './schemas.js';
|
|
24
|
+
export { LocalBlobStore } from './local-blob-store.js';
|
|
25
|
+
export { MemoryBlobStore } from './memory-blob-store.js';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blob/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,YAAY,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,SAAS,EACT,kBAAkB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGvF,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,GAC5B,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { localBlobStoreFactory, inMemoryBlobStoreFactory } from "./factories/index.js";
|
|
2
|
+
import {
|
|
3
|
+
BLOB_STORE_TYPES,
|
|
4
|
+
BlobStoreConfigSchema,
|
|
5
|
+
InMemoryBlobStoreSchema,
|
|
6
|
+
LocalBlobStoreSchema
|
|
7
|
+
} from "./schemas.js";
|
|
8
|
+
import { LocalBlobStore } from "./local-blob-store.js";
|
|
9
|
+
import { MemoryBlobStore } from "./memory-blob-store.js";
|
|
10
|
+
export {
|
|
11
|
+
BLOB_STORE_TYPES,
|
|
12
|
+
BlobStoreConfigSchema,
|
|
13
|
+
InMemoryBlobStoreSchema,
|
|
14
|
+
LocalBlobStore,
|
|
15
|
+
LocalBlobStoreSchema,
|
|
16
|
+
MemoryBlobStore,
|
|
17
|
+
inMemoryBlobStoreFactory,
|
|
18
|
+
localBlobStoreFactory
|
|
19
|
+
};
|