@nymphjs/driver-sqlite3 1.0.0-beta.80 → 1.0.0-beta.82
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 +14 -0
- package/README.md +1 -1
- package/dist/SQLite3Driver.d.ts +2 -2
- package/dist/SQLite3Driver.js +74 -80
- package/dist/SQLite3Driver.js.map +1 -1
- package/dist/SQLite3Driver.test.js +17 -22
- package/dist/SQLite3Driver.test.js.map +1 -1
- package/dist/conf/d.js +1 -2
- package/dist/conf/defaults.d.ts +1 -1
- package/dist/conf/defaults.js +1 -3
- package/dist/conf/defaults.js.map +1 -1
- package/dist/conf/index.d.ts +2 -2
- package/dist/conf/index.js +2 -8
- package/dist/conf/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -24
- package/dist/index.js.map +1 -1
- package/jest.config.js +12 -2
- package/package.json +14 -13
- package/src/SQLite3Driver.test.ts +1 -1
- package/src/SQLite3Driver.ts +20 -18
- package/src/conf/defaults.ts +1 -1
- package/src/conf/index.ts +2 -2
- package/src/index.ts +2 -2
- package/tsconfig.json +3 -1
package/src/SQLite3Driver.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { makeTableSuffix } from '@nymphjs/guid';
|
|
|
21
21
|
import {
|
|
22
22
|
SQLite3DriverConfig,
|
|
23
23
|
SQLite3DriverConfigDefaults as defaults,
|
|
24
|
-
} from './conf';
|
|
24
|
+
} from './conf/index.js';
|
|
25
25
|
|
|
26
26
|
class InternalStore {
|
|
27
27
|
public link: SQLite3.Database;
|
|
@@ -421,7 +421,7 @@ export default class SQLite3Driver extends NymphDriver {
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
private
|
|
424
|
+
private queryArray(
|
|
425
425
|
query: string,
|
|
426
426
|
{
|
|
427
427
|
etypes = [],
|
|
@@ -619,7 +619,7 @@ export default class SQLite3Driver extends NymphDriver {
|
|
|
619
619
|
}
|
|
620
620
|
|
|
621
621
|
// Export UIDs.
|
|
622
|
-
let uids: IterableIterator<any> = this.
|
|
622
|
+
let uids: IterableIterator<any> = this.queryArray(
|
|
623
623
|
`SELECT * FROM ${SQLite3Driver.escape(
|
|
624
624
|
`${this.prefix}uids`,
|
|
625
625
|
)} ORDER BY "name";`,
|
|
@@ -646,7 +646,7 @@ export default class SQLite3Driver extends NymphDriver {
|
|
|
646
646
|
}
|
|
647
647
|
|
|
648
648
|
// Get the etypes.
|
|
649
|
-
const tables: IterableIterator<any> = this.
|
|
649
|
+
const tables: IterableIterator<any> = this.queryArray(
|
|
650
650
|
"SELECT `name` FROM `sqlite_master` WHERE `type`='table' AND `name` LIKE @prefix;",
|
|
651
651
|
{
|
|
652
652
|
params: {
|
|
@@ -661,7 +661,7 @@ export default class SQLite3Driver extends NymphDriver {
|
|
|
661
661
|
|
|
662
662
|
for (const etype of etypes) {
|
|
663
663
|
// Export entities.
|
|
664
|
-
const dataIterator: IterableIterator<any> = this.
|
|
664
|
+
const dataIterator: IterableIterator<any> = this.queryArray(
|
|
665
665
|
`SELECT e.*, d."name", d."value", json(d."json") as "json", d."string", d."number" FROM ${SQLite3Driver.escape(
|
|
666
666
|
`${this.prefix}entities_${etype}`,
|
|
667
667
|
)} e LEFT JOIN ${SQLite3Driver.escape(
|
|
@@ -686,10 +686,10 @@ export default class SQLite3Driver extends NymphDriver {
|
|
|
686
686
|
datum.value.value === 'N'
|
|
687
687
|
? JSON.stringify(datum.value.number)
|
|
688
688
|
: datum.value.value === 'S'
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
689
|
+
? JSON.stringify(datum.value.string)
|
|
690
|
+
: datum.value.value === 'J'
|
|
691
|
+
? datum.value.json
|
|
692
|
+
: datum.value.value;
|
|
693
693
|
currentEntityExport.push(`\t${datum.value.name}=${value}`);
|
|
694
694
|
datum = dataIterator.next();
|
|
695
695
|
} while (!datum.done && datum.value.guid === guid);
|
|
@@ -1692,7 +1692,9 @@ export default class SQLite3Driver extends NymphDriver {
|
|
|
1692
1692
|
formattedSelectors,
|
|
1693
1693
|
etype,
|
|
1694
1694
|
);
|
|
1695
|
-
const result = this.
|
|
1695
|
+
const result = this.queryArray(query, { etypes, params })[
|
|
1696
|
+
Symbol.iterator
|
|
1697
|
+
]();
|
|
1696
1698
|
return {
|
|
1697
1699
|
result,
|
|
1698
1700
|
};
|
|
@@ -1743,10 +1745,10 @@ export default class SQLite3Driver extends NymphDriver {
|
|
|
1743
1745
|
row.value === 'N'
|
|
1744
1746
|
? JSON.stringify(row.number)
|
|
1745
1747
|
: row.value === 'S'
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1748
|
+
? JSON.stringify(row.string)
|
|
1749
|
+
: row.value === 'J'
|
|
1750
|
+
? row.json
|
|
1751
|
+
: row.value,
|
|
1750
1752
|
}),
|
|
1751
1753
|
);
|
|
1752
1754
|
const value = process();
|
|
@@ -1858,8 +1860,8 @@ export default class SQLite3Driver extends NymphDriver {
|
|
|
1858
1860
|
typeof uvalue === 'number'
|
|
1859
1861
|
? 'N'
|
|
1860
1862
|
: typeof uvalue === 'string'
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
+
? 'S'
|
|
1864
|
+
: 'J';
|
|
1863
1865
|
const jsonValue = storageValue === 'J' ? value : null;
|
|
1864
1866
|
this.queryRun(
|
|
1865
1867
|
`INSERT INTO ${SQLite3Driver.escape(
|
|
@@ -2078,8 +2080,8 @@ export default class SQLite3Driver extends NymphDriver {
|
|
|
2078
2080
|
typeof value === 'number'
|
|
2079
2081
|
? 'N'
|
|
2080
2082
|
: typeof value === 'string'
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
+
? 'S'
|
|
2084
|
+
: 'J';
|
|
2083
2085
|
const jsonValue = storageValue === 'J' ? svalue : null;
|
|
2084
2086
|
this.queryRun(
|
|
2085
2087
|
`INSERT INTO ${SQLite3Driver.escape(
|
package/src/conf/defaults.ts
CHANGED
package/src/conf/index.ts
CHANGED
package/src/index.ts
CHANGED
package/tsconfig.json
CHANGED