declapract-typescript-ehmpathy 0.49.14 β 0.49.15
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/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/.test/assets/repo-with-hand-patch/declapract.use.yml +4 -0
- package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/.test/assets/repo-with-hand-patch/package.json +17 -0
- package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/.test/assets/repo-with-hand-patch/patches/left-pad@1.3.0.patch +6 -0
- package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/.test/assets/repo-with-hand-patch/patches/pg-pool@3.14.0.patch +12 -0
- package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/__snapshots__/pg-pool-patch.declapract.integration.test.ts.snap +147 -0
- package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/best-practice/.declapract.readme.md +22 -0
- package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/best-practice/package.json +5 -0
- package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/best-practice/patches/pg-pool.patch +21 -0
- package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/pg-pool-patch.declapract.integration.test.ts +884 -0
- package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/declapract.use.yml +4 -0
- package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/package.json +15 -0
- package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy.patch +6 -0
- package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy@1.39.1.patch +6 -0
- package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/type-fns@1.21.3.patch +6 -0
- package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/pnpm-lock.yaml +19 -0
- package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/__snapshots__/stale-patched-dependency.declapract.integration.test.ts.snap +39 -0
- package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/stale-patched-dependency.declapract.integration.test.ts +53 -0
- package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/declapract.use.yml +4 -0
- package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/package.json +15 -0
- package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy.patch +6 -0
- package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy@1.39.1.patch +6 -0
- package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/type-fns@1.21.3.patch +6 -0
- package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/pnpm-lock.yaml +19 -0
- package/dist/.test/assets/expo-migration/declarations/practices/pnpm/__snapshots__/stale-patched-dependency.declapract.integration.test.ts.snap +39 -0
- package/dist/.test/assets/expo-migration/declarations/practices/pnpm/stale-patched-dependency.declapract.integration.test.ts +53 -0
- package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/declapract.use.yml +4 -0
- package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/package.json +15 -0
- package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy.patch +6 -0
- package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy@1.39.1.patch +6 -0
- package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/type-fns@1.21.3.patch +6 -0
- package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/pnpm-lock.yaml +19 -0
- package/dist/.test/assets/pnpm/declarations/practices/pnpm/__snapshots__/stale-patched-dependency.declapract.integration.test.ts.snap +39 -0
- package/dist/.test/assets/pnpm/declarations/practices/pnpm/stale-patched-dependency.declapract.integration.test.ts +53 -0
- package/dist/__snapshots__/typecheckBestPracticeTemplates.declapract.integration.test.ts.snap +80 -0
- package/dist/practices/persist-with-rds/.test/assets/repo-with-hand-patch/declapract.use.yml +4 -0
- package/dist/practices/persist-with-rds/.test/assets/repo-with-hand-patch/package.json +17 -0
- package/dist/practices/persist-with-rds/.test/assets/repo-with-hand-patch/patches/left-pad@1.3.0.patch +6 -0
- package/dist/practices/persist-with-rds/.test/assets/repo-with-hand-patch/patches/pg-pool@3.14.0.patch +12 -0
- package/dist/practices/persist-with-rds/__snapshots__/pg-pool-patch.declapract.integration.test.ts.snap +147 -0
- package/dist/practices/persist-with-rds/best-practice/.declapract.readme.md +22 -0
- package/dist/practices/persist-with-rds/best-practice/package.json +5 -0
- package/dist/practices/persist-with-rds/best-practice/patches/pg-pool.patch +21 -0
- package/dist/practices/persist-with-rds/pg-pool-patch.declapract.integration.test.ts +884 -0
- package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/declapract.use.yml +4 -0
- package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/package.json +15 -0
- package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy.patch +6 -0
- package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy@1.39.1.patch +6 -0
- package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/type-fns@1.21.3.patch +6 -0
- package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/pnpm-lock.yaml +19 -0
- package/dist/practices/pnpm/__snapshots__/stale-patched-dependency.declapract.integration.test.ts.snap +39 -0
- package/dist/practices/pnpm/stale-patched-dependency.declapract.integration.test.ts +53 -0
- package/dist/typecheckBestPracticeTemplates.declapract.integration.test.ts +181 -19
- package/package.json +6 -6
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "repo-with-hand-patch",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"pg": "8.3.0",
|
|
6
|
+
"pg-pool": "3.14.0"
|
|
7
|
+
},
|
|
8
|
+
"pnpm": {
|
|
9
|
+
"overrides": {
|
|
10
|
+
"react-refresh": "0.14.2"
|
|
11
|
+
},
|
|
12
|
+
"patchedDependencies": {
|
|
13
|
+
"pg-pool@3.14.0": "patches/pg-pool@3.14.0.patch",
|
|
14
|
+
"left-pad@1.3.0": "patches/left-pad@1.3.0.patch"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
diff --git a/index.js b/index.js
|
|
2
|
+
--- a/index.js
|
|
3
|
+
+++ b/index.js
|
|
4
|
+
@@ -92,7 +92,7 @@ class Pool extends EventEmitter {
|
|
5
|
+
this.options.allowExitOnIdle = this.options.allowExitOnIdle || false
|
|
6
|
+
this.options.maxLifetimeSeconds = this.options.maxLifetimeSeconds || 0
|
|
7
|
+
this.log = this.options.log || function () {}
|
|
8
|
+
- this.Client = this.options.Client || Client || require('pg').Client
|
|
9
|
+
+ this.Client = this.options.Client || Client // hand patch
|
|
10
|
+
this.Promise = this.options.Promise || global.Promise
|
|
11
|
+
|
|
12
|
+
if (typeof this.options.idleTimeoutMillis === 'undefined') {
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
+
|
|
3
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.2.1, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.2.1 1`] = `[]`;
|
|
4
|
+
|
|
5
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.2.2, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.2.2 1`] = `[]`;
|
|
6
|
+
|
|
7
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.3.0, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.3.0 1`] = `[]`;
|
|
8
|
+
|
|
9
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.4.0, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.4.0 1`] = `[]`;
|
|
10
|
+
|
|
11
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.4.1, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.4.1 1`] = `[]`;
|
|
12
|
+
|
|
13
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.5.1, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.5.1 1`] = `[]`;
|
|
14
|
+
|
|
15
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.5.2, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.5.2 1`] = `[]`;
|
|
16
|
+
|
|
17
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.6.0, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.6.0 1`] = `[]`;
|
|
18
|
+
|
|
19
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.6.1, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.6.1 1`] = `[]`;
|
|
20
|
+
|
|
21
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.6.2, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.6.2 1`] = `[]`;
|
|
22
|
+
|
|
23
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.7.0, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.7.0 1`] = `[]`;
|
|
24
|
+
|
|
25
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.7.1, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.7.1 1`] = `[]`;
|
|
26
|
+
|
|
27
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.8.0, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.8.0 1`] = `[]`;
|
|
28
|
+
|
|
29
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.9.0, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.9.0 1`] = `[]`;
|
|
30
|
+
|
|
31
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.9.1, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.9.1 1`] = `[]`;
|
|
32
|
+
|
|
33
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.9.2, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.9.2 1`] = `[]`;
|
|
34
|
+
|
|
35
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.9.5, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.9.5 1`] = `[]`;
|
|
36
|
+
|
|
37
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.9.6, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.9.6 1`] = `[]`;
|
|
38
|
+
|
|
39
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.10.0, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.10.0 1`] = `[]`;
|
|
40
|
+
|
|
41
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.10.1, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.10.1 1`] = `[]`;
|
|
42
|
+
|
|
43
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.11.0, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.11.0 1`] = `[]`;
|
|
44
|
+
|
|
45
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.12.0, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.12.0 1`] = `[]`;
|
|
46
|
+
|
|
47
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.13.0, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.13.0 1`] = `[]`;
|
|
48
|
+
|
|
49
|
+
exports[`persist-with-rds pg-pool patch given: [case2] pg-pool 3.14.0, installed with the shipped patch when: [t0] pnpm install runs then: the patch lines an adopter reads match snapshot: pnpm install β patch lines, pg-pool 3.14.0 1`] = `[]`;
|
|
50
|
+
|
|
51
|
+
exports[`persist-with-rds pg-pool patch given: [case4] an rds repo that already holds its own "pg-pool@3.14.0" hand patch when: [t0] the persist-with-rds practice is applied then: the before + after contents match snapshot: package.json β after 1`] = `
|
|
52
|
+
"{
|
|
53
|
+
"name": "repo-with-hand-patch",
|
|
54
|
+
"version": "1.0.0",
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"pg": "8.3.0",
|
|
57
|
+
"pg-pool": "3.14.0",
|
|
58
|
+
"iso-time": "@declapract{check.minVersion('<floor>')}",
|
|
59
|
+
"yesql": "@declapract{check.minVersion('<floor>')}"
|
|
60
|
+
},
|
|
61
|
+
"pnpm": {
|
|
62
|
+
"overrides": {
|
|
63
|
+
"react-refresh": "0.14.2"
|
|
64
|
+
},
|
|
65
|
+
"patchedDependencies": {
|
|
66
|
+
"pg-pool@3.14.0": "patches/pg-pool@3.14.0.patch",
|
|
67
|
+
"left-pad@1.3.0": "patches/left-pad@1.3.0.patch",
|
|
68
|
+
"pg-pool": "patches/pg-pool.patch"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"sql-code-generator": "@declapract{check.minVersion('<floor>')}",
|
|
73
|
+
"sql-dao-generator": "@declapract{check.minVersion('<floor>')}",
|
|
74
|
+
"sql-schema-control": "@declapract{check.minVersion('<floor>')}",
|
|
75
|
+
"sql-schema-generator": "@declapract{check.minVersion('<floor>')}",
|
|
76
|
+
"@types/yesql": "@declapract{check.minVersion('<floor>')}",
|
|
77
|
+
"@types/pg": "@declapract{check.minVersion('<floor>')}"
|
|
78
|
+
},
|
|
79
|
+
"scripts": {
|
|
80
|
+
"generate:dao:postgres": "sql-dao-generator generate && npm run fix:format",
|
|
81
|
+
"generate:schema": "sql-schema-generator generate -c codegen.sql.schema.yml && npm run fix:format",
|
|
82
|
+
"generate:types-from-sql": "sql-code-generator generate -c codegen.sql.types.yml && npm run fix:format",
|
|
83
|
+
"provision:schema:plan": "sql-schema-control plan -c provision/schema/control.yml",
|
|
84
|
+
"provision:schema:apply": "sql-schema-control apply -c provision/schema/control.yml",
|
|
85
|
+
"provision:schema:sync": "sql-schema-control sync -c provision/schema/control.yml",
|
|
86
|
+
"provision:testdb:docker:clear": "for port in $(bash provision/docker/testdb/compose.sh config --format json | jq -r '.services[].ports[]?.published'); do docker rm -f $(docker ps -a -f \\"publish=$port\\" -q) 2>/dev/null || true; done && echo 'ensured ports are available π'",
|
|
87
|
+
"provision:testdb:docker:prepare": "cp provision/schema/sql/init/.extensions.sql provision/docker/testdb/init/extensions.sql && cp provision/schema/sql/init/.schema.sql provision/docker/testdb/init/schema.sql && cp provision/schema/sql/init/.user.cicd.sql provision/docker/testdb/init/user.cicd.sql",
|
|
88
|
+
"provision:testdb:docker:up": "bash provision/docker/testdb/compose.sh up -d --force-recreate --build --renew-anon-volumes",
|
|
89
|
+
"provision:testdb:docker:await": "bash provision/docker/testdb/compose.sh exec -T postgres /root/wait-for-postgres.sh",
|
|
90
|
+
"provision:testdb:docker:down": "bash provision/docker/testdb/compose.sh down",
|
|
91
|
+
"provision:testdb": "npm run provision:testdb:docker:clear && npm run provision:testdb:docker:prepare && npm run provision:testdb:docker:up && npm run provision:testdb:docker:await && ACCESS=test npm run provision:schema:plan && ACCESS=test npm run provision:schema:apply && ACCESS=test npm run provision:schema:plan",
|
|
92
|
+
"start:testdb": "npm run provision:testdb",
|
|
93
|
+
"start:livedb:prep": "rhx use.rds.capacity --env prep"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
"
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
exports[`persist-with-rds pg-pool patch given: [case4] an rds repo that already holds its own "pg-pool@3.14.0" hand patch when: [t0] the persist-with-rds practice is applied then: the before + after contents match snapshot: package.json β before 1`] = `
|
|
100
|
+
"{
|
|
101
|
+
"name": "repo-with-hand-patch",
|
|
102
|
+
"version": "1.0.0",
|
|
103
|
+
"dependencies": {
|
|
104
|
+
"pg": "8.3.0",
|
|
105
|
+
"pg-pool": "3.14.0"
|
|
106
|
+
},
|
|
107
|
+
"pnpm": {
|
|
108
|
+
"overrides": {
|
|
109
|
+
"react-refresh": "0.14.2"
|
|
110
|
+
},
|
|
111
|
+
"patchedDependencies": {
|
|
112
|
+
"pg-pool@3.14.0": "patches/pg-pool@3.14.0.patch",
|
|
113
|
+
"left-pad@1.3.0": "patches/left-pad@1.3.0.patch"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
"
|
|
118
|
+
`;
|
|
119
|
+
|
|
120
|
+
exports[`persist-with-rds pg-pool patch given: [case5] a pg-pool release where the patched line moved, so the hunk fails when: [t0] pnpm install runs then: the warn an adopter reads matches snapshot: pnpm install β patch failure warn 1`] = `
|
|
121
|
+
[
|
|
122
|
+
"βWARNβ Could not apply patch <tempdir>/patches/pg-pool.patch to <tempdir>/node_modules/.pnpm/pg-pool@3.14.0_patch_hash=<hash>_pg@8.3.0/node_modules/pg-pool",
|
|
123
|
+
]
|
|
124
|
+
`;
|
|
125
|
+
|
|
126
|
+
exports[`persist-with-rds pg-pool patch given: [case6] a bare rds adopter: pg, pg-pool, the shipped cycle check, and one src file that imports pg when: [t0] its cycle check runs, with the shipped patch then: the verdict an adopter reads matches snapshot: test:lint:cycles β with the shipped patch 1`] = `
|
|
127
|
+
[
|
|
128
|
+
"> pg-pool-patch-demo@ test:lint:cycles <tempdir>",
|
|
129
|
+
"> EXCL=$(node -p "(require('yaml').parse(require('fs').readFileSync('.dpdmrc.yaml','utf8'))?.exclude ?? []).join('|')") && dpdm --no-warning --no-tree --transform --exit-code circular:1 --exclude "$EXCL" 'src/**/!(*.test).ts'",
|
|
130
|
+
"β’ Circular Dependencies",
|
|
131
|
+
" β
Congratulations, no circular dependency was found in your project.",
|
|
132
|
+
"- Start analyzing dependencies...",
|
|
133
|
+
"β [37/37] Analyze done!",
|
|
134
|
+
]
|
|
135
|
+
`;
|
|
136
|
+
|
|
137
|
+
exports[`persist-with-rds pg-pool patch given: [case6] a bare rds adopter: pg, pg-pool, the shipped cycle check, and one src file that imports pg when: [t1] its cycle check runs, with no patch then: the verdict an adopter reads matches snapshot: test:lint:cycles β with no patch 1`] = `
|
|
138
|
+
[
|
|
139
|
+
"> pg-pool-patch-demo@ test:lint:cycles <tempdir>",
|
|
140
|
+
"> EXCL=$(node -p "(require('yaml').parse(require('fs').readFileSync('.dpdmrc.yaml','utf8'))?.exclude ?? []).join('|')") && dpdm --no-warning --no-tree --transform --exit-code circular:1 --exclude "$EXCL" 'src/**/!(*.test).ts'",
|
|
141
|
+
"β’ Circular Dependencies",
|
|
142
|
+
" 1) node_modules/.pnpm/pg@<floor>/node_modules/pg/lib/index.js -> node_modules/.pnpm/pg-pool@3.14.0_pg@<floor>/node_modules/pg-pool/index.js",
|
|
143
|
+
"βELIFECYCLEβ Command failed with exit code 1.",
|
|
144
|
+
"- Start analyzing dependencies...",
|
|
145
|
+
"β [37/37] Analyze done!",
|
|
146
|
+
]
|
|
147
|
+
`;
|
|
@@ -21,6 +21,28 @@ we use:
|
|
|
21
21
|
set it only when the cluster endpoint is a custom dns alias whose first label is not the
|
|
22
22
|
cluster identifier. a hand-set `database.tunnel.cluster.name` in a repo's own config is kept.
|
|
23
23
|
|
|
24
|
+
## the pg-pool patch
|
|
25
|
+
|
|
26
|
+
pg-pool's pool falls back to `require('pg').Client` when no `Client` is passed. dpdm reads that
|
|
27
|
+
require statically, so every repo with pg + pg-pool fails `test:lint:cycles` on `pg <-> pg-pool`
|
|
28
|
+
(the check reads node_modules too, by policy). this practice ships
|
|
29
|
+
`patches/pg-pool.patch`, which drops the fallback, under the bare-name key
|
|
30
|
+
`pnpm.patchedDependencies["pg-pool"]`:
|
|
31
|
+
|
|
32
|
+
- the bare name never goes stale, so the stale-patch check never retires it; the hunk fits every
|
|
33
|
+
stable pg-pool release in `^3.2.1`, which `pg@8.3.0` asks for
|
|
34
|
+
- a repo's own exact-version key (`pg-pool@<version>`) outranks it at install, and both survive the apply.
|
|
35
|
+
a hand patch of the same line may be deleted, key and file
|
|
36
|
+
- after an apply, run `pnpm install` and commit the lockfile: it records the patch hash, so a ci
|
|
37
|
+
`--frozen-lockfile` install fails until it does
|
|
38
|
+
- pg passes its own `Client` into every pool it builds, so code that goes through `pg` sees no change.
|
|
39
|
+
code that calls `new Pool()` from pg-pool directly must pass `{ Client: require('pg').Client }`
|
|
40
|
+
- if pnpm warns that the patch failed to apply, pg-pool moved the line: upgrade
|
|
41
|
+
declapract-typescript-ehmpathy and re-apply. if no fix has shipped yet, pin your own
|
|
42
|
+
`pg-pool@<version>` patch; its exact key outranks the bare one
|
|
43
|
+
- to recut the hunk, keep one context line on each side of the changed line. wider context misfits
|
|
44
|
+
older releases in `^3.2.1` (3.2.1β3.4.1), and pnpm then installs pg-pool unpatched
|
|
45
|
+
|
|
24
46
|
## ssm parameters
|
|
25
47
|
|
|
26
48
|
the provision wish (`provision/aws/resources.parameters.ts`) declares the db credentials at the
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
"@types/yesql": "@declapract{check.minVersion('3.2.2')}",
|
|
13
13
|
"@types/pg": "@declapract{check.minVersion('8.6.1')}"
|
|
14
14
|
},
|
|
15
|
+
"pnpm": {
|
|
16
|
+
"patchedDependencies": {
|
|
17
|
+
"pg-pool": "patches/pg-pool.patch"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
15
20
|
"scripts": {
|
|
16
21
|
"generate:dao:postgres": "sql-dao-generator generate && npm run fix:format",
|
|
17
22
|
"generate:schema": "sql-schema-generator generate -c codegen.sql.schema.yml && npm run fix:format",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.what = drops pg-pool's lazy `require('pg')` fallback, so dpdm sees no pg <-> pg-pool require cycle
|
|
2
|
+
.why = pg passes its own Client into every pool it builds, so the fallback never runs under pg; but
|
|
3
|
+
dpdm reads it statically, and `test:lint:cycles` checks node_modules (exclude: []) by policy
|
|
4
|
+
.note = shipped by declapract-typescript-ehmpathy, practice persist-with-rds. if pnpm warns that this
|
|
5
|
+
patch failed to apply, pg-pool moved the line: upgrade declapract-typescript-ehmpathy and
|
|
6
|
+
re-apply. if no fix has shipped yet, pin your own `pg-pool@<version>` patch: an exact key
|
|
7
|
+
outranks this bare one. code that calls `new Pool()` from pg-pool directly must pass
|
|
8
|
+
`{ Client: require('pg').Client }`. after an apply, run `pnpm install` and commit the
|
|
9
|
+
lockfile: it records this file's hash.
|
|
10
|
+
.recut = keep one context line on each side of the changed line. wider context misfits older
|
|
11
|
+
pg-pool releases, and pnpm then warns and installs pg-pool unpatched. edit this file only
|
|
12
|
+
when the hunk must move: its hash sits in every adopter's lockfile, header included.
|
|
13
|
+
|
|
14
|
+
diff --git a/index.js b/index.js
|
|
15
|
+
--- a/index.js
|
|
16
|
+
+++ b/index.js
|
|
17
|
+
@@ -94,3 +94,3 @@ class Pool extends EventEmitter {
|
|
18
|
+
this.log = this.options.log || function () {}
|
|
19
|
+
- this.Client = this.options.Client || Client || require('pg').Client
|
|
20
|
+
+ this.Client = this.options.Client || Client
|
|
21
|
+
this.Promise = this.options.Promise || global.Promise
|