Skip to content

Commit d85064c

Browse files
committed
v2.13.10: Add unref() to all timers to not prevent Node script from exiting in its end
1 parent 11f74c0 commit d85064c

21 files changed

+130
-5637
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dist
44
node_modules
55
package-lock.json
66
yarn.lock
7+
pnpm-lock.yaml
78
.DS_Store
89
*.log
910
*.tmp

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pg-id-consts.sql
2+
13
dist/__tests__
24
dist/**/__tests__
35
dist/*.tsbuildinfo
@@ -7,6 +9,7 @@ dist/*.tsbuildinfo
79
node_modules
810
package-lock.json
911
yarn.lock
12+
pnpm-lock.yaml
1013
.DS_Store
1114
*.log
1215
*.tmp

docs/classes/Cluster.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ queries (also, no implicit prewarming).
5757

5858
> **prewarm**(`randomizedDelayMs`, `onInitialPrewarm`?): `void`
5959
60-
Defined in: [src/abstract/Cluster.ts:230](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L230)
60+
Defined in: [src/abstract/Cluster.ts:234](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L234)
6161

6262
Signals the Cluster to keep the Clients pre-warmed, e.g. open. (It's up to
6363
the particular Client's implementation, what does a "pre-warmed Client"
@@ -87,7 +87,7 @@ pgbouncer or when DB is accessed over SSL).
8787

8888
> **globalShard**(): [`Shard`](Shard.md)\<`TClient`\>
8989
90-
Defined in: [src/abstract/Cluster.ts:261](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L261)
90+
Defined in: [src/abstract/Cluster.ts:265](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L265)
9191

9292
Returns a global Shard of the Cluster. This method is made synchronous
9393
intentionally, to defer the I/O and possible errors to the moment of the
@@ -103,7 +103,7 @@ actual query.
103103

104104
> **nonGlobalShards**(): `Promise`\<readonly [`Shard`](Shard.md)\<`TClient`\>[]\>
105105
106-
Defined in: [src/abstract/Cluster.ts:268](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L268)
106+
Defined in: [src/abstract/Cluster.ts:272](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L272)
107107

108108
Returns all currently known (discovered) non-global Shards in the Cluster.
109109

@@ -117,7 +117,7 @@ Returns all currently known (discovered) non-global Shards in the Cluster.
117117

118118
> **shard**(`id`): [`Shard`](Shard.md)\<`TClient`\>
119119
120-
Defined in: [src/abstract/Cluster.ts:288](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L288)
120+
Defined in: [src/abstract/Cluster.ts:292](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L292)
121121

122122
Returns Shard of a particular id. This method is made synchronous
123123
intentionally, to defer the I/O and possible errors to the moment of the
@@ -149,7 +149,7 @@ the query), no matter whether it was an immediate call or a deferred one.
149149

150150
> **shardByNo**(`shardNo`): [`Shard`](Shard.md)\<`TClient`\>
151151
152-
Defined in: [src/abstract/Cluster.ts:301](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L301)
152+
Defined in: [src/abstract/Cluster.ts:305](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L305)
153153

154154
Returns a Shard if we know its number. The idea: for each Shard number
155155
(even for non-discovered yet Shards), we keep the corresponding Shard
@@ -174,7 +174,7 @@ Shard hasn't been discovered actually).
174174

175175
> **randomShard**(`seed`?): `Promise`\<[`Shard`](Shard.md)\<`TClient`\>\>
176176
177-
Defined in: [src/abstract/Cluster.ts:311](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L311)
177+
Defined in: [src/abstract/Cluster.ts:315](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L315)
178178

179179
Returns a random Shard among the ones which are currently known
180180
(discovered) in the Cluster.
@@ -195,7 +195,7 @@ Returns a random Shard among the ones which are currently known
195195

196196
> **island**(`islandNo`): `Promise`\<[`Island`](Island.md)\<`TClient`\>\>
197197
198-
Defined in: [src/abstract/Cluster.ts:335](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L335)
198+
Defined in: [src/abstract/Cluster.ts:339](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L339)
199199

200200
Returns an Island by its number.
201201

@@ -215,7 +215,7 @@ Returns an Island by its number.
215215

216216
> **islands**(): `Promise`\<[`Island`](Island.md)\<`TClient`\>[]\>
217217
218-
Defined in: [src/abstract/Cluster.ts:346](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L346)
218+
Defined in: [src/abstract/Cluster.ts:350](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L350)
219219

220220
Returns all Islands in the Cluster.
221221

@@ -229,7 +229,7 @@ Returns all Islands in the Cluster.
229229

230230
> **rediscover**(): `Promise`\<`void`\>
231231
232-
Defined in: [src/abstract/Cluster.ts:356](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L356)
232+
Defined in: [src/abstract/Cluster.ts:360](https://github.com/clickup/ent-framework/blob/master/src/abstract/Cluster.ts#L360)
233233

234234
Triggers shards rediscovery and finishes as soon as it's done. To be used
235235
in unit tests mostly, because in real life, it's enough to just modify the

docs/classes/PgClientPool.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ until e.g. the next discovery query to it (or any query) succeeds.
279279

280280
> **acquireConn**(): `Promise`\<[`PgClientConn`](../interfaces/PgClientConn.md)\>
281281
282-
Defined in: [src/pg/PgClientPool.ts:114](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L114)
282+
Defined in: [src/pg/PgClientPool.ts:117](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L117)
283283

284284
Called when the Client needs a connection to run a query against. Implies
285285
than the caller MUST call release() method on the returned object.
@@ -298,7 +298,7 @@ than the caller MUST call release() method on the returned object.
298298

299299
> **poolStats**(): `object`
300300
301-
Defined in: [src/pg/PgClientPool.ts:127](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L127)
301+
Defined in: [src/pg/PgClientPool.ts:130](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L130)
302302

303303
Returns statistics about the connection pool.
304304

@@ -335,7 +335,7 @@ new available connection. This is the number of such queued requests.
335335

336336
> **address**(): `string`
337337
338-
Defined in: [src/pg/PgClientPool.ts:135](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L135)
338+
Defined in: [src/pg/PgClientPool.ts:138](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L138)
339339

340340
Represents the full destination address this Client is working with.
341341
Depending on the implementation, it may include hostname, port number,
@@ -357,7 +357,7 @@ shardNos) based on that address.
357357

358358
> **logSwallowedError**(`props`): `void`
359359
360-
Defined in: [src/pg/PgClientPool.ts:146](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L146)
360+
Defined in: [src/pg/PgClientPool.ts:149](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L149)
361361

362362
Calls swallowedErrorLogger() doing some preliminary amendment.
363363

@@ -381,7 +381,7 @@ Calls swallowedErrorLogger() doing some preliminary amendment.
381381

382382
> **end**(): `Promise`\<`void`\>
383383
384-
Defined in: [src/pg/PgClientPool.ts:152](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L152)
384+
Defined in: [src/pg/PgClientPool.ts:155](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L155)
385385

386386
Gracefully closes the connections to let the caller destroy the Client. The
387387
pending queries are awaited to finish before returning. The Client becomes
@@ -401,7 +401,7 @@ unusable after calling this method: you should not send queries to it.
401401

402402
> **isEnded**(): `boolean`
403403
404-
Defined in: [src/pg/PgClientPool.ts:163](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L163)
404+
Defined in: [src/pg/PgClientPool.ts:166](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L166)
405405

406406
Returns true if the Client is ended and can't be used anymore.
407407

@@ -419,7 +419,7 @@ Returns true if the Client is ended and can't be used anymore.
419419

420420
> **prewarm**(): `void`
421421
422-
Defined in: [src/pg/PgClientPool.ts:167](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L167)
422+
Defined in: [src/pg/PgClientPool.ts:170](https://github.com/clickup/ent-framework/blob/master/src/pg/PgClientPool.ts#L170)
423423

424424
A convenience method to put connections prewarming logic to. The idea is to
425425
keep the needed number of open connections and also, in each connection,

docs/classes/ShardIsNotDiscoverableError.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Class: ShardIsNotDiscoverableError
88

9-
Defined in: src/abstract/ShardIsNotDiscoverableError.ts:10
9+
Defined in: [src/abstract/ShardIsNotDiscoverableError.ts:10](https://github.com/clickup/ent-framework/blob/master/src/abstract/ShardIsNotDiscoverableError.ts#L10)
1010

1111
This non-retriable error is thrown when shardsDiscoverCache.cached() returns
1212
no shard with the requested number.
@@ -21,7 +21,7 @@ no shard with the requested number.
2121

2222
> **new ShardIsNotDiscoverableError**(`shardNo`, `errors`, `islands`, `elapsed`): [`ShardIsNotDiscoverableError`](ShardIsNotDiscoverableError.md)
2323
24-
Defined in: src/abstract/ShardIsNotDiscoverableError.ts:11
24+
Defined in: [src/abstract/ShardIsNotDiscoverableError.ts:11](https://github.com/clickup/ent-framework/blob/master/src/abstract/ShardIsNotDiscoverableError.ts#L11)
2525

2626
#### Parameters
2727

internal/clean.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22
set -e
33

4-
rm -rf dist dist.* yarn.lock package-lock.json node_modules ./*.log
4+
rm -rf dist dist.* yarn.lock package-lock.json pnpm-lock.yaml node_modules ./*.log

internal/init-db.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ done
1616
dir="$dir/$REL"
1717

1818
if [[ ! -e $dir/pg-id-consts.sql ]]; then
19-
ln -s "$dir/pg-id-consts.sql.example" "$dir/pg-id-consts.sql"
19+
ln -s "$dir/pg-id.config.sql.example" "$dir/pg-id.config.sql"
2020
fi
2121

2222
rm -f $LOG

internal/with-docker-compose-up.postgres.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ export PGPASSWORD=postgres
1717
# properly quoted arguments to it.
1818
cmd="$1"
1919
shift
20-
eval "$cmd \"\$@\""
20+
if [[ "$*" == "" ]]; then
21+
eval "$cmd"
22+
else
23+
eval "$cmd \"\$@\""
24+
fi

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@clickup/ent-framework",
33
"description": "A PostgreSQL graph-database-alike library with microsharding and row-level security",
4-
"version": "2.13.9",
4+
"version": "2.13.10",
55
"license": "MIT",
66
"keywords": [
77
"postgresql",
@@ -46,12 +46,12 @@
4646
"table": "^6.8.0"
4747
},
4848
"devDependencies": {
49-
"@clickup/pg-id": "^2.10.292",
49+
"@clickup/pg-id": "2.12.2",
5050
"@types/jest": "^29.5.5",
5151
"@types/lodash": "^4.14.175",
5252
"@types/node": "^20.4.1",
5353
"@types/object-hash": "^2.2.1",
54-
"@types/pg": "^8.6.1",
54+
"@types/pg": "^8.11.11",
5555
"@types/uniqid": "^4.1.3",
5656
"@typescript-eslint/eslint-plugin": "^5.59.6",
5757
"@typescript-eslint/parser": "^5.59.6",

0 commit comments

Comments
 (0)