lines-db 0.18.1 → 0.19.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/CHANGELOG.md +23 -0
- package/README.ja.md +1 -1
- package/README.md +3 -1
- package/bin/cli.mjs +688 -112
- package/dist/index.d.mts +39 -31
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +247 -80
- package/dist/index.mjs.map +1 -1
- package/dist/internal.d.mts +2 -4
- package/dist/internal.d.mts.map +1 -1
- package/dist/internal.mjs +1 -1
- package/dist/schema-module-D4j10w8_.mjs +396 -0
- package/dist/schema-module-D4j10w8_.mjs.map +1 -0
- package/dist/{jsonl-reader-CoYEJ9pg.d.mts → schema-module-Tb40gPyF.d.mts} +25 -8
- package/dist/schema-module-Tb40gPyF.d.mts.map +1 -0
- package/package.json +6 -6
- package/dist/jsonl-reader-CoYEJ9pg.d.mts.map +0 -1
- package/dist/replace-file-AWLIm7aN.mjs +0 -203
- package/dist/replace-file-AWLIm7aN.mjs.map +0 -1
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { createHash, randomBytes } from "node:crypto";
|
|
2
|
-
import { chmod, link, readFile, rename, rm, stat } from "node:fs/promises";
|
|
3
|
-
import { normalize } from "node:path";
|
|
4
|
-
//#region src/result.ts
|
|
5
|
-
function ok(value) {
|
|
6
|
-
return {
|
|
7
|
-
ok: true,
|
|
8
|
-
value
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function err(error) {
|
|
12
|
-
return {
|
|
13
|
-
ok: false,
|
|
14
|
-
error
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/** Normalize a thrown value (which may not be an Error) into an Error. */
|
|
18
|
-
function toError(value) {
|
|
19
|
-
return value instanceof Error ? value : new Error(String(value));
|
|
20
|
-
}
|
|
21
|
-
/** Unwrap a Result, throwing its error when it is not ok. */
|
|
22
|
-
function unwrap(result) {
|
|
23
|
-
if (result.ok) return result.value;
|
|
24
|
-
throw result.error;
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/jsonl-reader.ts
|
|
28
|
-
/** Fingerprint of a JSONL file's content, to tell whether the file changed since it was read */
|
|
29
|
-
function hashJsonlContent(content) {
|
|
30
|
-
return createHash("sha256").update(content).digest("hex");
|
|
31
|
-
}
|
|
32
|
-
var JsonlReader = class {
|
|
33
|
-
static overrides = null;
|
|
34
|
-
/**
|
|
35
|
-
* Temporarily override the data returned for specific JSONL files.
|
|
36
|
-
* Useful for scenarios like migration validation where in-memory data should be used.
|
|
37
|
-
*/
|
|
38
|
-
static async withOverrides(overrides, fn) {
|
|
39
|
-
const normalized = /* @__PURE__ */ new Map();
|
|
40
|
-
for (const [filePath, rows] of overrides) normalized.set(normalize(filePath), rows);
|
|
41
|
-
const previousOverrides = this.overrides;
|
|
42
|
-
this.overrides = normalized;
|
|
43
|
-
try {
|
|
44
|
-
return await fn();
|
|
45
|
-
} finally {
|
|
46
|
-
this.overrides = previousOverrides;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Read JSONL file and parse each line as JSON
|
|
51
|
-
*/
|
|
52
|
-
static async read(filePath) {
|
|
53
|
-
const result = await this.readSnapshot(filePath);
|
|
54
|
-
return result.ok ? result.value.rows : result;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Read JSONL file like {@link read}, along with a hash of the content the rows were parsed from.
|
|
58
|
-
* The hash is there even when the content does not parse.
|
|
59
|
-
*/
|
|
60
|
-
static async readSnapshot(filePath) {
|
|
61
|
-
const overrideRows = this.overrides?.get(normalize(filePath));
|
|
62
|
-
if (overrideRows) return ok({
|
|
63
|
-
rows: ok(overrideRows.map((row) => JSON.parse(JSON.stringify(row)))),
|
|
64
|
-
contentHash: void 0
|
|
65
|
-
});
|
|
66
|
-
let content;
|
|
67
|
-
try {
|
|
68
|
-
content = await readFile(filePath, "utf-8");
|
|
69
|
-
} catch (error) {
|
|
70
|
-
return err(toError(error));
|
|
71
|
-
}
|
|
72
|
-
return ok({
|
|
73
|
-
rows: this.parse(filePath, content),
|
|
74
|
-
contentHash: hashJsonlContent(content)
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
static parse(filePath, content) {
|
|
78
|
-
const rawLines = (content.startsWith("") ? content.slice(1) : content).split("\n");
|
|
79
|
-
const rows = [];
|
|
80
|
-
for (let i = 0; i < rawLines.length; i++) {
|
|
81
|
-
const line = rawLines[i].endsWith("\r") ? rawLines[i].slice(0, -1) : rawLines[i];
|
|
82
|
-
if (line.trim().length === 0) continue;
|
|
83
|
-
const fail = (message, cause) => {
|
|
84
|
-
const parseError = new Error(message, { cause });
|
|
85
|
-
parseError.name = "JsonlParseError";
|
|
86
|
-
parseError.file = filePath;
|
|
87
|
-
parseError.line = i + 1;
|
|
88
|
-
return err(parseError);
|
|
89
|
-
};
|
|
90
|
-
let value;
|
|
91
|
-
try {
|
|
92
|
-
value = JSON.parse(line);
|
|
93
|
-
} catch (error) {
|
|
94
|
-
return fail(`Failed to parse JSON line: ${line}`, error);
|
|
95
|
-
}
|
|
96
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return fail(`A JSONL line holds a row, which is a JSON object: ${line}`);
|
|
97
|
-
rows.push(value);
|
|
98
|
-
}
|
|
99
|
-
return ok(rows);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Infer schema from JSONL data
|
|
103
|
-
*/
|
|
104
|
-
static inferSchema(tableName, data) {
|
|
105
|
-
if (data.length === 0) return err(/* @__PURE__ */ new Error("Cannot infer schema from empty data"));
|
|
106
|
-
const columnTypes = /* @__PURE__ */ new Map();
|
|
107
|
-
const presence = /* @__PURE__ */ new Map();
|
|
108
|
-
const booleanColumns = /* @__PURE__ */ new Set();
|
|
109
|
-
const nonBooleanColumns = /* @__PURE__ */ new Set();
|
|
110
|
-
for (const row of data) for (const [key, value] of Object.entries(row)) {
|
|
111
|
-
if (!columnTypes.has(key)) columnTypes.set(key, /* @__PURE__ */ new Set());
|
|
112
|
-
columnTypes.get(key).add(this.inferType(value));
|
|
113
|
-
presence.set(key, (presence.get(key) ?? 0) + 1);
|
|
114
|
-
if (typeof value === "boolean") booleanColumns.add(key);
|
|
115
|
-
else if (value !== null) nonBooleanColumns.add(key);
|
|
116
|
-
}
|
|
117
|
-
const columns = [];
|
|
118
|
-
for (const [columnName, types] of columnTypes.entries()) {
|
|
119
|
-
const typeArray = Array.from(types);
|
|
120
|
-
let sqlType = "TEXT";
|
|
121
|
-
if (typeArray.length === 1) sqlType = typeArray[0];
|
|
122
|
-
else if (typeArray.every((t) => t === "INTEGER" || t === "REAL")) sqlType = "REAL";
|
|
123
|
-
else if (!typeArray.includes("NULL")) sqlType = "TEXT";
|
|
124
|
-
else if (typeArray.length === 2 && typeArray.includes("NULL")) sqlType = typeArray.find((t) => t !== "NULL");
|
|
125
|
-
const isBooleanColumn = booleanColumns.has(columnName) && !nonBooleanColumns.has(columnName);
|
|
126
|
-
columns.push({
|
|
127
|
-
name: columnName,
|
|
128
|
-
type: sqlType,
|
|
129
|
-
notNull: !typeArray.includes("NULL") && presence.get(columnName) === data.length,
|
|
130
|
-
valueType: isBooleanColumn ? "boolean" : void 0
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
const idColumn = columns.find((col) => col.name === "id");
|
|
134
|
-
if (idColumn) idColumn.primaryKey = true;
|
|
135
|
-
return ok({
|
|
136
|
-
name: tableName,
|
|
137
|
-
columns
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
static inferType(value) {
|
|
141
|
-
if (value === null || value === void 0) return "NULL";
|
|
142
|
-
if (typeof value === "number") return Number.isInteger(value) ? "INTEGER" : "REAL";
|
|
143
|
-
if (typeof value === "string") return "TEXT";
|
|
144
|
-
if (typeof value === "boolean") return "INTEGER";
|
|
145
|
-
if (typeof value === "object") return "JSON";
|
|
146
|
-
return "TEXT";
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region src/replace-file.ts
|
|
151
|
-
async function replaceFile(file, write, expected) {
|
|
152
|
-
const suffix = randomBytes(12).toString("hex");
|
|
153
|
-
const temporary = `${file}.${suffix}.tmp`;
|
|
154
|
-
const backup = `${file}.${suffix}.backup`;
|
|
155
|
-
let moved = false;
|
|
156
|
-
const conflict = () => Object.assign(/* @__PURE__ */ new Error(`JSONL file '${file}' changed during the write`), {
|
|
157
|
-
name: "JsonlConflictError",
|
|
158
|
-
file
|
|
159
|
-
});
|
|
160
|
-
try {
|
|
161
|
-
if (write) {
|
|
162
|
-
await write(temporary);
|
|
163
|
-
const mode = await stat(file).catch((error) => {
|
|
164
|
-
if (error.code === "ENOENT") return void 0;
|
|
165
|
-
throw error;
|
|
166
|
-
});
|
|
167
|
-
if (mode) await chmod(temporary, mode.mode & 4095);
|
|
168
|
-
}
|
|
169
|
-
if (expected !== void 0) {
|
|
170
|
-
await rename(file, backup).catch((error) => {
|
|
171
|
-
if (error.code === "ENOENT") throw conflict();
|
|
172
|
-
throw error;
|
|
173
|
-
});
|
|
174
|
-
moved = true;
|
|
175
|
-
if (await readFile(backup, "utf8") !== expected) throw conflict();
|
|
176
|
-
}
|
|
177
|
-
if (write) await link(temporary, file).catch((error) => {
|
|
178
|
-
if (error.code === "EEXIST") throw conflict();
|
|
179
|
-
throw error;
|
|
180
|
-
});
|
|
181
|
-
const cleanBackup = moved;
|
|
182
|
-
moved = false;
|
|
183
|
-
if (cleanBackup) await rm(backup).catch(() => {});
|
|
184
|
-
} catch (error) {
|
|
185
|
-
if (moved) try {
|
|
186
|
-
await link(backup, file);
|
|
187
|
-
moved = false;
|
|
188
|
-
await rm(backup).catch(() => {});
|
|
189
|
-
} catch (restoreError) {
|
|
190
|
-
if (error instanceof Error) {
|
|
191
|
-
error.message += `; original content remains in '${backup}' because it could not be restored`;
|
|
192
|
-
if (write) error.message += `; staged content remains in '${temporary}'`;
|
|
193
|
-
} else throw new Error(`Original content remains in '${backup}' because it could not be restored`, { cause: restoreError });
|
|
194
|
-
}
|
|
195
|
-
throw error;
|
|
196
|
-
} finally {
|
|
197
|
-
if (!moved) await rm(temporary, { force: true }).catch(() => {});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
//#endregion
|
|
201
|
-
export { ok as a, err as i, JsonlReader as n, toError as o, hashJsonlContent as r, unwrap as s, replaceFile as t };
|
|
202
|
-
|
|
203
|
-
//# sourceMappingURL=replace-file-AWLIm7aN.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replace-file-AWLIm7aN.mjs","names":[],"sources":["../src/result.ts","../src/jsonl-reader.ts","../src/replace-file.ts"],"sourcesContent":["/**\n * A discriminated union for operations that can fail without throwing.\n * Used throughout the JS programmatic API (`LinesDB`, `JsonlReader`) so callers get a typed\n * error back instead of having to wrap every call in try/catch.\n */\nexport type Result<T, E = Error> = { ok: true; value: T } | { ok: false; error: E };\n\nexport function ok<T>(value: T): Result<T, never> {\n return { ok: true, value };\n}\n\nexport function err<E>(error: E): Result<never, E> {\n return { ok: false, error };\n}\n\n/** Normalize a thrown value (which may not be an Error) into an Error. */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value));\n}\n\n/** Unwrap a Result, throwing its error when it is not ok. */\nexport function unwrap<T, E>(result: Result<T, E>): T {\n if (result.ok) return result.value;\n throw result.error;\n}\n","import { createHash } from 'node:crypto';\nimport { readFile } from 'node:fs/promises';\nimport { normalize } from 'node:path';\nimport type { JsonObject, ColumnDefinition, TableSchema, JsonlParseError } from './types.js';\nimport { type Result, ok, err, toError } from './result.js';\n\n/** Fingerprint of a JSONL file's content, to tell whether the file changed since it was read */\nexport function hashJsonlContent(content: string): string {\n return createHash('sha256').update(content).digest('hex');\n}\n\nexport interface JsonlSnapshot {\n /** The rows the content parses into, or why it does not parse */\n rows: Result<JsonObject[], JsonlParseError>;\n /** Undefined when the rows come from an override rather than the file */\n contentHash: string | undefined;\n}\n\nexport class JsonlReader {\n private static overrides: Map<string, JsonObject[]> | null = null;\n\n /**\n * Temporarily override the data returned for specific JSONL files.\n * Useful for scenarios like migration validation where in-memory data should be used.\n */\n static async withOverrides<T>(overrides: Map<string, JsonObject[]>, fn: () => Promise<T>): Promise<T> {\n const normalized = new Map<string, JsonObject[]>();\n for (const [filePath, rows] of overrides) {\n normalized.set(normalize(filePath), rows);\n }\n\n const previousOverrides = this.overrides;\n this.overrides = normalized;\n\n try {\n return await fn();\n } finally {\n this.overrides = previousOverrides;\n }\n }\n\n /**\n * Read JSONL file and parse each line as JSON\n */\n static async read(filePath: string): Promise<Result<JsonObject[], JsonlParseError | Error>> {\n const result = await this.readSnapshot(filePath);\n return result.ok ? result.value.rows : result;\n }\n\n /**\n * Read JSONL file like {@link read}, along with a hash of the content the rows were parsed from.\n * The hash is there even when the content does not parse.\n */\n static async readSnapshot(filePath: string): Promise<Result<JsonlSnapshot, Error>> {\n const overrideRows = this.overrides?.get(normalize(filePath));\n if (overrideRows) {\n // Return clones to avoid accidental mutations from consumers\n return ok({\n rows: ok(overrideRows.map((row) => JSON.parse(JSON.stringify(row)) as JsonObject)),\n contentHash: undefined,\n });\n }\n\n let content: string;\n try {\n content = await readFile(filePath, 'utf-8');\n } catch (error) {\n return err(toError(error));\n }\n\n return ok({ rows: this.parse(filePath, content), contentHash: hashJsonlContent(content) });\n }\n\n private static parse(filePath: string, content: string): Result<JsonObject[], JsonlParseError> {\n const rawLines = (content.startsWith('\\u{feff}') ? content.slice(1) : content).split('\\n');\n\n const rows: JsonObject[] = [];\n for (let i = 0; i < rawLines.length; i++) {\n const line = rawLines[i].endsWith('\\r') ? rawLines[i].slice(0, -1) : rawLines[i];\n if (line.trim().length === 0) continue;\n\n const fail = (message: string, cause?: unknown) => {\n const parseError = new Error(message, { cause }) as JsonlParseError;\n parseError.name = 'JsonlParseError';\n parseError.file = filePath;\n parseError.line = i + 1;\n return err(parseError);\n };\n let value: unknown;\n try {\n value = JSON.parse(line);\n } catch (error) {\n return fail(`Failed to parse JSON line: ${line}`, error);\n }\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return fail(`A JSONL line holds a row, which is a JSON object: ${line}`);\n }\n rows.push(value as JsonObject);\n }\n\n return ok(rows);\n }\n\n /**\n * Infer schema from JSONL data\n */\n static inferSchema(tableName: string, data: JsonObject[]): Result<TableSchema, Error> {\n if (data.length === 0) {\n return err(new Error('Cannot infer schema from empty data'));\n }\n\n const columnTypes = new Map<string, Set<string>>();\n const presence = new Map<string, number>();\n const booleanColumns = new Set<string>();\n const nonBooleanColumns = new Set<string>();\n\n // Collect all column names and their types\n for (const row of data) {\n for (const [key, value] of Object.entries(row)) {\n if (!columnTypes.has(key)) {\n columnTypes.set(key, new Set());\n }\n columnTypes.get(key)!.add(this.inferType(value));\n presence.set(key, (presence.get(key) ?? 0) + 1);\n\n if (typeof value === 'boolean') {\n booleanColumns.add(key);\n } else if (value !== null) {\n nonBooleanColumns.add(key);\n }\n }\n }\n\n // Convert to column definitions\n const columns: ColumnDefinition[] = [];\n for (const [columnName, types] of columnTypes.entries()) {\n const typeArray = Array.from(types);\n\n // If multiple types exist, prefer TEXT as a safe fallback\n let sqlType: ColumnDefinition['type'] = 'TEXT';\n\n if (typeArray.length === 1) {\n sqlType = typeArray[0] as ColumnDefinition['type'];\n } else if (typeArray.every((t) => t === 'INTEGER' || t === 'REAL')) {\n sqlType = 'REAL'; // Use REAL if we have mixed numeric types\n } else if (!typeArray.includes('NULL')) {\n // If there are multiple non-null types, use TEXT\n sqlType = 'TEXT';\n } else if (typeArray.length === 2 && typeArray.includes('NULL')) {\n // If one type + NULL, use the non-null type\n sqlType = typeArray.find((t) => t !== 'NULL') as ColumnDefinition['type'];\n }\n\n const isBooleanColumn = booleanColumns.has(columnName) && !nonBooleanColumns.has(columnName);\n\n columns.push({\n name: columnName,\n type: sqlType,\n // A row without the field stores null for it, so the field is nullable unless every row has it\n notNull: !typeArray.includes('NULL') && presence.get(columnName) === data.length,\n valueType: isBooleanColumn ? 'boolean' : undefined,\n });\n }\n\n // If there's an 'id' column, make it primary key\n const idColumn = columns.find((col) => col.name === 'id');\n if (idColumn) {\n idColumn.primaryKey = true;\n }\n\n return ok({\n name: tableName,\n columns,\n });\n }\n\n private static inferType(value: unknown): string {\n if (value === null || value === undefined) return 'NULL';\n if (typeof value === 'number') {\n return Number.isInteger(value) ? 'INTEGER' : 'REAL';\n }\n if (typeof value === 'string') return 'TEXT';\n if (typeof value === 'boolean') return 'INTEGER'; // SQLite stores booleans as integers\n if (typeof value === 'object') return 'JSON'; // Store objects/arrays as JSON\n return 'TEXT';\n }\n}\n","import { randomBytes } from 'node:crypto';\nimport { chmod, link, readFile, rename, rm, stat } from 'node:fs/promises';\nimport type { JsonlConflictError } from './types.js';\n\nexport async function replaceFile(\n file: string,\n write: ((temporary: string) => Promise<void>) | undefined,\n expected: string | undefined,\n): Promise<void> {\n const suffix = randomBytes(12).toString('hex');\n const temporary = `${file}.${suffix}.tmp`;\n const backup = `${file}.${suffix}.backup`;\n let moved = false;\n const conflict = () =>\n Object.assign(new Error(`JSONL file '${file}' changed during the write`), {\n name: 'JsonlConflictError',\n file,\n }) as JsonlConflictError;\n try {\n if (write) {\n await write(temporary);\n const mode = await stat(file).catch((error: NodeJS.ErrnoException) => {\n if (error.code === 'ENOENT') return undefined;\n throw error;\n });\n if (mode) await chmod(temporary, mode.mode & 0o7777);\n }\n if (expected !== undefined) {\n await rename(file, backup).catch((error: NodeJS.ErrnoException) => {\n if (error.code === 'ENOENT') throw conflict();\n throw error;\n });\n moved = true;\n if ((await readFile(backup, 'utf8')) !== expected) throw conflict();\n }\n if (write) {\n await link(temporary, file).catch((error: NodeJS.ErrnoException) => {\n if (error.code === 'EEXIST') throw conflict();\n throw error;\n });\n }\n const cleanBackup = moved;\n moved = false;\n if (cleanBackup) await rm(backup).catch(() => {});\n } catch (error) {\n if (moved) {\n try {\n await link(backup, file);\n moved = false;\n await rm(backup).catch(() => {});\n } catch (restoreError) {\n if (error instanceof Error) {\n error.message += `; original content remains in '${backup}' because it could not be restored`;\n if (write) error.message += `; staged content remains in '${temporary}'`;\n } else {\n throw new Error(`Original content remains in '${backup}' because it could not be restored`, {\n cause: restoreError,\n });\n }\n }\n }\n throw error;\n } finally {\n if (!moved) await rm(temporary, { force: true }).catch(() => {});\n }\n}\n"],"mappings":";;;;AAOA,SAAgB,GAAM,OAA4B;CAChD,OAAO;EAAE,IAAI;EAAM;CAAM;AAC3B;AAEA,SAAgB,IAAO,OAA4B;CACjD,OAAO;EAAE,IAAI;EAAO;CAAM;AAC5B;;AAGA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AACjE;;AAGA,SAAgB,OAAa,QAAyB;CACpD,IAAI,OAAO,IAAI,OAAO,OAAO;CAC7B,MAAM,OAAO;AACf;;;;ACjBA,SAAgB,iBAAiB,SAAyB;CACxD,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,OAAO,KAAK;AAC1D;AASA,IAAa,cAAb,MAAyB;CACvB,OAAe,YAA8C;;;;;CAM7D,aAAa,cAAiB,WAAsC,IAAkC;EACpG,MAAM,6BAAa,IAAI,IAA0B;EACjD,KAAK,MAAM,CAAC,UAAU,SAAS,WAC7B,WAAW,IAAI,UAAU,QAAQ,GAAG,IAAI;EAG1C,MAAM,oBAAoB,KAAK;EAC/B,KAAK,YAAY;EAEjB,IAAI;GACF,OAAO,MAAM,GAAG;EAClB,UAAU;GACR,KAAK,YAAY;EACnB;CACF;;;;CAKA,aAAa,KAAK,UAA0E;EAC1F,MAAM,SAAS,MAAM,KAAK,aAAa,QAAQ;EAC/C,OAAO,OAAO,KAAK,OAAO,MAAM,OAAO;CACzC;;;;;CAMA,aAAa,aAAa,UAAyD;EACjF,MAAM,eAAe,KAAK,WAAW,IAAI,UAAU,QAAQ,CAAC;EAC5D,IAAI,cAEF,OAAO,GAAG;GACR,MAAM,GAAG,aAAa,KAAK,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