getmnemo-migrate 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.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/dist/adapters/base.d.ts +34 -0
  4. package/dist/adapters/base.d.ts.map +1 -0
  5. package/dist/adapters/base.js +7 -0
  6. package/dist/adapters/base.js.map +1 -0
  7. package/dist/adapters/directory.d.ts +9 -0
  8. package/dist/adapters/directory.d.ts.map +1 -0
  9. package/dist/adapters/directory.js +69 -0
  10. package/dist/adapters/directory.js.map +1 -0
  11. package/dist/adapters/index.d.ts +7 -0
  12. package/dist/adapters/index.d.ts.map +1 -0
  13. package/dist/adapters/index.js +47 -0
  14. package/dist/adapters/index.js.map +1 -0
  15. package/dist/adapters/letta.d.ts +12 -0
  16. package/dist/adapters/letta.d.ts.map +1 -0
  17. package/dist/adapters/letta.js +91 -0
  18. package/dist/adapters/letta.js.map +1 -0
  19. package/dist/adapters/mem0.d.ts +12 -0
  20. package/dist/adapters/mem0.d.ts.map +1 -0
  21. package/dist/adapters/mem0.js +62 -0
  22. package/dist/adapters/mem0.js.map +1 -0
  23. package/dist/adapters/raw-csv.d.ts +9 -0
  24. package/dist/adapters/raw-csv.d.ts.map +1 -0
  25. package/dist/adapters/raw-csv.js +34 -0
  26. package/dist/adapters/raw-csv.js.map +1 -0
  27. package/dist/adapters/raw-json.d.ts +10 -0
  28. package/dist/adapters/raw-json.d.ts.map +1 -0
  29. package/dist/adapters/raw-json.js +35 -0
  30. package/dist/adapters/raw-json.js.map +1 -0
  31. package/dist/adapters/raw-jsonl.d.ts +11 -0
  32. package/dist/adapters/raw-jsonl.d.ts.map +1 -0
  33. package/dist/adapters/raw-jsonl.js +52 -0
  34. package/dist/adapters/raw-jsonl.js.map +1 -0
  35. package/dist/adapters/record-mapping.d.ts +6 -0
  36. package/dist/adapters/record-mapping.d.ts.map +1 -0
  37. package/dist/adapters/record-mapping.js +59 -0
  38. package/dist/adapters/record-mapping.js.map +1 -0
  39. package/dist/adapters/supermemory.d.ts +12 -0
  40. package/dist/adapters/supermemory.d.ts.map +1 -0
  41. package/dist/adapters/supermemory.js +58 -0
  42. package/dist/adapters/supermemory.js.map +1 -0
  43. package/dist/adapters/text-file.d.ts +9 -0
  44. package/dist/adapters/text-file.d.ts.map +1 -0
  45. package/dist/adapters/text-file.js +28 -0
  46. package/dist/adapters/text-file.js.map +1 -0
  47. package/dist/adapters/zep.d.ts +12 -0
  48. package/dist/adapters/zep.d.ts.map +1 -0
  49. package/dist/adapters/zep.js +79 -0
  50. package/dist/adapters/zep.js.map +1 -0
  51. package/dist/cli.d.ts +4 -0
  52. package/dist/cli.d.ts.map +1 -0
  53. package/dist/cli.js +220 -0
  54. package/dist/cli.js.map +1 -0
  55. package/dist/lib/jobs.d.ts +44 -0
  56. package/dist/lib/jobs.d.ts.map +1 -0
  57. package/dist/lib/jobs.js +146 -0
  58. package/dist/lib/jobs.js.map +1 -0
  59. package/dist/lib/migrator.d.ts +24 -0
  60. package/dist/lib/migrator.d.ts.map +1 -0
  61. package/dist/lib/migrator.js +188 -0
  62. package/dist/lib/migrator.js.map +1 -0
  63. package/dist/lib/mnemo-writer.d.ts +42 -0
  64. package/dist/lib/mnemo-writer.d.ts.map +1 -0
  65. package/dist/lib/mnemo-writer.js +155 -0
  66. package/dist/lib/mnemo-writer.js.map +1 -0
  67. package/docs/pilot-integration.md +81 -0
  68. package/package.json +59 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Proofly, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # Mnemo Migrate
2
+
3
+ Resumable CLI for importing historical documents and memories into [Mnemo](https://mnemohq.com). It accepts common customer exports without giving Mnemo credentials to the source system.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g getmnemo-migrate
9
+ ```
10
+
11
+ ## Quickstart
12
+
13
+ ```bash
14
+ export GETMNEMO_API_KEY=mn_...
15
+ export GETMNEMO_WORKSPACE_ID=...
16
+
17
+ # Inspect a HubSpot-style CSV export. This makes no API calls.
18
+ getmnemo-migrate plan from raw-csv \
19
+ --file ./contacts.csv \
20
+ --map 'content=*,id=Record ID'
21
+
22
+ # Submit it to the isolated pilot container and wait for ingestion.
23
+ getmnemo-migrate from raw-csv \
24
+ --file ./contacts.csv \
25
+ --map 'content=*,id=Record ID' \
26
+ --container pilot:customer-name
27
+ ```
28
+
29
+ The `content=*` mapping serializes each complete CSV or JSON record. For cleaner source data, map a specific field instead, such as `content=notes,id=record_id,company=company`.
30
+
31
+ ## Import Lanes
32
+
33
+ | Lane | Default sources | Behavior |
34
+ | --- | --- | --- |
35
+ | `document` | CSV, JSON, JSONL, Markdown, text, directories | Sends source material through Mnemo document ingestion so facts, provenance, entities, and time can be extracted. |
36
+ | `memory` | Mem0, Zep, Supermemory, Letta | Preserves already-extracted memory text as atomic memories. |
37
+
38
+ Override the default only when the source semantics require it with `--lane memory` or `--lane document`.
39
+
40
+ ## File Sources
41
+
42
+ | Source | Required option | Notes |
43
+ | --- | --- | --- |
44
+ | `raw-csv` | `--file export.csv` | RFC-compatible CSV parsing, including quoted multiline fields. |
45
+ | `raw-json` | `--file export.json` | Top-level arrays up to 50 MB. Convert larger files to JSONL. |
46
+ | `raw-jsonl` | `--file export.jsonl` | Streams one JSON object per line. |
47
+ | `text-file` | `--file notes.md` | Imports one Markdown or text document. |
48
+ | `directory` | `--file ./export` | Recursively imports supported files in deterministic order; ignores symlinks and unsupported files. |
49
+
50
+ Mappings use `target=source` pairs and support dotted source paths:
51
+
52
+ ```bash
53
+ getmnemo-migrate from raw-json \
54
+ --file ./history.json \
55
+ --map 'content=payload.body,id=record.id,customer=account.id' \
56
+ --container pilot:customer-name
57
+ ```
58
+
59
+ ## Provider Sources
60
+
61
+ | Source | Source credentials | Useful options |
62
+ | --- | --- | --- |
63
+ | `mem0` | `MEM0_API_KEY` | `--user`, `--base-url` |
64
+ | `zep` | `ZEP_API_KEY` | `--user` is required, `--base-url` |
65
+ | `supermemory` | `SUPERMEMORY_API_KEY` | `--base-url` |
66
+ | `letta` | `LETTA_API_KEY`, `LETTA_BASE_URL` | Imports core and archival memory |
67
+
68
+ ## Safe Operating Flow
69
+
70
+ 1. Export data from the source system.
71
+ 2. Run `plan from ...` and inspect the count plus sample. No Mnemo credentials are needed for planning.
72
+ 3. Import into a customer-specific container with conservative concurrency.
73
+ 4. Keep the printed migration job ID.
74
+ 5. Run `status <jobId>` or `reconcile <jobId>` to obtain the final completion report.
75
+ 6. Validate retrieval against a small set of customer-approved questions before connecting an agent.
76
+
77
+ ```bash
78
+ getmnemo-migrate status
79
+ getmnemo-migrate cancel mig_...
80
+ getmnemo-migrate resume mig_...
81
+ getmnemo-migrate reconcile mig_...
82
+ ```
83
+
84
+ Cancellation pauses after the current bounded batch. Resume skips successful source records and retries unresolved ones. Mnemo custom IDs and idempotency keys also protect against duplicate writes if local state is lost.
85
+
86
+ Job state, processed IDs, remote job IDs, and failure journals are stored under `~/.getmnemo/migrations` with owner-only permissions. Set `GETMNEMO_MIGRATION_DIR` to use another state directory.
87
+
88
+ ## Reliability Limits
89
+
90
+ - Concurrency is capped at 25 even if a larger value is requested.
91
+ - HTTP 429 and server/network failures retry up to five times with backoff.
92
+ - Documents larger than the API limit are split deterministically near line boundaries.
93
+ - Atomic memories longer than the memory endpoint limit are split with part metadata.
94
+ - JSON arrays are capped at 50 MB to avoid loading unbounded files into memory; JSONL and CSV stream.
95
+ - The completion report distinguishes accepted writes from completed and failed ingestion jobs.
96
+
97
+ ## Environment
98
+
99
+ | Variable | Purpose |
100
+ | --- | --- |
101
+ | `GETMNEMO_API_KEY` | Destination API key. Required for writes and reconciliation. |
102
+ | `GETMNEMO_WORKSPACE_ID` | Destination workspace. Required for writes and reconciliation. |
103
+ | `GETMNEMO_API_URL` | API base URL. Defaults to `https://api.mnemohq.com`. |
104
+ | `GETMNEMO_CONTAINER_TAG` | Optional default destination container. |
105
+ | `GETMNEMO_MIGRATION_DIR` | Optional local checkpoint directory. |
106
+
107
+ See [Pilot integration contract](./docs/pilot-integration.md) for the boundary between source exports, Mnemo, governance, and agents.
108
+
109
+ ## License
110
+
111
+ [MIT](./LICENSE)
@@ -0,0 +1,34 @@
1
+ export type ImportLane = "memory" | "document";
2
+ export interface SourceRecord {
3
+ /** Provider-native id; carried into Mnemo metadata for traceability. */
4
+ sourceId?: string;
5
+ /** Free-form text content to be stored as a memory. */
6
+ content: string;
7
+ /** Optional metadata to merge into the Mnemo memory. */
8
+ metadata?: Record<string, unknown>;
9
+ /** Optional source-provided content classification. */
10
+ contentType?: string;
11
+ }
12
+ export interface AdapterConfig {
13
+ /** Optional path to a JSONL file (used by raw-jsonl adapter). */
14
+ file?: string;
15
+ /** Optional mapping like `content=text,id=mem_id`. */
16
+ map?: string;
17
+ /** Optional explicit user/agent id (some providers require it). */
18
+ user?: string;
19
+ /** Optional override for the provider base URL. */
20
+ baseUrl?: string;
21
+ /** Page size hint for paginated providers. */
22
+ pageSize?: number;
23
+ }
24
+ export declare abstract class Adapter {
25
+ protected readonly cfg: AdapterConfig;
26
+ abstract readonly name: string;
27
+ abstract readonly defaultLane: ImportLane;
28
+ constructor(cfg?: AdapterConfig);
29
+ /** Best-effort total record count. Return null if unknown. */
30
+ abstract count(): Promise<number | null>;
31
+ /** Async iterator yielding source records. */
32
+ abstract iterate(): AsyncIterable<SourceRecord>;
33
+ }
34
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/adapters/base.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,8BAAsB,OAAO;IAIf,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,aAAa;IAHjD,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;gBAEX,GAAG,GAAE,aAAkB;IAEtD,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAExC,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,IAAI,aAAa,CAAC,YAAY,CAAC;CAChD"}
@@ -0,0 +1,7 @@
1
+ export class Adapter {
2
+ cfg;
3
+ constructor(cfg = {}) {
4
+ this.cfg = cfg;
5
+ }
6
+ }
7
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/adapters/base.ts"],"names":[],"mappings":"AA0BA,MAAM,OAAgB,OAAO;IAII;IAA/B,YAA+B,MAAqB,EAAE;QAAvB,QAAG,GAAH,GAAG,CAAoB;IAAG,CAAC;CAO3D"}
@@ -0,0 +1,9 @@
1
+ import { Adapter, AdapterConfig, SourceRecord } from "./base.js";
2
+ export declare class DirectoryAdapter extends Adapter {
3
+ readonly name = "directory";
4
+ readonly defaultLane: "document";
5
+ constructor(cfg?: AdapterConfig);
6
+ count(): Promise<number | null>;
7
+ iterate(): AsyncIterable<SourceRecord>;
8
+ }
9
+ //# sourceMappingURL=directory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/adapters/directory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAoCjE,qBAAa,gBAAiB,SAAQ,OAAO;IAC3C,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,WAAW,EAAG,UAAU,CAAU;gBAE/B,GAAG,GAAE,aAAkB;IAK7B,KAAK,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAU9B,OAAO,IAAI,aAAa,CAAC,YAAY,CAAC;CAa9C"}
@@ -0,0 +1,69 @@
1
+ import { promises as fs } from "node:fs";
2
+ import { extname, relative, resolve } from "node:path";
3
+ import { Adapter } from "./base.js";
4
+ import { RawCsvAdapter } from "./raw-csv.js";
5
+ import { RawJsonAdapter } from "./raw-json.js";
6
+ import { RawJsonlAdapter } from "./raw-jsonl.js";
7
+ import { TextFileAdapter } from "./text-file.js";
8
+ const SUPPORTED_EXTENSIONS = new Set([".csv", ".json", ".jsonl", ".md", ".txt"]);
9
+ async function listFiles(root) {
10
+ const entries = await fs.readdir(root, { withFileTypes: true });
11
+ const files = [];
12
+ for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
13
+ const path = resolve(root, entry.name);
14
+ if (entry.isDirectory())
15
+ files.push(...(await listFiles(path)));
16
+ if (entry.isFile() && SUPPORTED_EXTENSIONS.has(extname(entry.name).toLowerCase()))
17
+ files.push(path);
18
+ }
19
+ return files;
20
+ }
21
+ function adapterFor(file, cfg) {
22
+ const childConfig = { ...cfg, file };
23
+ switch (extname(file).toLowerCase()) {
24
+ case ".csv":
25
+ return new RawCsvAdapter(childConfig);
26
+ case ".json":
27
+ return new RawJsonAdapter(childConfig);
28
+ case ".jsonl":
29
+ return new RawJsonlAdapter(childConfig);
30
+ case ".md":
31
+ case ".txt":
32
+ return new TextFileAdapter(childConfig);
33
+ default:
34
+ throw new Error(`Unsupported import file: ${file}`);
35
+ }
36
+ }
37
+ export class DirectoryAdapter extends Adapter {
38
+ name = "directory";
39
+ defaultLane = "document";
40
+ constructor(cfg = {}) {
41
+ super(cfg);
42
+ if (!cfg.file)
43
+ throw new Error("--file <directory> is required for the directory adapter");
44
+ }
45
+ async count() {
46
+ let total = 0;
47
+ for (const file of await listFiles(this.cfg.file)) {
48
+ const count = await adapterFor(file, this.cfg).count();
49
+ if (count === null)
50
+ return null;
51
+ total += count;
52
+ }
53
+ return total;
54
+ }
55
+ async *iterate() {
56
+ const root = resolve(this.cfg.file);
57
+ for (const file of await listFiles(root)) {
58
+ const relativePath = relative(root, file);
59
+ for await (const record of adapterFor(file, this.cfg).iterate()) {
60
+ yield {
61
+ ...record,
62
+ sourceId: `${relativePath}:${record.sourceId ?? "document"}`,
63
+ metadata: { ...record.metadata, importPath: relativePath },
64
+ };
65
+ }
66
+ }
67
+ }
68
+ }
69
+ //# sourceMappingURL=directory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.js","sourceRoot":"","sources":["../../src/adapters/directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,OAAO,EAA+B,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAEjF,KAAK,UAAU,SAAS,CAAC,IAAY;IACnC,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACzE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,KAAK,CAAC,WAAW,EAAE;YAAE,KAAK,CA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G,CAAC,IAAK,CAAC,EAAE,CAAC;YACnD,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;YACvD,IAAI,KAAK,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAC;YAChC,KAAK,IAAI,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,CAAC,OAAO;QACZ,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAK,CAAC,CAAC;QACrC,KAAK,MAAM,IAAI,IAAI,MAAM,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC1C,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;gBAChE,MAAM;oBACJ,GAAG,MAAM;oBACT,QAAQ,EAAE,GAAG,YAAY,IAAI,MAAM,CAAC,QAAQ,IAAI,UAAU,EAAE;oBAC5D,QAAQ,EAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE;iBAC3D,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ import { Adapter, AdapterConfig } from "./base.js";
2
+ export type AdapterName = "mem0" | "zep" | "supermemory" | "letta" | "raw-jsonl" | "raw-json" | "raw-csv" | "text-file" | "directory";
3
+ export declare const ADAPTER_NAMES: AdapterName[];
4
+ export declare function createAdapter(name: string, cfg?: AdapterConfig): Adapter;
5
+ export { Adapter };
6
+ export type { AdapterConfig, ImportLane, SourceRecord } from "./base.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAWnD,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,KAAK,GACL,aAAa,GACb,OAAO,GACP,WAAW,GACX,UAAU,GACV,SAAS,GACT,WAAW,GACX,WAAW,CAAC;AAEhB,eAAO,MAAM,aAAa,EAAE,WAAW,EAUtC,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,aAAkB,GAAG,OAAO,CAuB5E;AAED,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { Adapter } from "./base.js";
2
+ import { Mem0Adapter } from "./mem0.js";
3
+ import { ZepAdapter } from "./zep.js";
4
+ import { SupermemoryAdapter } from "./supermemory.js";
5
+ import { LettaAdapter } from "./letta.js";
6
+ import { RawJsonlAdapter } from "./raw-jsonl.js";
7
+ import { RawJsonAdapter } from "./raw-json.js";
8
+ import { RawCsvAdapter } from "./raw-csv.js";
9
+ import { TextFileAdapter } from "./text-file.js";
10
+ import { DirectoryAdapter } from "./directory.js";
11
+ export const ADAPTER_NAMES = [
12
+ "mem0",
13
+ "zep",
14
+ "supermemory",
15
+ "letta",
16
+ "raw-jsonl",
17
+ "raw-json",
18
+ "raw-csv",
19
+ "text-file",
20
+ "directory",
21
+ ];
22
+ export function createAdapter(name, cfg = {}) {
23
+ switch (name) {
24
+ case "mem0":
25
+ return new Mem0Adapter(cfg);
26
+ case "zep":
27
+ return new ZepAdapter(cfg);
28
+ case "supermemory":
29
+ return new SupermemoryAdapter(cfg);
30
+ case "letta":
31
+ return new LettaAdapter(cfg);
32
+ case "raw-jsonl":
33
+ return new RawJsonlAdapter(cfg);
34
+ case "raw-json":
35
+ return new RawJsonAdapter(cfg);
36
+ case "raw-csv":
37
+ return new RawCsvAdapter(cfg);
38
+ case "text-file":
39
+ return new TextFileAdapter(cfg);
40
+ case "directory":
41
+ return new DirectoryAdapter(cfg);
42
+ default:
43
+ throw new Error(`Unknown adapter "${name}". Valid: ${ADAPTER_NAMES.join(", ")}`);
44
+ }
45
+ }
46
+ export { Adapter };
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAalD,MAAM,CAAC,MAAM,aAAa,GAAkB;IAC1C,MAAM;IACN,KAAK;IACL,aAAa;IACb,OAAO;IACP,WAAW;IACX,UAAU;IACV,SAAS;IACT,WAAW;IACX,WAAW;CACZ,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,MAAqB,EAAE;IACjE,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM;YACT,OAAO,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;QAC9B,KAAK,KAAK;YACR,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;QAC7B,KAAK,aAAa;YAChB,OAAO,IAAI,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACrC,KAAK,OAAO;YACV,OAAO,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC;QAC/B,KAAK,WAAW;YACd,OAAO,IAAI,eAAe,CAAC,GAAG,CAAC,CAAC;QAClC,KAAK,UAAU;YACb,OAAO,IAAI,cAAc,CAAC,GAAG,CAAC,CAAC;QACjC,KAAK,SAAS;YACZ,OAAO,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;QAChC,KAAK,WAAW;YACd,OAAO,IAAI,eAAe,CAAC,GAAG,CAAC,CAAC;QAClC,KAAK,WAAW;YACd,OAAO,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACnC;YACE,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,aAAa,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrF,CAAC;AACH,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Adapter, AdapterConfig, SourceRecord } from "./base.js";
2
+ export declare class LettaAdapter extends Adapter {
3
+ readonly name = "letta";
4
+ readonly defaultLane: "memory";
5
+ private apiKey;
6
+ private baseUrl;
7
+ constructor(cfg?: AdapterConfig);
8
+ private request;
9
+ count(): Promise<number | null>;
10
+ iterate(): AsyncIterable<SourceRecord>;
11
+ }
12
+ //# sourceMappingURL=letta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"letta.d.ts","sourceRoot":"","sources":["../../src/adapters/letta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAuBjE,qBAAa,YAAa,SAAQ,OAAO;IACvC,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,WAAW,EAAG,QAAQ,CAAU;IAEzC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;gBAEZ,GAAG,GAAE,aAAkB;YAcrB,OAAO;IAaf,KAAK,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI9B,OAAO,IAAI,aAAa,CAAC,YAAY,CAAC;CAsD9C"}
@@ -0,0 +1,91 @@
1
+ import { Adapter } from "./base.js";
2
+ export class LettaAdapter extends Adapter {
3
+ name = "letta";
4
+ defaultLane = "memory";
5
+ apiKey;
6
+ baseUrl;
7
+ constructor(cfg = {}) {
8
+ super(cfg);
9
+ const key = process.env.LETTA_API_KEY;
10
+ const baseUrl = process.env.LETTA_BASE_URL ?? cfg.baseUrl;
11
+ if (!key) {
12
+ throw new Error("LETTA_API_KEY is required for the letta adapter");
13
+ }
14
+ if (!baseUrl) {
15
+ throw new Error("LETTA_BASE_URL is required for the letta adapter");
16
+ }
17
+ this.apiKey = key;
18
+ this.baseUrl = baseUrl.replace(/\/$/, "");
19
+ }
20
+ async request(path) {
21
+ const res = await fetch(new URL(path, this.baseUrl + "/"), {
22
+ headers: {
23
+ Authorization: `Bearer ${this.apiKey}`,
24
+ Accept: "application/json",
25
+ },
26
+ });
27
+ if (!res.ok) {
28
+ throw new Error(`letta request failed: ${res.status} ${res.statusText}`);
29
+ }
30
+ return (await res.json());
31
+ }
32
+ async count() {
33
+ return null;
34
+ }
35
+ async *iterate() {
36
+ const agents = await this.request("/v1/agents/");
37
+ for (const agent of agents) {
38
+ const agentId = agent.id;
39
+ if (!agentId)
40
+ continue;
41
+ // Core memory blocks
42
+ for (const block of agent.memory?.blocks ?? []) {
43
+ if (!block.value)
44
+ continue;
45
+ yield {
46
+ sourceId: block.id,
47
+ content: block.value,
48
+ metadata: {
49
+ source: "letta",
50
+ kind: "core_block",
51
+ agentId,
52
+ ...(agent.name ? { agentName: agent.name } : {}),
53
+ ...(block.label ? { label: block.label } : {}),
54
+ ...(block.created_at ? { sourceCreatedAt: block.created_at } : {}),
55
+ ...(block.metadata ?? {}),
56
+ },
57
+ };
58
+ }
59
+ // Archival memory (paginated by `after` cursor)
60
+ const pageSize = this.cfg.pageSize ?? 100;
61
+ let after;
62
+ while (true) {
63
+ const path = `/v1/agents/${encodeURIComponent(agentId)}/archival-memory?limit=${pageSize}${after ? `&after=${encodeURIComponent(after)}` : ""}`;
64
+ const page = await this.request(path);
65
+ if (!page || page.length === 0)
66
+ break;
67
+ for (const m of page) {
68
+ if (!m.text)
69
+ continue;
70
+ yield {
71
+ sourceId: m.id,
72
+ content: m.text,
73
+ metadata: {
74
+ source: "letta",
75
+ kind: "archival",
76
+ agentId,
77
+ ...(agent.name ? { agentName: agent.name } : {}),
78
+ ...(m.created_at ? { sourceCreatedAt: m.created_at } : {}),
79
+ ...(m.metadata ?? {}),
80
+ },
81
+ };
82
+ }
83
+ const last = page[page.length - 1];
84
+ if (!last?.id || page.length < pageSize)
85
+ break;
86
+ after = last.id;
87
+ }
88
+ }
89
+ }
90
+ }
91
+ //# sourceMappingURL=letta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"letta.js","sourceRoot":"","sources":["../../src/adapters/letta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,WAAW,CAAC;AAuBjE,MAAM,OAAO,YAAa,SAAQ,OAAO;IAC9B,IAAI,GAAG,OAAO,CAAC;IACf,WAAW,GAAG,QAAiB,CAAC;IAEjC,MAAM,CAAS;IACf,OAAO,CAAS;IAExB,YAAY,MAAqB,EAAE;QACjC,KAAK,CAAC,GAAG,CAAC,CAAC;QACX,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;QACtC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,OAAO,CAAC;QAC1D,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QACD,IAAI,CAAC,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AC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;4BAChD,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;4BAC1D,GAAG,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC;yBACtB;qBACF,CAAC;gBACJ,CAAC;gBACD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBACnC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,IAAI,CAAC,MAAM,GAAG,QAAQ;oBAAE,MAAM;gBAC/C,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC;YAClB,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ import { Adapter, AdapterConfig, SourceRecord } from "./base.js";
2
+ export declare class Mem0Adapter extends Adapter {
3
+ readonly name = "mem0";
4
+ readonly defaultLane: "memory";
5
+ private apiKey;
6
+ private baseUrl;
7
+ constructor(cfg?: AdapterConfig);
8
+ private request;
9
+ count(): Promise<number | null>;
10
+ iterate(): AsyncIterable<SourceRecord>;
11
+ }
12
+ //# sourceMappingURL=mem0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mem0.d.ts","sourceRoot":"","sources":["../../src/adapters/mem0.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAoBjE,qBAAa,WAAY,SAAQ,OAAO;IACtC,QAAQ,CAAC,IAAI,UAAU;IACvB,QAAQ,CAAC,WAAW,EAAG,QAAQ,CAAU;IAEzC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;gBAEZ,GAAG,GAAE,aAAkB;YAUrB,OAAO;IAaf,KAAK,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAO9B,OAAO,IAAI,aAAa,CAAC,YAAY,CAAC;CA0B9C"}
@@ -0,0 +1,62 @@
1
+ import { Adapter } from "./base.js";
2
+ const DEFAULT_BASE_URL = "https://api.mem0.ai";
3
+ export class Mem0Adapter extends Adapter {
4
+ name = "mem0";
5
+ defaultLane = "memory";
6
+ apiKey;
7
+ baseUrl;
8
+ constructor(cfg = {}) {
9
+ super(cfg);
10
+ const key = process.env.MEM0_API_KEY;
11
+ if (!key) {
12
+ throw new Error("MEM0_API_KEY is required for the mem0 adapter");
13
+ }
14
+ this.apiKey = key;
15
+ this.baseUrl = (cfg.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
16
+ }
17
+ async request(path) {
18
+ const res = await fetch(new URL(path, this.baseUrl + "/"), {
19
+ headers: {
20
+ Authorization: `Token ${this.apiKey}`,
21
+ Accept: "application/json",
22
+ },
23
+ });
24
+ if (!res.ok) {
25
+ throw new Error(`mem0 request failed: ${res.status} ${res.statusText}`);
26
+ }
27
+ return (await res.json());
28
+ }
29
+ async count() {
30
+ const params = new URLSearchParams({ page: "1", page_size: "1" });
31
+ if (this.cfg.user)
32
+ params.set("user_id", this.cfg.user);
33
+ const page = await this.request(`/v1/memories/?${params.toString()}`);
34
+ return typeof page.count === "number" ? page.count : null;
35
+ }
36
+ async *iterate() {
37
+ const pageSize = this.cfg.pageSize ?? 100;
38
+ let nextUrl = `/v1/memories/?page_size=${pageSize}${this.cfg.user ? `&user_id=${encodeURIComponent(this.cfg.user)}` : ""}`;
39
+ while (nextUrl) {
40
+ const page = await this.request(nextUrl);
41
+ const results = page.results ?? [];
42
+ for (const m of results) {
43
+ const content = m.memory ?? m.text;
44
+ if (!content)
45
+ continue;
46
+ yield {
47
+ sourceId: m.id,
48
+ content,
49
+ metadata: {
50
+ source: "mem0",
51
+ ...(m.user_id ? { userId: m.user_id } : {}),
52
+ ...(m.agent_id ? { agentId: m.agent_id } : {}),
53
+ ...(m.created_at ? { sourceCreatedAt: m.created_at } : {}),
54
+ ...(m.metadata ?? {}),
55
+ },
56
+ };
57
+ }
58
+ nextUrl = page.next ? page.next.replace(this.baseUrl, "") : null;
59
+ }
60
+ }
61
+ }
62
+ //# sourceMappingURL=mem0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mem0.js","sourceRoot":"","sources":["../../src/adapters/mem0.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,WAAW,CAAC;AAkBjE,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAE/C,MAAM,OAAO,WAAY,SAAQ,OAAO;IAC7B,IAAI,GAAG,MAAM,CAAC;IACd,WAAW,GAAG,QAAiB,CAAC;IAEjC,MAAM,CAAS;IACf,OAAO,CAAS;IAExB,YAAY,MAAqB,EAAE;QACjC,KAAK,CAAC,GAAG,CAAC,CAAC;QACX,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;QACrC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtE,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,IAAY;QAChC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,EAAE;YACzD,OAAO,EAAE;gBACP,aAAa,EAAE,SAAS,IAAI,CAAC,MAAM,EAAE;gBACrC,MAAM,EAAE,kBAAkB;aAC3B;SACF,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YAC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C,CAAC,IAAI,CAAC;gBACnC,IAAI,CAAC,OAAO;oBAAE,SAAS;gBACvB,MAAM;oBACJ,QAAQ,EAAE,CAAC,CAAC,EAAE;oBACd,OAAO;oBACP,QAAQ,EAAE;wBACR,MAAM,EAAE,MAAM;wBACd,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;wBAC3C,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;wBAC9C,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;wBAC1D,GAAG,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC;qBACtB;iBACF,CAAC;YACJ,CAAC;YACD,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACnE,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import { Adapter, AdapterConfig, SourceRecord } from "./base.js";
2
+ export declare class RawCsvAdapter extends Adapter {
3
+ readonly name = "raw-csv";
4
+ readonly defaultLane: "document";
5
+ constructor(cfg?: AdapterConfig);
6
+ count(): Promise<number>;
7
+ iterate(): AsyncIterable<SourceRecord>;
8
+ }
9
+ //# sourceMappingURL=raw-csv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raw-csv.d.ts","sourceRoot":"","sources":["../../src/adapters/raw-csv.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGjE,qBAAa,aAAc,SAAQ,OAAO;IACxC,QAAQ,CAAC,IAAI,aAAa;IAC1B,QAAQ,CAAC,WAAW,EAAG,UAAU,CAAU;gBAE/B,GAAG,GAAE,aAAkB;IAK7B,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAMvB,OAAO,IAAI,aAAa,CAAC,YAAY,CAAC;CAc9C"}
@@ -0,0 +1,34 @@
1
+ import { createReadStream } from "node:fs";
2
+ import { parse } from "csv-parse";
3
+ import { Adapter } from "./base.js";
4
+ import { parseMap, recordFromObject } from "./record-mapping.js";
5
+ export class RawCsvAdapter extends Adapter {
6
+ name = "raw-csv";
7
+ defaultLane = "document";
8
+ constructor(cfg = {}) {
9
+ super(cfg);
10
+ if (!cfg.file)
11
+ throw new Error("--file <path.csv> is required for the raw-csv adapter");
12
+ }
13
+ async count() {
14
+ let total = 0;
15
+ for await (const _record of this.iterate())
16
+ total += 1;
17
+ return total;
18
+ }
19
+ async *iterate() {
20
+ const parser = createReadStream(this.cfg.file).pipe(parse({ bom: true, columns: true, skip_empty_lines: true, trim: true }));
21
+ const map = parseMap(this.cfg.map);
22
+ for await (const value of parser) {
23
+ if (!value || typeof value !== "object" || Array.isArray(value))
24
+ continue;
25
+ const record = recordFromObject(value, map, {
26
+ source: "raw-csv",
27
+ file: this.cfg.file,
28
+ });
29
+ if (record)
30
+ yield record;
31
+ }
32
+ }
33
+ }
34
+ //# sourceMappingURL=raw-csv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raw-csv.js","sourceRoot":"","sources":["../../src/adapters/raw-csv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAA+B,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,MA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.js";
2
+ export declare class RawJsonAdapter extends Adapter {
3
+ readonly name = "raw-json";
4
+ readonly defaultLane: "document";
5
+ constructor(cfg?: AdapterConfig);
6
+ private load;
7
+ count(): Promise<number>;
8
+ iterate(): AsyncIterable<SourceRecord>;
9
+ }
10
+ //# sourceMappingURL=raw-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raw-json.d.ts","sourceRoot":"","sources":["../../src/adapters/raw-json.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKjE,qBAAa,cAAe,SAAQ,OAAO;IACzC,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,WAAW,EAAG,UAAU,CAAU;gBAE/B,GAAG,GAAE,aAAkB;YAKrB,IAAI;IAYZ,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAIvB,OAAO,IAAI,aAAa,CAAC,YAAY,CAAC;CAO9C"}