spindb 0.68.9 → 0.68.10
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/config/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../config/version.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../config/version.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAA"}
|
|
@@ -28,7 +28,11 @@
|
|
|
28
28
|
* `json_valid()`.
|
|
29
29
|
*
|
|
30
30
|
* Every rule is line-oriented, so a multi-gigabyte dump is rewritten as a
|
|
31
|
-
* stream and never held in memory.
|
|
31
|
+
* stream and never held in memory. The rules are applied through a small
|
|
32
|
+
* statement-aware wrapper (`createMariaDbDumpNormalizer`) rather than to each
|
|
33
|
+
* line in isolation, because `mariadb-dump` writes an extended insert across
|
|
34
|
+
* many lines and only the first of them starts with the `INSERT` keyword the
|
|
35
|
+
* row guard matches on.
|
|
32
36
|
*/
|
|
33
37
|
import { createReadStream, createWriteStream } from 'fs';
|
|
34
38
|
import { createInterface } from 'readline';
|
|
@@ -125,6 +129,11 @@ export function normalizeMariaDbDumpForMysql(line) {
|
|
|
125
129
|
// target than the source holds - the exact outcome the sql_mode rule below
|
|
126
130
|
// already refuses. No INSERT or REPLACE in a dump carries a collation that
|
|
127
131
|
// needs converting, so the whole line is left alone.
|
|
132
|
+
//
|
|
133
|
+
// This guard only sees the line that carries the keyword. An extended insert
|
|
134
|
+
// spans many lines and only the first one starts with `INSERT`, so the rest
|
|
135
|
+
// of the statement is protected by `createMariaDbDumpNormalizer`, not here.
|
|
136
|
+
// Call that, not this, to rewrite a real dump.
|
|
128
137
|
if (ROW_STATEMENT.test(line)) {
|
|
129
138
|
return { line, counts };
|
|
130
139
|
}
|
|
@@ -154,7 +163,61 @@ export function normalizeMariaDbDumpForMysql(line) {
|
|
|
154
163
|
return { line: result, counts };
|
|
155
164
|
}
|
|
156
165
|
/**
|
|
157
|
-
*
|
|
166
|
+
* A statement-aware normalizer over the pure line rules.
|
|
167
|
+
*
|
|
168
|
+
* `mariadb-dump` 11.x writes an extended insert as one statement spread over
|
|
169
|
+
* many lines, one row per line:
|
|
170
|
+
*
|
|
171
|
+
* ```sql
|
|
172
|
+
* INSERT INTO `t_text` VALUES
|
|
173
|
+
* (1,'moved the table to utf8mb4_uca1400_ai_ci last week'),
|
|
174
|
+
* (2,'sql_mode was STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER before');
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* Only the first line starts with `INSERT`, so a per-line row guard protects
|
|
178
|
+
* that line and none of the rows under it: a row whose own text names a
|
|
179
|
+
* uca1400 collation was rewritten and arrived in MySQL saying something the
|
|
180
|
+
* source never said. (The `NO_AUTO_CREATE_USER` rule survived this only
|
|
181
|
+
* because it is anchored to a `SET sql_mode` context, which a row line has
|
|
182
|
+
* no reason to match.)
|
|
183
|
+
*
|
|
184
|
+
* So the row guard is carried across lines: once a row statement opens, every
|
|
185
|
+
* line passes through untouched until the statement terminates.
|
|
186
|
+
*
|
|
187
|
+
* **Termination is "the trimmed line ends with `;`".** That is safe for a
|
|
188
|
+
* dump, and only for a dump: `mariadb-dump` (and `mysqldump`) escape `\n` and
|
|
189
|
+
* `\r` inside string literals, so a value never ends a physical line, and the
|
|
190
|
+
* generator always closes the statement at the end of its own line. A
|
|
191
|
+
* hand-written SQL file could end a line with a `;` inside a string literal
|
|
192
|
+
* and close the guard early; a dump cannot, and a dump is the only input this
|
|
193
|
+
* converts.
|
|
194
|
+
*
|
|
195
|
+
* Deliberately unchanged: `LOAD DATA` and a bare `VALUES` statement are not
|
|
196
|
+
* treated as row statements (`mariadb-dump` emits neither in the output we
|
|
197
|
+
* convert, and the rules do not corrupt them), and `/*!...*\/` versioned
|
|
198
|
+
* comment lines keep taking the ordinary rules, which is what strips
|
|
199
|
+
* `NO_AUTO_CREATE_USER` out of the `/*!50003 SET sql_mode = ... *\/` line
|
|
200
|
+
* around every trigger.
|
|
201
|
+
*/
|
|
202
|
+
export function createMariaDbDumpNormalizer() {
|
|
203
|
+
let inRowStatement = false;
|
|
204
|
+
return {
|
|
205
|
+
next(line) {
|
|
206
|
+
const terminates = line.trim().endsWith(';');
|
|
207
|
+
if (inRowStatement) {
|
|
208
|
+
if (terminates)
|
|
209
|
+
inRowStatement = false;
|
|
210
|
+
return { line, counts: emptyNormalizationCounts() };
|
|
211
|
+
}
|
|
212
|
+
const normalized = normalizeMariaDbDumpForMysql(line);
|
|
213
|
+
if (ROW_STATEMENT.test(line) && !terminates)
|
|
214
|
+
inRowStatement = true;
|
|
215
|
+
return normalized;
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Stream a MariaDB dump through `createMariaDbDumpNormalizer`, writing the
|
|
158
221
|
* MySQL-ready result to a new file.
|
|
159
222
|
*
|
|
160
223
|
* Line by line with explicit backpressure: a dump is routinely larger than the
|
|
@@ -177,9 +240,10 @@ export async function normalizeMariaDbDumpFile(options) {
|
|
|
177
240
|
const input = createReadStream(inputPath, { encoding: 'latin1' });
|
|
178
241
|
const output = createWriteStream(outputPath, { encoding: 'latin1' });
|
|
179
242
|
const lines = createInterface({ input, crlfDelay: Infinity });
|
|
243
|
+
const normalizer = createMariaDbDumpNormalizer();
|
|
180
244
|
try {
|
|
181
245
|
for await (const line of lines) {
|
|
182
|
-
const normalized =
|
|
246
|
+
const normalized = normalizer.next(line);
|
|
183
247
|
counts.collationsMapped += normalized.counts.collationsMapped;
|
|
184
248
|
counts.sqlModeFlagsRemoved += normalized.counts.sqlModeFlagsRemoved;
|
|
185
249
|
counts.sandboxDirectivesDropped +=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dump-normalize.js","sourceRoot":"","sources":["../../../engines/mysql/dump-normalize.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"dump-normalize.js","sourceRoot":"","sources":["../../../engines/mysql/dump-normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAkB7B,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL,gBAAgB,EAAE,CAAC;QACnB,mBAAmB,EAAE,CAAC;QACtB,wBAAwB,EAAE,CAAC;KAC5B,CAAA;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAA+B;IAC3D,OAAO,CACL,MAAM,CAAC,gBAAgB;QACvB,MAAM,CAAC,mBAAmB;QAC1B,MAAM,CAAC,wBAAwB,CAChC,CAAA;AACH,CAAC;AAED,yEAAyE;AACzE,2EAA2E;AAC3E,8EAA8E;AAC9E,iEAAiE;AACjE,MAAM,kBAAkB,GAA2B;IACjD,KAAK,EAAE,oBAAoB;IAC3B,KAAK,EAAE,oBAAoB;IAC3B,KAAK,EAAE,oBAAoB;IAC3B,KAAK,EAAE,oBAAoB;CAC5B,CAAA;AAED,4EAA4E;AAC5E,6EAA6E;AAC7E,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;AAE3D,MAAM,gBAAgB,GAAG,oBAAoB,CAAA;AAC7C,MAAM,gBAAgB,GAAG,oBAAoB,CAAA;AAC7C,8EAA8E;AAC9E,gFAAgF;AAChF,6EAA6E;AAC7E,gEAAgE;AAChE,MAAM,sBAAsB,GAAG,aAAa,CAAA;AAE5C,MAAM,eAAe,GAAG,kCAAkC,CAAA;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MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACxC,MAAM,CAAC,gBAAgB,IAAI,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAA;YAC7D,MAAM,CAAC,mBAAmB,IAAI,UAAU,CAAC,MAAM,CAAC,mBAAmB,CAAA;YACnE,MAAM,CAAC,wBAAwB;gBAC7B,UAAU,CAAC,MAAM,CAAC,wBAAwB,CAAA;YAE5C,IAAI,UAAU,CAAC,IAAI,KAAK,IAAI;gBAAE,SAAQ;YACtC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC;gBAC1C,MAAM,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,KAAK,CAAC,KAAK,EAAE,CAAA;QACb,MAAM,CAAC,GAAG,EAAE,CAAA;IACd,CAAC;IAED,MAAM,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC3B,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spindb",
|
|
3
|
-
"version": "0.68.
|
|
3
|
+
"version": "0.68.10",
|
|
4
4
|
"author": "Bob Bass <bob@bbass.co>",
|
|
5
5
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"description": "Zero-config Docker-free local database containers. Create, backup, and clone a variety of popular databases.",
|