@twin.org/entity-storage-connector-postgresql 0.0.3-next.1 → 0.0.3-next.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/README.md +7 -12
- package/dist/es/postgreSqlEntityStorageConnector.js +326 -54
- package/dist/es/postgreSqlEntityStorageConnector.js.map +1 -1
- package/dist/types/postgreSqlEntityStorageConnector.d.ts +37 -3
- package/docs/changelog.md +188 -44
- package/docs/examples.md +98 -1
- package/docs/reference/classes/PostgreSqlEntityStorageConnector.md +149 -13
- package/docs/reference/interfaces/IPostgreSqlEntityStorageConnectorConfig.md +7 -7
- package/docs/reference/interfaces/IPostgreSqlEntityStorageConnectorConstructorOptions.md +6 -6
- package/locales/en.json +15 -2
- package/package.json +6 -6
|
@@ -34,7 +34,7 @@ The options for the connector.
|
|
|
34
34
|
|
|
35
35
|
## Properties
|
|
36
36
|
|
|
37
|
-
### CLASS\_NAME
|
|
37
|
+
### CLASS\_NAME {#class_name}
|
|
38
38
|
|
|
39
39
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
40
40
|
|
|
@@ -42,7 +42,7 @@ Runtime name for the class.
|
|
|
42
42
|
|
|
43
43
|
## Methods
|
|
44
44
|
|
|
45
|
-
### bootstrap()
|
|
45
|
+
### bootstrap() {#bootstrap}
|
|
46
46
|
|
|
47
47
|
> **bootstrap**(`nodeLoggingComponentType?`): `Promise`\<`boolean`\>
|
|
48
48
|
|
|
@@ -68,7 +68,7 @@ A promise that resolves to a boolean indicating success.
|
|
|
68
68
|
|
|
69
69
|
***
|
|
70
70
|
|
|
71
|
-
### className()
|
|
71
|
+
### className() {#classname}
|
|
72
72
|
|
|
73
73
|
> **className**(): `string`
|
|
74
74
|
|
|
@@ -86,7 +86,43 @@ The class name of the component.
|
|
|
86
86
|
|
|
87
87
|
***
|
|
88
88
|
|
|
89
|
-
###
|
|
89
|
+
### health() {#health}
|
|
90
|
+
|
|
91
|
+
> **health**(): `Promise`\<`IHealth`[]\>
|
|
92
|
+
|
|
93
|
+
Get the health of the component.
|
|
94
|
+
|
|
95
|
+
#### Returns
|
|
96
|
+
|
|
97
|
+
`Promise`\<`IHealth`[]\>
|
|
98
|
+
|
|
99
|
+
The health of the component.
|
|
100
|
+
|
|
101
|
+
#### Implementation of
|
|
102
|
+
|
|
103
|
+
`IEntityStorageConnector.health`
|
|
104
|
+
|
|
105
|
+
***
|
|
106
|
+
|
|
107
|
+
### stop() {#stop}
|
|
108
|
+
|
|
109
|
+
> **stop**(): `Promise`\<`void`\>
|
|
110
|
+
|
|
111
|
+
The component needs to be stopped when the node is closed.
|
|
112
|
+
|
|
113
|
+
#### Returns
|
|
114
|
+
|
|
115
|
+
`Promise`\<`void`\>
|
|
116
|
+
|
|
117
|
+
Nothing.
|
|
118
|
+
|
|
119
|
+
#### Implementation of
|
|
120
|
+
|
|
121
|
+
`IEntityStorageConnector.stop`
|
|
122
|
+
|
|
123
|
+
***
|
|
124
|
+
|
|
125
|
+
### getSchema() {#getschema}
|
|
90
126
|
|
|
91
127
|
> **getSchema**(): `IEntitySchema`
|
|
92
128
|
|
|
@@ -104,7 +140,7 @@ The schema for the entities.
|
|
|
104
140
|
|
|
105
141
|
***
|
|
106
142
|
|
|
107
|
-
### get()
|
|
143
|
+
### get() {#get}
|
|
108
144
|
|
|
109
145
|
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
|
|
110
146
|
|
|
@@ -142,7 +178,7 @@ The object if it can be found or undefined.
|
|
|
142
178
|
|
|
143
179
|
***
|
|
144
180
|
|
|
145
|
-
### set()
|
|
181
|
+
### set() {#set}
|
|
146
182
|
|
|
147
183
|
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
148
184
|
|
|
@@ -174,7 +210,51 @@ The id of the entity.
|
|
|
174
210
|
|
|
175
211
|
***
|
|
176
212
|
|
|
177
|
-
###
|
|
213
|
+
### setBatch() {#setbatch}
|
|
214
|
+
|
|
215
|
+
> **setBatch**(`entities`): `Promise`\<`void`\>
|
|
216
|
+
|
|
217
|
+
Set multiple entities in a batch.
|
|
218
|
+
|
|
219
|
+
#### Parameters
|
|
220
|
+
|
|
221
|
+
##### entities
|
|
222
|
+
|
|
223
|
+
`T`[]
|
|
224
|
+
|
|
225
|
+
The entities to set.
|
|
226
|
+
|
|
227
|
+
#### Returns
|
|
228
|
+
|
|
229
|
+
`Promise`\<`void`\>
|
|
230
|
+
|
|
231
|
+
Nothing.
|
|
232
|
+
|
|
233
|
+
#### Implementation of
|
|
234
|
+
|
|
235
|
+
`IEntityStorageConnector.setBatch`
|
|
236
|
+
|
|
237
|
+
***
|
|
238
|
+
|
|
239
|
+
### empty() {#empty}
|
|
240
|
+
|
|
241
|
+
> **empty**(): `Promise`\<`void`\>
|
|
242
|
+
|
|
243
|
+
Empty all the entities.
|
|
244
|
+
|
|
245
|
+
#### Returns
|
|
246
|
+
|
|
247
|
+
`Promise`\<`void`\>
|
|
248
|
+
|
|
249
|
+
Nothing.
|
|
250
|
+
|
|
251
|
+
#### Implementation of
|
|
252
|
+
|
|
253
|
+
`IEntityStorageConnector.empty`
|
|
254
|
+
|
|
255
|
+
***
|
|
256
|
+
|
|
257
|
+
### remove() {#remove}
|
|
178
258
|
|
|
179
259
|
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
180
260
|
|
|
@@ -206,7 +286,59 @@ Nothing.
|
|
|
206
286
|
|
|
207
287
|
***
|
|
208
288
|
|
|
209
|
-
###
|
|
289
|
+
### removeBatch() {#removebatch}
|
|
290
|
+
|
|
291
|
+
> **removeBatch**(`ids`): `Promise`\<`void`\>
|
|
292
|
+
|
|
293
|
+
Remove multiple entities by their primary key IDs.
|
|
294
|
+
|
|
295
|
+
#### Parameters
|
|
296
|
+
|
|
297
|
+
##### ids
|
|
298
|
+
|
|
299
|
+
`string`[]
|
|
300
|
+
|
|
301
|
+
The ids of the entities to remove.
|
|
302
|
+
|
|
303
|
+
#### Returns
|
|
304
|
+
|
|
305
|
+
`Promise`\<`void`\>
|
|
306
|
+
|
|
307
|
+
Nothing.
|
|
308
|
+
|
|
309
|
+
#### Implementation of
|
|
310
|
+
|
|
311
|
+
`IEntityStorageConnector.removeBatch`
|
|
312
|
+
|
|
313
|
+
***
|
|
314
|
+
|
|
315
|
+
### teardown() {#teardown}
|
|
316
|
+
|
|
317
|
+
> **teardown**(`nodeLoggingComponentType?`): `Promise`\<`boolean`\>
|
|
318
|
+
|
|
319
|
+
Teardown the entity storage by dropping the table.
|
|
320
|
+
|
|
321
|
+
#### Parameters
|
|
322
|
+
|
|
323
|
+
##### nodeLoggingComponentType?
|
|
324
|
+
|
|
325
|
+
`string`
|
|
326
|
+
|
|
327
|
+
The node logging component type.
|
|
328
|
+
|
|
329
|
+
#### Returns
|
|
330
|
+
|
|
331
|
+
`Promise`\<`boolean`\>
|
|
332
|
+
|
|
333
|
+
True if the teardown process was successful.
|
|
334
|
+
|
|
335
|
+
#### Implementation of
|
|
336
|
+
|
|
337
|
+
`IEntityStorageConnector.teardown`
|
|
338
|
+
|
|
339
|
+
***
|
|
340
|
+
|
|
341
|
+
### query() {#query}
|
|
210
342
|
|
|
211
343
|
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
212
344
|
|
|
@@ -257,14 +389,18 @@ and a cursor which can be used to request more entities.
|
|
|
257
389
|
|
|
258
390
|
***
|
|
259
391
|
|
|
260
|
-
###
|
|
392
|
+
### count() {#count}
|
|
261
393
|
|
|
262
|
-
> **
|
|
394
|
+
> **count**(): `Promise`\<`number`\>
|
|
263
395
|
|
|
264
|
-
|
|
396
|
+
Count all the entities which match the conditions.
|
|
265
397
|
|
|
266
398
|
#### Returns
|
|
267
399
|
|
|
268
|
-
`Promise`\<`
|
|
400
|
+
`Promise`\<`number`\>
|
|
269
401
|
|
|
270
|
-
|
|
402
|
+
The total count of entities in the storage.
|
|
403
|
+
|
|
404
|
+
#### Implementation of
|
|
405
|
+
|
|
406
|
+
`IEntityStorageConnector.count`
|
|
@@ -4,7 +4,7 @@ Configuration for the PostgreSql Entity Storage Connector.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### host
|
|
7
|
+
### host {#host}
|
|
8
8
|
|
|
9
9
|
> **host**: `string`
|
|
10
10
|
|
|
@@ -12,15 +12,15 @@ The host for the PostgreSql instance.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### port?
|
|
15
|
+
### port? {#port}
|
|
16
16
|
|
|
17
|
-
> `optional` **port
|
|
17
|
+
> `optional` **port?**: `number`
|
|
18
18
|
|
|
19
19
|
The port for the PostgreSql instance.
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
23
|
-
### user
|
|
23
|
+
### user {#user}
|
|
24
24
|
|
|
25
25
|
> **user**: `string`
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ The user for the PostgreSql instance.
|
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
31
|
-
### password
|
|
31
|
+
### password {#password}
|
|
32
32
|
|
|
33
33
|
> **password**: `string`
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ The password for the PostgreSql instance.
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### database
|
|
39
|
+
### database {#database}
|
|
40
40
|
|
|
41
41
|
> **database**: `string`
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ The name of the database to be used.
|
|
|
44
44
|
|
|
45
45
|
***
|
|
46
46
|
|
|
47
|
-
### tableName
|
|
47
|
+
### tableName {#tablename}
|
|
48
48
|
|
|
49
49
|
> **tableName**: `string`
|
|
50
50
|
|
|
@@ -4,7 +4,7 @@ The options for the PostgreSql entity storage connector constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### entitySchema
|
|
7
|
+
### entitySchema {#entityschema}
|
|
8
8
|
|
|
9
9
|
> **entitySchema**: `string`
|
|
10
10
|
|
|
@@ -12,17 +12,17 @@ The schema for the entity.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### partitionContextIds?
|
|
15
|
+
### partitionContextIds? {#partitioncontextids}
|
|
16
16
|
|
|
17
|
-
> `optional` **partitionContextIds
|
|
17
|
+
> `optional` **partitionContextIds?**: `string`[]
|
|
18
18
|
|
|
19
19
|
The keys to use from the context ids to create partitions.
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
23
|
-
### loggingComponentType?
|
|
23
|
+
### loggingComponentType? {#loggingcomponenttype}
|
|
24
24
|
|
|
25
|
-
> `optional` **loggingComponentType
|
|
25
|
+
> `optional` **loggingComponentType?**: `string`
|
|
26
26
|
|
|
27
27
|
The type of logging component to use.
|
|
28
28
|
|
|
@@ -34,7 +34,7 @@ logging
|
|
|
34
34
|
|
|
35
35
|
***
|
|
36
36
|
|
|
37
|
-
### config
|
|
37
|
+
### config {#config}
|
|
38
38
|
|
|
39
39
|
> **config**: [`IPostgreSqlEntityStorageConnectorConfig`](IPostgreSqlEntityStorageConnectorConfig.md)
|
|
40
40
|
|
package/locales/en.json
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
"databaseCreating": "Database \"{databaseName}\" creating",
|
|
5
5
|
"databaseExists": "Database \"{databaseName}\" created or it already exists",
|
|
6
6
|
"tableCreating": "Table \"{tableName}\" creating",
|
|
7
|
-
"tableExists": "Table \"{tableName}\" created or it already exists"
|
|
7
|
+
"tableExists": "Table \"{tableName}\" created or it already exists",
|
|
8
|
+
"tableDropping": "Dropping table \"{tableName}\"",
|
|
9
|
+
"tableDropped": "Table \"{tableName}\" dropped"
|
|
8
10
|
}
|
|
9
11
|
},
|
|
10
12
|
"error": {
|
|
@@ -16,7 +18,18 @@
|
|
|
16
18
|
"queryFailed": "The query failed",
|
|
17
19
|
"comparisonNotSupported": "Comparison operator \"{comparison}\" is not supported",
|
|
18
20
|
"conditionalNotSupported": "Conditional operator \"{operator}\" is not supported",
|
|
19
|
-
"entitySchemaPropertiesUndefined": "The entity schema properties are undefined"
|
|
21
|
+
"entitySchemaPropertiesUndefined": "The entity schema properties are undefined",
|
|
22
|
+
"setBatchFailed": "Unable to set batch of entities",
|
|
23
|
+
"countFailed": "Unable to count entities",
|
|
24
|
+
"emptyFailed": "Unable to empty entity storage",
|
|
25
|
+
"removeBatchFailed": "Unable to remove batch of entities",
|
|
26
|
+
"teardownFailed": "Unable to teardown entity storage"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"health": {
|
|
30
|
+
"postgreSqlEntityStorageConnector": {
|
|
31
|
+
"healthDescription": "Checks if the PostgreSQL connection is available",
|
|
32
|
+
"connectionFailed": "Failed to connect to PostgreSQL"
|
|
20
33
|
}
|
|
21
34
|
}
|
|
22
35
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-connector-postgresql",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.10",
|
|
4
|
+
"description": "PostgreSQL connector for relational persistence and advanced SQL features.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/iotaledger/entity-storage.git",
|
|
8
8
|
"directory": "packages/entity-storage-connector-postgresql"
|
|
9
9
|
},
|
|
10
10
|
"author": "adrian.sanchez.sequeira@iota.org",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"@twin.org/context": "next",
|
|
18
18
|
"@twin.org/core": "next",
|
|
19
19
|
"@twin.org/entity": "next",
|
|
20
|
-
"@twin.org/entity-storage-models": "0.0.3-next.
|
|
20
|
+
"@twin.org/entity-storage-models": "0.0.3-next.10",
|
|
21
21
|
"@twin.org/logging-models": "next",
|
|
22
22
|
"@twin.org/nameof": "next",
|
|
23
|
-
"postgres": "3.4.
|
|
23
|
+
"postgres": "3.4.8"
|
|
24
24
|
},
|
|
25
25
|
"main": "./dist/es/index.js",
|
|
26
26
|
"types": "./dist/types/index.d.ts",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"integration"
|
|
55
55
|
],
|
|
56
56
|
"bugs": {
|
|
57
|
-
"url": "git+https://github.com/
|
|
57
|
+
"url": "git+https://github.com/iotaledger/entity-storage/issues"
|
|
58
58
|
},
|
|
59
59
|
"homepage": "https://twindev.org"
|
|
60
60
|
}
|