@nymphjs/driver-sqlite3 1.0.0-beta.6 → 1.0.0-beta.61

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 CHANGED
@@ -3,6 +3,256 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-beta.61](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.60...v1.0.0-beta.61) (2024-06-14)
7
+
8
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
9
+
10
+ # [1.0.0-beta.60](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.59...v1.0.0-beta.60) (2024-06-14)
11
+
12
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
13
+
14
+ # [1.0.0-beta.59](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.58...v1.0.0-beta.59) (2024-06-14)
15
+
16
+ ### Features
17
+
18
+ - add uniqueness constraint feature, refactor some types ([8133d32](https://github.com/sciactive/nymphjs/commit/8133d32b2c04907182dca2e9171b8217ed1b57e4))
19
+
20
+ # [1.0.0-beta.58](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.57...v1.0.0-beta.58) (2024-06-12)
21
+
22
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
23
+
24
+ # [1.0.0-beta.57](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.56...v1.0.0-beta.57) (2024-06-12)
25
+
26
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
27
+
28
+ # [1.0.0-beta.56](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.55...v1.0.0-beta.56) (2024-06-11)
29
+
30
+ ### Bug Fixes
31
+
32
+ - import entities without transaction ([db56609](https://github.com/sciactive/nymphjs/commit/db56609efaadc16d5d1bbc8e9b50084aa8a076b9))
33
+
34
+ ### Features
35
+
36
+ - make transaction optional during import and off by default ([08d79f8](https://github.com/sciactive/nymphjs/commit/08d79f8f803c846ac79c0c489fc754437dae082b))
37
+
38
+ # [1.0.0-beta.55](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.54...v1.0.0-beta.55) (2024-05-26)
39
+
40
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
41
+
42
+ # [1.0.0-beta.54](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.53...v1.0.0-beta.54) (2024-05-26)
43
+
44
+ ### Features
45
+
46
+ - add index to comparison string column in sqlite3 ([330a3e1](https://github.com/sciactive/nymphjs/commit/330a3e16997b8f6a69dc85fe124ac3a826a3abd9))
47
+
48
+ # [1.0.0-beta.53](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.52...v1.0.0-beta.53) (2024-05-26)
49
+
50
+ ### Features
51
+
52
+ - add pragma statements config to sqlite3 driver ([b0f27e2](https://github.com/sciactive/nymphjs/commit/b0f27e24df85663ea777565e5d352775efcad858))
53
+
54
+ # [1.0.0-beta.52](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.51...v1.0.0-beta.52) (2024-05-25)
55
+
56
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
57
+
58
+ # [1.0.0-beta.51](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.50...v1.0.0-beta.51) (2024-04-12)
59
+
60
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
61
+
62
+ # [1.0.0-beta.50](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.49...v1.0.0-beta.50) (2024-04-08)
63
+
64
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
65
+
66
+ # [1.0.0-beta.49](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.48...v1.0.0-beta.49) (2024-03-04)
67
+
68
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
69
+
70
+ # [1.0.0-beta.48](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.47...v1.0.0-beta.48) (2023-11-10)
71
+
72
+ ### Bug Fixes
73
+
74
+ - avoid trying to roll back a transaction twice ([e26ef31](https://github.com/sciactive/nymphjs/commit/e26ef312b617edcc715c81e7f92875dfaa7a904a))
75
+
76
+ # [1.0.0-beta.47](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.46...v1.0.0-beta.47) (2023-11-10)
77
+
78
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
79
+
80
+ # [1.0.0-beta.46](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.45...v1.0.0-beta.46) (2023-08-29)
81
+
82
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
83
+
84
+ # [1.0.0-beta.45](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.44...v1.0.0-beta.45) (2023-07-17)
85
+
86
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
87
+
88
+ # [1.0.0-beta.44](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.43...v1.0.0-beta.44) (2023-07-13)
89
+
90
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
91
+
92
+ # [1.0.0-beta.43](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.42...v1.0.0-beta.43) (2023-07-12)
93
+
94
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
95
+
96
+ # [1.0.0-beta.42](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.41...v1.0.0-beta.42) (2023-07-12)
97
+
98
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
99
+
100
+ # [1.0.0-beta.41](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.40...v1.0.0-beta.41) (2023-07-12)
101
+
102
+ ### Features
103
+
104
+ - remove synchronous database queries ([b579fb2](https://github.com/sciactive/nymphjs/commit/b579fb2eacd96cdd1b386a62c5c00cdbb2438f6e))
105
+
106
+ # [1.0.0-beta.40](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.39...v1.0.0-beta.40) (2023-07-10)
107
+
108
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
109
+
110
+ # [1.0.0-beta.39](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.38...v1.0.0-beta.39) (2023-07-09)
111
+
112
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
113
+
114
+ # [1.0.0-beta.38](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.37...v1.0.0-beta.38) (2023-07-09)
115
+
116
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
117
+
118
+ # [1.0.0-beta.37](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.36...v1.0.0-beta.37) (2023-07-09)
119
+
120
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
121
+
122
+ # [1.0.0-beta.36](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.35...v1.0.0-beta.36) (2023-07-09)
123
+
124
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
125
+
126
+ # [1.0.0-beta.35](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.34...v1.0.0-beta.35) (2023-06-14)
127
+
128
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
129
+
130
+ # [1.0.0-beta.34](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.33...v1.0.0-beta.34) (2023-05-13)
131
+
132
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
133
+
134
+ # [1.0.0-beta.33](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.32...v1.0.0-beta.33) (2023-05-13)
135
+
136
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
137
+
138
+ # [1.0.0-beta.32](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.31...v1.0.0-beta.32) (2023-05-13)
139
+
140
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
141
+
142
+ # [1.0.0-beta.31](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.30...v1.0.0-beta.31) (2023-05-12)
143
+
144
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
145
+
146
+ # [1.0.0-beta.30](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.29...v1.0.0-beta.30) (2023-05-12)
147
+
148
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
149
+
150
+ # [1.0.0-beta.29](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.28...v1.0.0-beta.29) (2023-05-08)
151
+
152
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
153
+
154
+ # [1.0.0-beta.28](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2023-05-05)
155
+
156
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
157
+
158
+ # [1.0.0-beta.27](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2023-05-04)
159
+
160
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
161
+
162
+ # [1.0.0-beta.26](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.25...v1.0.0-beta.26) (2023-05-04)
163
+
164
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
165
+
166
+ # [1.0.0-beta.25](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.24...v1.0.0-beta.25) (2023-05-04)
167
+
168
+ ### Bug Fixes
169
+
170
+ - don't create empty entities ([1d4d2e9](https://github.com/sciactive/nymphjs/commit/1d4d2e99af2e9cdc647bcf58ac34572836f41176))
171
+
172
+ # [1.0.0-beta.24](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.23...v1.0.0-beta.24) (2023-05-02)
173
+
174
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
175
+
176
+ # [1.0.0-beta.23](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.22...v1.0.0-beta.23) (2023-05-02)
177
+
178
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
179
+
180
+ # [1.0.0-beta.22](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.21...v1.0.0-beta.22) (2023-05-01)
181
+
182
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
183
+
184
+ # [1.0.0-beta.21](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.20...v1.0.0-beta.21) (2023-05-01)
185
+
186
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
187
+
188
+ # [1.0.0-beta.20](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.19...v1.0.0-beta.20) (2023-04-30)
189
+
190
+ ### Features
191
+
192
+ - let the user revoke all current auth tokens ([63af3b9](https://github.com/sciactive/nymphjs/commit/63af3b9a31c6c221ab40c2c8a69231675f4634a2))
193
+
194
+ # [1.0.0-beta.19](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.18...v1.0.0-beta.19) (2023-04-29)
195
+
196
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
197
+
198
+ # [1.0.0-beta.18](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2023-04-27)
199
+
200
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
201
+
202
+ # [1.0.0-beta.17](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.16...v1.0.0-beta.17) (2023-04-24)
203
+
204
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
205
+
206
+ # [1.0.0-beta.16](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.15...v1.0.0-beta.16) (2023-03-31)
207
+
208
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
209
+
210
+ # [1.0.0-beta.15](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.14...v1.0.0-beta.15) (2023-03-23)
211
+
212
+ ### Features
213
+
214
+ - add option to sort results by a property ([16384e7](https://github.com/sciactive/nymphjs/commit/16384e7bdab88abb55ccccabb06ac09f92fa8a03))
215
+
216
+ # [1.0.0-beta.14](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.13...v1.0.0-beta.14) (2023-03-17)
217
+
218
+ ### Bug Fixes
219
+
220
+ - run pragma and function on write link on new sqlite3 db ([6c28ba1](https://github.com/sciactive/nymphjs/commit/6c28ba1a396f7cec098d4e550c7b82c93979eaec))
221
+
222
+ # [1.0.0-beta.13](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2023-03-16)
223
+
224
+ ### Features
225
+
226
+ - open sqlite in readonly unless actively writing to db ([0443b91](https://github.com/sciactive/nymphjs/commit/0443b9188df3ebd557b96baf873abc4e4ddd9137))
227
+
228
+ # [1.0.0-beta.12](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.11...v1.0.0-beta.12) (2023-03-04)
229
+
230
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
231
+
232
+ # [1.0.0-beta.11](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.10...v1.0.0-beta.11) (2023-02-27)
233
+
234
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
235
+
236
+ # [1.0.0-beta.10](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.9...v1.0.0-beta.10) (2023-01-19)
237
+
238
+ ### Features
239
+
240
+ - add wal mode setting to sqlite driver ([0071d66](https://github.com/sciactive/nymphjs/commit/0071d6628534b8b35d49c0238a99fe143fd03207))
241
+
242
+ # [1.0.0-beta.9](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2023-01-09)
243
+
244
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
245
+
246
+ # [1.0.0-beta.8](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2023-01-09)
247
+
248
+ **Note:** Version bump only for package @nymphjs/driver-sqlite3
249
+
250
+ # [1.0.0-beta.7](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.6...v1.0.0-beta.7) (2023-01-05)
251
+
252
+ ### Bug Fixes
253
+
254
+ - sqlite transaction returns wrong instance of nymph if it has been cloned ([b278c76](https://github.com/sciactive/nymphjs/commit/b278c7633722cb1cca7a941187ae2f1ff8ebdc7b))
255
+
6
256
  # [1.0.0-beta.6](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.5...v1.0.0-beta.6) (2023-01-05)
7
257
 
8
258
  **Note:** Version bump only for package @nymphjs/driver-sqlite3
@@ -1,19 +1,53 @@
1
1
  import SQLite3 from 'better-sqlite3';
2
- import { NymphDriver, EntityConstructor, EntityInterface, FormattedSelector, Options, Selector } from '@nymphjs/nymph';
2
+ import { NymphDriver, type EntityConstructor, type EntityInterface, type EntityInstanceType, type FormattedSelector, type Options, type Selector } from '@nymphjs/nymph';
3
3
  import { SQLite3DriverConfig } from './conf';
4
+ declare class InternalStore {
5
+ link: SQLite3.Database;
6
+ linkWrite?: SQLite3.Database;
7
+ connected: boolean;
8
+ transactionsStarted: number;
9
+ constructor(link: SQLite3.Database);
10
+ }
11
+ /**
12
+ * The SQLite3 Nymph database driver.
13
+ */
4
14
  export default class SQLite3Driver extends NymphDriver {
5
15
  config: SQLite3DriverConfig;
6
16
  protected prefix: string;
7
- protected connected: boolean;
8
- protected link: SQLite3.Database;
9
- protected transactionsStarted: number;
17
+ protected store: InternalStore;
10
18
  static escape(input: string): string;
11
- constructor(config: Partial<SQLite3DriverConfig>);
12
- connect(): Promise<true>;
19
+ constructor(config: Partial<SQLite3DriverConfig>, store?: InternalStore);
20
+ /**
21
+ * This is used internally by Nymph. Don't call it yourself.
22
+ *
23
+ * @returns A clone of this instance.
24
+ */
25
+ clone(): SQLite3Driver;
26
+ /**
27
+ * Connect to the SQLite3 database.
28
+ *
29
+ * @returns Whether this instance is connected to a SQLite3 database.
30
+ */
31
+ connect(): Promise<boolean>;
32
+ private _connect;
33
+ /**
34
+ * Disconnect from the SQLite3 database.
35
+ *
36
+ * @returns Whether this instance is connected to a SQLite3 database.
37
+ */
13
38
  disconnect(): Promise<false>;
14
39
  inTransaction(): Promise<boolean>;
40
+ /**
41
+ * Check connection status.
42
+ *
43
+ * @returns Whether this instance is connected to a SQLite3 database.
44
+ */
15
45
  isConnected(): boolean;
16
- private checkReadOnlyMode;
46
+ /**
47
+ * Create entity tables in the database.
48
+ *
49
+ * @param etype The entity type to create a table for. If this is blank, the default tables are created.
50
+ */
17
51
  private createTables;
18
52
  private query;
19
53
  private queryIter;
@@ -23,6 +57,16 @@ export default class SQLite3Driver extends NymphDriver {
23
57
  deleteEntityByID(guid: string, className?: EntityConstructor | string | null): Promise<boolean>;
24
58
  deleteUID(name: string): Promise<boolean>;
25
59
  protected exportEntities(writeLine: (line: string) => void): Promise<void>;
60
+ /**
61
+ * Generate the SQLite3 query.
62
+ * @param options The options array.
63
+ * @param formattedSelectors The formatted selector array.
64
+ * @param etype
65
+ * @param count Used to track internal params.
66
+ * @param params Used to store internal params.
67
+ * @param subquery Whether only a subquery should be returned.
68
+ * @returns The SQL query.
69
+ */
26
70
  private makeEntityQuery;
27
71
  protected performQuery(options: Options, formattedSelectors: FormattedSelector[], etype: string): {
28
72
  result: any;
@@ -33,16 +77,9 @@ export default class SQLite3Driver extends NymphDriver {
33
77
  getEntities<T extends EntityConstructor = EntityConstructor>(options: Options<T> & {
34
78
  return: 'guid';
35
79
  }, ...selectors: Selector[]): Promise<string[]>;
36
- getEntities<T extends EntityConstructor = EntityConstructor>(options?: Options<T>, ...selectors: Selector[]): Promise<ReturnType<T['factorySync']>[]>;
37
- protected getEntitiesSync<T extends EntityConstructor = EntityConstructor>(options: Options<T> & {
38
- return: 'count';
39
- }, ...selectors: Selector[]): number;
40
- protected getEntitiesSync<T extends EntityConstructor = EntityConstructor>(options: Options<T> & {
41
- return: 'guid';
42
- }, ...selectors: Selector[]): string[];
43
- protected getEntitiesSync<T extends EntityConstructor = EntityConstructor>(options?: Options<T>, ...selectors: Selector[]): ReturnType<T['factorySync']>[];
80
+ getEntities<T extends EntityConstructor = EntityConstructor>(options?: Options<T>, ...selectors: Selector[]): Promise<EntityInstanceType<T>[]>;
44
81
  getUID(name: string): Promise<number | null>;
45
- import(filename: string): Promise<boolean>;
82
+ import(filename: string, transaction?: boolean): Promise<boolean>;
46
83
  newUID(name: string): Promise<number>;
47
84
  renameUID(oldName: string, newName: string): Promise<boolean>;
48
85
  rollback(name: string): Promise<boolean>;
@@ -50,3 +87,4 @@ export default class SQLite3Driver extends NymphDriver {
50
87
  setUID(name: string, curUid: number): Promise<boolean>;
51
88
  startTransaction(name: string): Promise<import("@nymphjs/nymph").Nymph>;
52
89
  }
90
+ export {};