@twin.org/entity-storage-connector-postgresql 0.0.3-next.9 → 0.9.0

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.
@@ -10,7 +10,7 @@ Class for performing entity storage operations using ql.
10
10
 
11
11
  ## Implements
12
12
 
13
- - `IEntityStorageConnector`\<`T`\>
13
+ - `IEntityStorageMigrationConnector`\<`T`\>
14
14
 
15
15
  ## Constructors
16
16
 
@@ -64,7 +64,7 @@ A promise that resolves to a boolean indicating success.
64
64
 
65
65
  #### Implementation of
66
66
 
67
- `IEntityStorageConnector.bootstrap`
67
+ `IEntityStorageMigrationConnector.bootstrap`
68
68
 
69
69
  ***
70
70
 
@@ -82,7 +82,25 @@ The class name of the component.
82
82
 
83
83
  #### Implementation of
84
84
 
85
- `IEntityStorageConnector.className`
85
+ `IEntityStorageMigrationConnector.className`
86
+
87
+ ***
88
+
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
+ `IEntityStorageMigrationConnector.health`
86
104
 
87
105
  ***
88
106
 
@@ -100,7 +118,7 @@ Nothing.
100
118
 
101
119
  #### Implementation of
102
120
 
103
- `IEntityStorageConnector.stop`
121
+ `IEntityStorageMigrationConnector.stop`
104
122
 
105
123
  ***
106
124
 
@@ -118,7 +136,7 @@ The schema for the entities.
118
136
 
119
137
  #### Implementation of
120
138
 
121
- `IEntityStorageConnector.getSchema`
139
+ `IEntityStorageMigrationConnector.getSchema`
122
140
 
123
141
  ***
124
142
 
@@ -156,7 +174,7 @@ The object if it can be found or undefined.
156
174
 
157
175
  #### Implementation of
158
176
 
159
- `IEntityStorageConnector.get`
177
+ `IEntityStorageMigrationConnector.get`
160
178
 
161
179
  ***
162
180
 
@@ -188,7 +206,51 @@ The id of the entity.
188
206
 
189
207
  #### Implementation of
190
208
 
191
- `IEntityStorageConnector.set`
209
+ `IEntityStorageMigrationConnector.set`
210
+
211
+ ***
212
+
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
+ `IEntityStorageMigrationConnector.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
+ `IEntityStorageMigrationConnector.empty`
192
254
 
193
255
  ***
194
256
 
@@ -220,7 +282,195 @@ Nothing.
220
282
 
221
283
  #### Implementation of
222
284
 
223
- `IEntityStorageConnector.remove`
285
+ `IEntityStorageMigrationConnector.remove`
286
+
287
+ ***
288
+
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
+ `IEntityStorageMigrationConnector.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
+ `IEntityStorageMigrationConnector.teardown`
338
+
339
+ ***
340
+
341
+ ### getPartitionContextIds() {#getpartitioncontextids}
342
+
343
+ > **getPartitionContextIds**(): `Promise`\<`IContextIds`[]\>
344
+
345
+ Get all the distinct partition context ids from the storage.
346
+
347
+ #### Returns
348
+
349
+ `Promise`\<`IContextIds`[]\>
350
+
351
+ An array of context id objects, one per unique partition.
352
+
353
+ #### Implementation of
354
+
355
+ `IEntityStorageMigrationConnector.getPartitionContextIds`
356
+
357
+ ***
358
+
359
+ ### createTargetConnector() {#createtargetconnector}
360
+
361
+ > **createTargetConnector**\<`U`\>(`entitySchemaName`): `Promise`\<`PostgreSqlEntityStorageConnector`\<`U`\>\>
362
+
363
+ Create a new target connector for the migration.
364
+
365
+ #### Type Parameters
366
+
367
+ ##### U
368
+
369
+ `U`
370
+
371
+ #### Parameters
372
+
373
+ ##### entitySchemaName
374
+
375
+ `string`
376
+
377
+ The entity schema name to use for the target connector.
378
+
379
+ #### Returns
380
+
381
+ `Promise`\<`PostgreSqlEntityStorageConnector`\<`U`\>\>
382
+
383
+ A new connector configured with a migration table name.
384
+
385
+ #### Implementation of
386
+
387
+ `IEntityStorageMigrationConnector.createTargetConnector`
388
+
389
+ ***
390
+
391
+ ### finalizeMigration() {#finalizemigration}
392
+
393
+ > **finalizeMigration**\<`U`\>(`targetConnector`, `options?`, `loggingComponentType?`): `Promise`\<`PostgreSqlEntityStorageConnector`\<`U`\>\>
394
+
395
+ Finalize the migration by renaming the migration table to the original table name.
396
+
397
+ #### Type Parameters
398
+
399
+ ##### U
400
+
401
+ `U`
402
+
403
+ #### Parameters
404
+
405
+ ##### targetConnector
406
+
407
+ `PostgreSqlEntityStorageConnector`\<`U`\>
408
+
409
+ The connector pointing to the migration table.
410
+
411
+ ##### options?
412
+
413
+ `IMigrationOptions`
414
+
415
+ The optional migration options.
416
+
417
+ ##### loggingComponentType?
418
+
419
+ `string`
420
+
421
+ The node logging component type.
422
+
423
+ #### Returns
424
+
425
+ `Promise`\<`PostgreSqlEntityStorageConnector`\<`U`\>\>
426
+
427
+ A connector pointing to the final (renamed) table.
428
+
429
+ #### Implementation of
430
+
431
+ `IEntityStorageMigrationConnector.finalizeMigration`
432
+
433
+ ***
434
+
435
+ ### cleanupMigration() {#cleanupmigration}
436
+
437
+ > **cleanupMigration**\<`U`\>(`targetConnector?`, `options?`, `loggingComponentType?`): `Promise`\<`void`\>
438
+
439
+ Clean up the migration by tearing down the migration table.
440
+
441
+ #### Type Parameters
442
+
443
+ ##### U
444
+
445
+ `U`
446
+
447
+ #### Parameters
448
+
449
+ ##### targetConnector?
450
+
451
+ `PostgreSqlEntityStorageConnector`\<`U`\>
452
+
453
+ The connector pointing to the migration table.
454
+
455
+ ##### options?
456
+
457
+ `IMigrationOptions`
458
+
459
+ The optional migration options.
460
+
461
+ ##### loggingComponentType?
462
+
463
+ `string`
464
+
465
+ The node logging component type.
466
+
467
+ #### Returns
468
+
469
+ `Promise`\<`void`\>
470
+
471
+ #### Implementation of
472
+
473
+ `IEntityStorageMigrationConnector.cleanupMigration`
224
474
 
225
475
  ***
226
476
 
@@ -271,18 +521,30 @@ and a cursor which can be used to request more entities.
271
521
 
272
522
  #### Implementation of
273
523
 
274
- `IEntityStorageConnector.query`
524
+ `IEntityStorageMigrationConnector.query`
275
525
 
276
526
  ***
277
527
 
278
- ### tableDrop() {#tabledrop}
528
+ ### count() {#count}
529
+
530
+ > **count**(`conditions?`): `Promise`\<`number`\>
279
531
 
280
- > **tableDrop**(): `Promise`\<`void`\>
532
+ Count all the entities which match the conditions.
281
533
 
282
- Drop the table.
534
+ #### Parameters
535
+
536
+ ##### conditions?
537
+
538
+ `EntityCondition`\<`T`\>
539
+
540
+ The optional conditions to match for the entities.
283
541
 
284
542
  #### Returns
285
543
 
286
- `Promise`\<`void`\>
544
+ `Promise`\<`number`\>
287
545
 
288
- Nothing.
546
+ The total count of entities in the storage.
547
+
548
+ #### Implementation of
549
+
550
+ `IEntityStorageMigrationConnector.count`
@@ -26,12 +26,6 @@ The keys to use from the context ids to create partitions.
26
26
 
27
27
  The type of logging component to use.
28
28
 
29
- #### Default
30
-
31
- ```ts
32
- logging
33
- ```
34
-
35
29
  ***
36
30
 
37
31
  ### config {#config}
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,20 @@
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
+ "getPartitionContextIdsFailed": "Unable to get partition context ids",
28
+ "finalizeMigrationFailedBootstrap": "Finalizing migration failed during bootstrap phase"
29
+ }
30
+ },
31
+ "health": {
32
+ "postgreSqlEntityStorageConnector": {
33
+ "healthDescription": "Checks if the PostgreSQL table \"{tableName}\" is available",
34
+ "connectionFailed": "Failed to connect to PostgreSQL table \"{tableName}\""
20
35
  }
21
36
  }
22
37
  }
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.9",
3
+ "version": "0.9.0",
4
4
  "description": "PostgreSQL connector for relational persistence and advanced SQL features.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/entity-storage.git",
7
+ "url": "git+https://github.com/iotaledger/twin-entity-storage.git",
8
8
  "directory": "packages/entity-storage-connector-postgresql"
9
9
  },
10
10
  "author": "adrian.sanchez.sequeira@iota.org",
@@ -14,13 +14,13 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/context": "next",
18
- "@twin.org/core": "next",
19
- "@twin.org/entity": "next",
20
- "@twin.org/entity-storage-models": "0.0.3-next.9",
21
- "@twin.org/logging-models": "next",
22
- "@twin.org/nameof": "next",
23
- "postgres": "3.4.8"
17
+ "@twin.org/context": "^0.9.0",
18
+ "@twin.org/core": "^0.9.0",
19
+ "@twin.org/entity": "^0.9.0",
20
+ "@twin.org/entity-storage-models": "^0.9.0",
21
+ "@twin.org/logging-models": "^0.9.0",
22
+ "@twin.org/nameof": "^0.9.0",
23
+ "postgres": "3.4.9"
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/twinfoundation/entity-storage/issues"
57
+ "url": "git+https://github.com/iotaledger/twin-entity-storage/issues"
58
58
  },
59
59
  "homepage": "https://twindev.org"
60
60
  }