@nymphjs/driver-postgresql 1.0.0-beta.6 → 1.0.0-beta.60

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