@reyemtech/nimbus 2.12.5 → 3.0.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.
Files changed (276) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/backup/index.d.ts.map +1 -1
  3. package/dist/cjs/backup/index.js +6 -1
  4. package/dist/cjs/backup/index.js.map +1 -1
  5. package/dist/cjs/cli/migrate-cnpg-ownership.d.ts +43 -0
  6. package/dist/cjs/cli/migrate-cnpg-ownership.d.ts.map +1 -0
  7. package/dist/cjs/cli/migrate-cnpg-ownership.js +67 -0
  8. package/dist/cjs/cli/migrate-cnpg-ownership.js.map +1 -0
  9. package/dist/cjs/cli/migrate-cnpg-roles.d.ts +92 -0
  10. package/dist/cjs/cli/migrate-cnpg-roles.d.ts.map +1 -0
  11. package/dist/cjs/cli/migrate-cnpg-roles.js +337 -0
  12. package/dist/cjs/cli/migrate-cnpg-roles.js.map +1 -0
  13. package/dist/cjs/cli/migrate-cnpg.d.ts +38 -0
  14. package/dist/cjs/cli/migrate-cnpg.d.ts.map +1 -0
  15. package/dist/cjs/cli/migrate-cnpg.js +258 -0
  16. package/dist/cjs/cli/migrate-cnpg.js.map +1 -0
  17. package/dist/cjs/cli/migrate-exec.d.ts +45 -0
  18. package/dist/cjs/cli/migrate-exec.d.ts.map +1 -0
  19. package/dist/cjs/cli/migrate-exec.js +104 -0
  20. package/dist/cjs/cli/migrate-exec.js.map +1 -0
  21. package/dist/cjs/cli/migrate-psql.d.ts +125 -0
  22. package/dist/cjs/cli/migrate-psql.d.ts.map +1 -0
  23. package/dist/cjs/cli/migrate-psql.js +213 -0
  24. package/dist/cjs/cli/migrate-psql.js.map +1 -0
  25. package/dist/cjs/cli/migrate-report.d.ts +27 -0
  26. package/dist/cjs/cli/migrate-report.d.ts.map +1 -0
  27. package/dist/cjs/cli/migrate-report.js +29 -0
  28. package/dist/cjs/cli/migrate-report.js.map +1 -0
  29. package/dist/cjs/cli/migrate-superuser.d.ts +22 -0
  30. package/dist/cjs/cli/migrate-superuser.d.ts.map +1 -0
  31. package/dist/cjs/cli/migrate-superuser.js +73 -0
  32. package/dist/cjs/cli/migrate-superuser.js.map +1 -0
  33. package/dist/cjs/cli/migrate.d.ts +37 -0
  34. package/dist/cjs/cli/migrate.d.ts.map +1 -0
  35. package/dist/cjs/cli/migrate.js +67 -0
  36. package/dist/cjs/cli/migrate.js.map +1 -0
  37. package/dist/cjs/cli.d.ts +1 -0
  38. package/dist/cjs/cli.d.ts.map +1 -1
  39. package/dist/cjs/cli.js +6 -0
  40. package/dist/cjs/cli.js.map +1 -1
  41. package/dist/cjs/index.d.ts +1 -1
  42. package/dist/cjs/index.d.ts.map +1 -1
  43. package/dist/cjs/index.js.map +1 -1
  44. package/dist/cjs/operator/cnpg-common.d.ts +56 -0
  45. package/dist/cjs/operator/cnpg-common.d.ts.map +1 -0
  46. package/dist/cjs/operator/cnpg-common.js +82 -0
  47. package/dist/cjs/operator/cnpg-common.js.map +1 -0
  48. package/dist/cjs/operator/cnpg-database.d.ts +66 -0
  49. package/dist/cjs/operator/cnpg-database.d.ts.map +1 -0
  50. package/dist/cjs/operator/cnpg-database.js +296 -0
  51. package/dist/cjs/operator/cnpg-database.js.map +1 -0
  52. package/dist/cjs/operator/cnpg-roles.d.ts +173 -0
  53. package/dist/cjs/operator/cnpg-roles.d.ts.map +1 -0
  54. package/dist/cjs/operator/cnpg-roles.js +225 -0
  55. package/dist/cjs/operator/cnpg-roles.js.map +1 -0
  56. package/dist/cjs/operator/cnpg.d.ts.map +1 -1
  57. package/dist/cjs/operator/cnpg.js +50 -162
  58. package/dist/cjs/operator/cnpg.js.map +1 -1
  59. package/dist/cjs/operator/connection-uri.d.ts +44 -0
  60. package/dist/cjs/operator/connection-uri.d.ts.map +1 -0
  61. package/dist/cjs/operator/connection-uri.js +49 -0
  62. package/dist/cjs/operator/connection-uri.js.map +1 -0
  63. package/dist/cjs/operator/credentials.d.ts +76 -0
  64. package/dist/cjs/operator/credentials.d.ts.map +1 -0
  65. package/dist/cjs/operator/credentials.js +106 -0
  66. package/dist/cjs/operator/credentials.js.map +1 -0
  67. package/dist/cjs/operator/database-options.d.ts +121 -0
  68. package/dist/cjs/operator/database-options.d.ts.map +1 -0
  69. package/dist/cjs/operator/database-options.js +131 -0
  70. package/dist/cjs/operator/database-options.js.map +1 -0
  71. package/dist/cjs/operator/grants/postgres-job.d.ts +109 -0
  72. package/dist/cjs/operator/grants/postgres-job.d.ts.map +1 -0
  73. package/dist/cjs/operator/grants/postgres-job.js +232 -0
  74. package/dist/cjs/operator/grants/postgres-job.js.map +1 -0
  75. package/dist/cjs/operator/grants/postgres-sql.d.ts +130 -0
  76. package/dist/cjs/operator/grants/postgres-sql.d.ts.map +1 -0
  77. package/dist/cjs/operator/grants/postgres-sql.js +305 -0
  78. package/dist/cjs/operator/grants/postgres-sql.js.map +1 -0
  79. package/dist/cjs/operator/grants/privileges.d.ts +24 -0
  80. package/dist/cjs/operator/grants/privileges.d.ts.map +1 -0
  81. package/dist/cjs/operator/grants/privileges.js +35 -0
  82. package/dist/cjs/operator/grants/privileges.js.map +1 -0
  83. package/dist/cjs/operator/grants/role-config.d.ts +80 -0
  84. package/dist/cjs/operator/grants/role-config.d.ts.map +1 -0
  85. package/dist/cjs/operator/grants/role-config.js +134 -0
  86. package/dist/cjs/operator/grants/role-config.js.map +1 -0
  87. package/dist/cjs/operator/index.d.ts +1 -1
  88. package/dist/cjs/operator/index.d.ts.map +1 -1
  89. package/dist/cjs/operator/index.js.map +1 -1
  90. package/dist/cjs/operator/interfaces.d.ts +223 -1
  91. package/dist/cjs/operator/interfaces.d.ts.map +1 -1
  92. package/dist/cjs/operator/interfaces.js.map +1 -1
  93. package/dist/cjs/operator/mariadb-common.d.ts +99 -0
  94. package/dist/cjs/operator/mariadb-common.d.ts.map +1 -0
  95. package/dist/cjs/operator/mariadb-common.js +141 -0
  96. package/dist/cjs/operator/mariadb-common.js.map +1 -0
  97. package/dist/cjs/operator/mariadb-database.d.ts +65 -0
  98. package/dist/cjs/operator/mariadb-database.d.ts.map +1 -0
  99. package/dist/cjs/operator/mariadb-database.js +285 -0
  100. package/dist/cjs/operator/mariadb-database.js.map +1 -0
  101. package/dist/cjs/operator/mariadb-roles.d.ts +264 -0
  102. package/dist/cjs/operator/mariadb-roles.d.ts.map +1 -0
  103. package/dist/cjs/operator/mariadb-roles.js +366 -0
  104. package/dist/cjs/operator/mariadb-roles.js.map +1 -0
  105. package/dist/cjs/operator/mariadb.d.ts.map +1 -1
  106. package/dist/cjs/operator/mariadb.js +35 -147
  107. package/dist/cjs/operator/mariadb.js.map +1 -1
  108. package/dist/cjs/operator/neo4j-common.d.ts +62 -0
  109. package/dist/cjs/operator/neo4j-common.d.ts.map +1 -0
  110. package/dist/cjs/operator/neo4j-common.js +89 -0
  111. package/dist/cjs/operator/neo4j-common.js.map +1 -0
  112. package/dist/cjs/operator/neo4j-database.d.ts +88 -0
  113. package/dist/cjs/operator/neo4j-database.d.ts.map +1 -0
  114. package/dist/cjs/operator/neo4j-database.js +274 -0
  115. package/dist/cjs/operator/neo4j-database.js.map +1 -0
  116. package/dist/cjs/operator/neo4j-roles.d.ts +203 -0
  117. package/dist/cjs/operator/neo4j-roles.d.ts.map +1 -0
  118. package/dist/cjs/operator/neo4j-roles.js +298 -0
  119. package/dist/cjs/operator/neo4j-roles.js.map +1 -0
  120. package/dist/cjs/operator/neo4j.d.ts.map +1 -1
  121. package/dist/cjs/operator/neo4j.js +32 -132
  122. package/dist/cjs/operator/neo4j.js.map +1 -1
  123. package/dist/cjs/operator/resource-identity.d.ts +170 -0
  124. package/dist/cjs/operator/resource-identity.d.ts.map +1 -0
  125. package/dist/cjs/operator/resource-identity.js +231 -0
  126. package/dist/cjs/operator/resource-identity.js.map +1 -0
  127. package/dist/cjs/operator/role-registry.d.ts +85 -0
  128. package/dist/cjs/operator/role-registry.d.ts.map +1 -0
  129. package/dist/cjs/operator/role-registry.js +72 -0
  130. package/dist/cjs/operator/role-registry.js.map +1 -0
  131. package/dist/cjs/platform/components/image-pruner.d.ts +3 -1
  132. package/dist/cjs/platform/components/image-pruner.d.ts.map +1 -1
  133. package/dist/cjs/platform/components/image-pruner.js +38 -19
  134. package/dist/cjs/platform/components/image-pruner.js.map +1 -1
  135. package/dist/cjs/types/errors.d.ts +3 -0
  136. package/dist/cjs/types/errors.d.ts.map +1 -1
  137. package/dist/cjs/types/errors.js +3 -0
  138. package/dist/cjs/types/errors.js.map +1 -1
  139. package/dist/esm/backup/index.d.ts.map +1 -1
  140. package/dist/esm/backup/index.js +6 -1
  141. package/dist/esm/backup/index.js.map +1 -1
  142. package/dist/esm/cli/migrate-cnpg-ownership.d.ts +43 -0
  143. package/dist/esm/cli/migrate-cnpg-ownership.d.ts.map +1 -0
  144. package/dist/esm/cli/migrate-cnpg-ownership.js +67 -0
  145. package/dist/esm/cli/migrate-cnpg-ownership.js.map +1 -0
  146. package/dist/esm/cli/migrate-cnpg-roles.d.ts +92 -0
  147. package/dist/esm/cli/migrate-cnpg-roles.d.ts.map +1 -0
  148. package/dist/esm/cli/migrate-cnpg-roles.js +337 -0
  149. package/dist/esm/cli/migrate-cnpg-roles.js.map +1 -0
  150. package/dist/esm/cli/migrate-cnpg.d.ts +38 -0
  151. package/dist/esm/cli/migrate-cnpg.d.ts.map +1 -0
  152. package/dist/esm/cli/migrate-cnpg.js +258 -0
  153. package/dist/esm/cli/migrate-cnpg.js.map +1 -0
  154. package/dist/esm/cli/migrate-exec.d.ts +45 -0
  155. package/dist/esm/cli/migrate-exec.d.ts.map +1 -0
  156. package/dist/esm/cli/migrate-exec.js +104 -0
  157. package/dist/esm/cli/migrate-exec.js.map +1 -0
  158. package/dist/esm/cli/migrate-psql.d.ts +125 -0
  159. package/dist/esm/cli/migrate-psql.d.ts.map +1 -0
  160. package/dist/esm/cli/migrate-psql.js +213 -0
  161. package/dist/esm/cli/migrate-psql.js.map +1 -0
  162. package/dist/esm/cli/migrate-report.d.ts +27 -0
  163. package/dist/esm/cli/migrate-report.d.ts.map +1 -0
  164. package/dist/esm/cli/migrate-report.js +29 -0
  165. package/dist/esm/cli/migrate-report.js.map +1 -0
  166. package/dist/esm/cli/migrate-superuser.d.ts +22 -0
  167. package/dist/esm/cli/migrate-superuser.d.ts.map +1 -0
  168. package/dist/esm/cli/migrate-superuser.js +73 -0
  169. package/dist/esm/cli/migrate-superuser.js.map +1 -0
  170. package/dist/esm/cli/migrate.d.ts +37 -0
  171. package/dist/esm/cli/migrate.d.ts.map +1 -0
  172. package/dist/esm/cli/migrate.js +67 -0
  173. package/dist/esm/cli/migrate.js.map +1 -0
  174. package/dist/esm/cli.d.ts +1 -0
  175. package/dist/esm/cli.d.ts.map +1 -1
  176. package/dist/esm/cli.js +6 -0
  177. package/dist/esm/cli.js.map +1 -1
  178. package/dist/esm/index.d.ts +1 -1
  179. package/dist/esm/index.d.ts.map +1 -1
  180. package/dist/esm/index.js.map +1 -1
  181. package/dist/esm/operator/cnpg-common.d.ts +56 -0
  182. package/dist/esm/operator/cnpg-common.d.ts.map +1 -0
  183. package/dist/esm/operator/cnpg-common.js +82 -0
  184. package/dist/esm/operator/cnpg-common.js.map +1 -0
  185. package/dist/esm/operator/cnpg-database.d.ts +66 -0
  186. package/dist/esm/operator/cnpg-database.d.ts.map +1 -0
  187. package/dist/esm/operator/cnpg-database.js +296 -0
  188. package/dist/esm/operator/cnpg-database.js.map +1 -0
  189. package/dist/esm/operator/cnpg-roles.d.ts +173 -0
  190. package/dist/esm/operator/cnpg-roles.d.ts.map +1 -0
  191. package/dist/esm/operator/cnpg-roles.js +225 -0
  192. package/dist/esm/operator/cnpg-roles.js.map +1 -0
  193. package/dist/esm/operator/cnpg.d.ts.map +1 -1
  194. package/dist/esm/operator/cnpg.js +50 -162
  195. package/dist/esm/operator/cnpg.js.map +1 -1
  196. package/dist/esm/operator/connection-uri.d.ts +44 -0
  197. package/dist/esm/operator/connection-uri.d.ts.map +1 -0
  198. package/dist/esm/operator/connection-uri.js +49 -0
  199. package/dist/esm/operator/connection-uri.js.map +1 -0
  200. package/dist/esm/operator/credentials.d.ts +76 -0
  201. package/dist/esm/operator/credentials.d.ts.map +1 -0
  202. package/dist/esm/operator/credentials.js +106 -0
  203. package/dist/esm/operator/credentials.js.map +1 -0
  204. package/dist/esm/operator/database-options.d.ts +121 -0
  205. package/dist/esm/operator/database-options.d.ts.map +1 -0
  206. package/dist/esm/operator/database-options.js +131 -0
  207. package/dist/esm/operator/database-options.js.map +1 -0
  208. package/dist/esm/operator/grants/postgres-job.d.ts +109 -0
  209. package/dist/esm/operator/grants/postgres-job.d.ts.map +1 -0
  210. package/dist/esm/operator/grants/postgres-job.js +232 -0
  211. package/dist/esm/operator/grants/postgres-job.js.map +1 -0
  212. package/dist/esm/operator/grants/postgres-sql.d.ts +130 -0
  213. package/dist/esm/operator/grants/postgres-sql.d.ts.map +1 -0
  214. package/dist/esm/operator/grants/postgres-sql.js +305 -0
  215. package/dist/esm/operator/grants/postgres-sql.js.map +1 -0
  216. package/dist/esm/operator/grants/privileges.d.ts +24 -0
  217. package/dist/esm/operator/grants/privileges.d.ts.map +1 -0
  218. package/dist/esm/operator/grants/privileges.js +35 -0
  219. package/dist/esm/operator/grants/privileges.js.map +1 -0
  220. package/dist/esm/operator/grants/role-config.d.ts +80 -0
  221. package/dist/esm/operator/grants/role-config.d.ts.map +1 -0
  222. package/dist/esm/operator/grants/role-config.js +134 -0
  223. package/dist/esm/operator/grants/role-config.js.map +1 -0
  224. package/dist/esm/operator/index.d.ts +1 -1
  225. package/dist/esm/operator/index.d.ts.map +1 -1
  226. package/dist/esm/operator/index.js.map +1 -1
  227. package/dist/esm/operator/interfaces.d.ts +223 -1
  228. package/dist/esm/operator/interfaces.d.ts.map +1 -1
  229. package/dist/esm/operator/interfaces.js.map +1 -1
  230. package/dist/esm/operator/mariadb-common.d.ts +99 -0
  231. package/dist/esm/operator/mariadb-common.d.ts.map +1 -0
  232. package/dist/esm/operator/mariadb-common.js +141 -0
  233. package/dist/esm/operator/mariadb-common.js.map +1 -0
  234. package/dist/esm/operator/mariadb-database.d.ts +65 -0
  235. package/dist/esm/operator/mariadb-database.d.ts.map +1 -0
  236. package/dist/esm/operator/mariadb-database.js +285 -0
  237. package/dist/esm/operator/mariadb-database.js.map +1 -0
  238. package/dist/esm/operator/mariadb-roles.d.ts +264 -0
  239. package/dist/esm/operator/mariadb-roles.d.ts.map +1 -0
  240. package/dist/esm/operator/mariadb-roles.js +366 -0
  241. package/dist/esm/operator/mariadb-roles.js.map +1 -0
  242. package/dist/esm/operator/mariadb.d.ts.map +1 -1
  243. package/dist/esm/operator/mariadb.js +35 -147
  244. package/dist/esm/operator/mariadb.js.map +1 -1
  245. package/dist/esm/operator/neo4j-common.d.ts +62 -0
  246. package/dist/esm/operator/neo4j-common.d.ts.map +1 -0
  247. package/dist/esm/operator/neo4j-common.js +89 -0
  248. package/dist/esm/operator/neo4j-common.js.map +1 -0
  249. package/dist/esm/operator/neo4j-database.d.ts +88 -0
  250. package/dist/esm/operator/neo4j-database.d.ts.map +1 -0
  251. package/dist/esm/operator/neo4j-database.js +274 -0
  252. package/dist/esm/operator/neo4j-database.js.map +1 -0
  253. package/dist/esm/operator/neo4j-roles.d.ts +203 -0
  254. package/dist/esm/operator/neo4j-roles.d.ts.map +1 -0
  255. package/dist/esm/operator/neo4j-roles.js +298 -0
  256. package/dist/esm/operator/neo4j-roles.js.map +1 -0
  257. package/dist/esm/operator/neo4j.d.ts.map +1 -1
  258. package/dist/esm/operator/neo4j.js +32 -132
  259. package/dist/esm/operator/neo4j.js.map +1 -1
  260. package/dist/esm/operator/resource-identity.d.ts +170 -0
  261. package/dist/esm/operator/resource-identity.d.ts.map +1 -0
  262. package/dist/esm/operator/resource-identity.js +231 -0
  263. package/dist/esm/operator/resource-identity.js.map +1 -0
  264. package/dist/esm/operator/role-registry.d.ts +85 -0
  265. package/dist/esm/operator/role-registry.d.ts.map +1 -0
  266. package/dist/esm/operator/role-registry.js +72 -0
  267. package/dist/esm/operator/role-registry.js.map +1 -0
  268. package/dist/esm/platform/components/image-pruner.d.ts +3 -1
  269. package/dist/esm/platform/components/image-pruner.d.ts.map +1 -1
  270. package/dist/esm/platform/components/image-pruner.js +38 -19
  271. package/dist/esm/platform/components/image-pruner.js.map +1 -1
  272. package/dist/esm/types/errors.d.ts +3 -0
  273. package/dist/esm/types/errors.d.ts.map +1 -1
  274. package/dist/esm/types/errors.js +3 -0
  275. package/dist/esm/types/errors.js.map +1 -1
  276. package/package.json +1 -1
package/README.md CHANGED
@@ -144,6 +144,8 @@ pulumi stack output # View stack outputs
144
144
  - [API Reference](docs/api-reference.md) — Factory functions, provider options, direct cloud functions
145
145
  - [Examples](docs/examples.md) — Single-cloud, multi-cloud, standalone resources, BCDR
146
146
  - [Utilities](docs/utilities.md) — CIDR helpers, validation, tags, error handling
147
+ - [CNPG Declarative Databases](docs/cnpg-declarative-databases.md) — Migrating PostgreSQL databases from bootstrap Jobs to `Database`/`DatabaseRole` CRDs
148
+ - [v3 Migration Guide](docs/migrations/v3.md) — Upgrading to `addRole()`, the `superuserAccess` default change, and the `migrate v3` pre-flight check
147
149
 
148
150
  ## Development
149
151
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backup/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEvE,YAAY,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEjG;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,aAAa,CAsN3F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backup/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEvE,YAAY,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEjG;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,aAAa,CA2N3F"}
@@ -113,7 +113,12 @@ function createBackupTarget(name, config) {
113
113
  const replicaProvider = new aws.Provider(`${name}-replica-provider`, {
114
114
  region: replicaRegion,
115
115
  });
116
- const replicaBucketName = `${bucketName}-replica`;
116
+ // Suffix with the account ID: S3 bucket names are global, and a plain
117
+ // "<name>-replica" can be claimed by any other AWS account (this happened
118
+ // to reyem-backups-replica — replication silently dead-ended against a
119
+ // foreign bucket). The account ID guarantees uniqueness and ownership.
120
+ const accountId = aws.getCallerIdentityOutput({}, providerOpts).accountId;
121
+ const replicaBucketName = pulumi.interpolate `${bucketName}-replica-${accountId}`;
117
122
  const replicaBucketResource = new aws.s3.Bucket(`${name}-replica-bucket`, {
118
123
  bucket: replicaBucketName,
119
124
  tags: config.tags,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/backup/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBH,gDAsNC;AAtOD,iDAAmC;AACnC,uDAAyC;AAKzC;;;;;;;;;GASG;AACH,SAAgB,kBAAkB,CAAC,IAAY,EAAE,MAA2B;IAC1E,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,YAAY,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACjF,MAAM,YAAY,GAAiC,MAAM,CAAC,WAAW;QACnE,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE;QAClC,CAAC,CAAC,EAAE,CAAC;IAEP,iBAAiB;IACjB,MAAM,MAAM,GAAG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IAAI,gBAAgB;oBAC3B,MAAM,EAAE,SAAS;oBACjB,WAAW,EAAE;wBACX,MAAM,EAAE,qBAAqB,CAAC,GAAG;wBACjC,YAAY,EAAE,UAAU;qBACzB;oBACD,MAAM,EAAE;wBACN,MAAM,EAAE,EAAE;qBACX;oBACD,uBAAuB,EAAE;wBACvB,MAAM,EAAE,SAAS;qBAClB;iBACF;aACF;SACF,EACD,EAAE,GAAG,YAAY,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,EAAE,CACnF,CAAC;QAEF,iBAAiB,GAAG,qBAAqB,CAAC,MAAM,CAAC;IACnD,CAAC;IAED,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,WAAW,EAAE;YACX,WAAW,EAAE,SAAS,CAAC,EAAE;YACzB,eAAe,EAAE,SAAS,CAAC,MAAM;SAClC;QACD,iBAAiB;QACjB,cAAc,EAAE,MAAM;KACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Database ownership parsing for the `nimbus migrate` CNPG check.
3
+ *
4
+ * `Database` adoption issues `ALTER DATABASE … OWNER TO` unconditionally, so
5
+ * that statement is only a no-op when the database's current owner already
6
+ * matches what nimbus assigns. This module parses the database ownership
7
+ * query from `docs/cnpg-declarative-databases.md` (reused verbatim, see
8
+ * {@link DATABASE_OWNERSHIP_QUERY}).
9
+ *
10
+ * The query is run through {@link toJsonRowsQuery} for the reason spelt out in
11
+ * {@link module:cli/migrate-psql}: `psql -tAc` escapes nothing, so a database or
12
+ * owner name containing a `|` split into three fields where two were expected
13
+ * and the row was silently dropped — from the check whose job is to notice that
14
+ * exact database. Rows that still cannot be read come back as warnings.
15
+ *
16
+ * @module cli/migrate-cnpg-ownership
17
+ */
18
+ /** Databases that are not created by `createDatabase()` and have no owner convention to check. */
19
+ export declare const SYSTEM_DATABASE_NAMES: readonly string[];
20
+ /** Database ownership query from `docs/cnpg-declarative-databases.md`. */
21
+ export declare const DATABASE_OWNERSHIP_QUERY = "SELECT d.datname, pg_get_userbyid(d.datdba) AS owner\nFROM pg_database d WHERE NOT d.datistemplate ORDER BY 1";
22
+ /** {@link DATABASE_OWNERSHIP_QUERY} as the JSON document {@link parseDatabaseRows} reads. */
23
+ export declare const DATABASE_OWNERSHIP_JSON_QUERY: string;
24
+ /** One row of {@link DATABASE_OWNERSHIP_QUERY}, parsed and typed. */
25
+ export interface IParsedDatabaseRow {
26
+ readonly name: string;
27
+ readonly owner: string;
28
+ }
29
+ /** Parsed databases, plus a warning for every row that could not be read. */
30
+ export interface IDatabaseRowsResult {
31
+ /** Rows that parsed cleanly. */
32
+ readonly databases: ReadonlyArray<IParsedDatabaseRow>;
33
+ /** One line per unreadable row; never empty when a row was skipped. */
34
+ readonly warnings: ReadonlyArray<string>;
35
+ }
36
+ /**
37
+ * Parse every row returned by {@link DATABASE_OWNERSHIP_JSON_QUERY}.
38
+ *
39
+ * @param stdout - Raw `psql -tAc` output of the JSON-wrapped query
40
+ * @returns The databases that parsed, and a warning for every row that did not
41
+ */
42
+ export declare function parseDatabaseRows(stdout: string): IDatabaseRowsResult;
43
+ //# sourceMappingURL=migrate-cnpg-ownership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-cnpg-ownership.d.ts","sourceRoot":"","sources":["../../../src/cli/migrate-cnpg-ownership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,kGAAkG;AAClG,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAAiB,CAAC;AAErE,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,kHACmB,CAAC;AAEzD,6FAA6F;AAC7F,eAAO,MAAM,6BAA6B,QAA4C,CAAC;AAWvF,qEAAqE;AACrE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,6EAA6E;AAC7E,MAAM,WAAW,mBAAmB;IAClC,gCAAgC;IAChC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACtD,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC1C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CA2BrE"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ /**
3
+ * Database ownership parsing for the `nimbus migrate` CNPG check.
4
+ *
5
+ * `Database` adoption issues `ALTER DATABASE … OWNER TO` unconditionally, so
6
+ * that statement is only a no-op when the database's current owner already
7
+ * matches what nimbus assigns. This module parses the database ownership
8
+ * query from `docs/cnpg-declarative-databases.md` (reused verbatim, see
9
+ * {@link DATABASE_OWNERSHIP_QUERY}).
10
+ *
11
+ * The query is run through {@link toJsonRowsQuery} for the reason spelt out in
12
+ * {@link module:cli/migrate-psql}: `psql -tAc` escapes nothing, so a database or
13
+ * owner name containing a `|` split into three fields where two were expected
14
+ * and the row was silently dropped — from the check whose job is to notice that
15
+ * exact database. Rows that still cannot be read come back as warnings.
16
+ *
17
+ * @module cli/migrate-cnpg-ownership
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.DATABASE_OWNERSHIP_JSON_QUERY = exports.DATABASE_OWNERSHIP_QUERY = exports.SYSTEM_DATABASE_NAMES = void 0;
21
+ exports.parseDatabaseRows = parseDatabaseRows;
22
+ const migrate_psql_js_1 = require("./migrate-psql.js");
23
+ /** Databases that are not created by `createDatabase()` and have no owner convention to check. */
24
+ exports.SYSTEM_DATABASE_NAMES = ["postgres"];
25
+ /** Database ownership query from `docs/cnpg-declarative-databases.md`. */
26
+ exports.DATABASE_OWNERSHIP_QUERY = `SELECT d.datname, pg_get_userbyid(d.datdba) AS owner
27
+ FROM pg_database d WHERE NOT d.datistemplate ORDER BY 1`;
28
+ /** {@link DATABASE_OWNERSHIP_QUERY} as the JSON document {@link parseDatabaseRows} reads. */
29
+ exports.DATABASE_OWNERSHIP_JSON_QUERY = (0, migrate_psql_js_1.toJsonRowsQuery)(exports.DATABASE_OWNERSHIP_QUERY);
30
+ /** What this query reads, named in warnings. */
31
+ const SUBJECT = "pg_database";
32
+ /** Columns {@link DATABASE_OWNERSHIP_QUERY} returns, by the name `row_to_json` gives them. */
33
+ const DATABASE_COLUMNS = {
34
+ NAME: "datname",
35
+ OWNER: "owner",
36
+ };
37
+ /**
38
+ * Parse every row returned by {@link DATABASE_OWNERSHIP_JSON_QUERY}.
39
+ *
40
+ * @param stdout - Raw `psql -tAc` output of the JSON-wrapped query
41
+ * @returns The databases that parsed, and a warning for every row that did not
42
+ */
43
+ function parseDatabaseRows(stdout) {
44
+ const parsed = (0, migrate_psql_js_1.parseJsonRows)(stdout, SUBJECT);
45
+ const databases = [];
46
+ const warnings = [...parsed.warnings];
47
+ parsed.rows.forEach((row, index) => {
48
+ const name = (0, migrate_psql_js_1.readString)(row, DATABASE_COLUMNS.NAME);
49
+ const owner = (0, migrate_psql_js_1.readString)(row, DATABASE_COLUMNS.OWNER);
50
+ if (name === undefined || owner === undefined) {
51
+ const columns = [
52
+ [DATABASE_COLUMNS.NAME, name],
53
+ [DATABASE_COLUMNS.OWNER, owner],
54
+ ]
55
+ .filter(([, value]) => value === undefined)
56
+ .map(([column]) => column)
57
+ .join(", ");
58
+ const where = name === undefined ? `${SUBJECT} row ${index + 1}` : `database "${name}"`;
59
+ warnings.push(`${where}: could not read ${columns} from the ${SUBJECT} query output, so this ` +
60
+ "database's ownership was NOT checked.");
61
+ return;
62
+ }
63
+ databases.push({ name, owner });
64
+ });
65
+ return { databases, warnings };
66
+ }
67
+ //# sourceMappingURL=migrate-cnpg-ownership.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-cnpg-ownership.js","sourceRoot":"","sources":["../../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AS,CAAC;iBAC1C,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC;iBACzB,IAAI,CAAC,IAAI,CAAC,CAAC;YACd,MAAM,KAAK,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,QAAQ,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,IAAI,GAAG,CAAC;YACxF,QAAQ,CAAC,IAAI,CACX,GAAG,KAAK,oBAAoB,OAAO,aAAa,OAAO,yBAAyB;gBAC9E,uCAAuC,CAC1C,CAAC;YACF,OAAO;QACT,CAAC;QACD,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Role attribute baseline and parsing for the `nimbus migrate` CNPG check.
3
+ *
4
+ * `DatabaseRole` adoption ALTERs an existing role to match the manifest,
5
+ * forcing attributes the manifest omits back to their defaults. nimbus's
6
+ * manifest sets only `login: true`, so every other attribute must already sit
7
+ * at the PostgreSQL default for adoption to be a no-op. This module parses the
8
+ * `pg_roles` query from `docs/cnpg-declarative-databases.md` (reused verbatim,
9
+ * see {@link ROLE_ATTRIBUTES_QUERY}) and flags rows that deviate.
10
+ *
11
+ * The baseline covers every attribute `DatabaseRole.spec` can express, not the
12
+ * subset that is easy to query. Checking fewer is the same false all-clear as
13
+ * skipping a row: `replication`, `validUntil` and `comment` were missing, so a
14
+ * role carrying `REPLICATION` or a finite `VALID UNTIL` was reported as sitting
15
+ * on the baseline and then had exactly that stripped on the first reconcile.
16
+ * Every field of the CRD's `spec` that maps onto a role attribute is read here;
17
+ * the ones that do not (`cluster`, `name`, `ensure`, `databaseRoleReclaimPolicy`,
18
+ * `clientCertificate`) name or govern the CR rather than the role, and
19
+ * `passwordSecret` carries the password migration re-applies deliberately.
20
+ *
21
+ * The query is run through {@link toJsonRowsQuery} rather than read as `psql`'s
22
+ * pipe-delimited output: a role name may contain a `|`, and psql escapes
23
+ * nothing, so such a row parsed as ten fields instead of nine and was discarded.
24
+ * The check then reported that every role matched the baseline while having
25
+ * skipped precisely the role whose attributes adoption would reset. Nothing is
26
+ * dropped now — a row that still cannot be read is returned as a warning.
27
+ *
28
+ * @module cli/migrate-cnpg-roles
29
+ */
30
+ /**
31
+ * Operator-managed roles that intentionally do not follow the nimbus baseline
32
+ * (e.g. `postgres` is a superuser by definition). Excluded from role deviation
33
+ * reporting so the check only flags roles nimbus actually provisions.
34
+ */
35
+ export declare const BUILTIN_ROLE_NAMES: readonly string[];
36
+ /**
37
+ * `pg_roles` query from `docs/cnpg-declarative-databases.md`, reused verbatim so this
38
+ * check and the documented manual procedure never drift apart.
39
+ */
40
+ export declare const ROLE_ATTRIBUTES_QUERY = "SELECT r.rolname, r.rolcanlogin, r.rolsuper, r.rolcreatedb, r.rolcreaterole,\n r.rolinherit, r.rolconnlimit, r.rolbypassrls, r.rolreplication, r.rolvaliduntil,\n shobj_description(r.oid, 'pg_authid') AS rolcomment,\n coalesce(array_agg(m.rolname) FILTER (WHERE m.rolname IS NOT NULL), '{}') AS memberof\nFROM pg_roles r\nLEFT JOIN pg_auth_members am ON am.member = r.oid\nLEFT JOIN pg_roles m ON m.oid = am.roleid\nWHERE r.rolname NOT LIKE 'pg\\_%'\nGROUP BY 1,2,3,4,5,6,7,8,9,10,11 ORDER BY 1";
41
+ /** {@link ROLE_ATTRIBUTES_QUERY} as the JSON document {@link parseRoleRows} reads. */
42
+ export declare const ROLE_ATTRIBUTES_JSON_QUERY: string;
43
+ /** One row of {@link ROLE_ATTRIBUTES_QUERY}, parsed and typed. */
44
+ export interface IParsedRoleRow {
45
+ readonly name: string;
46
+ readonly canLogin: boolean;
47
+ readonly isSuperuser: boolean;
48
+ readonly canCreateDb: boolean;
49
+ readonly canCreateRole: boolean;
50
+ readonly inherits: boolean;
51
+ readonly connectionLimit: number;
52
+ readonly bypassesRls: boolean;
53
+ readonly canReplicate: boolean;
54
+ /** Password expiry, or null when the password never expires. */
55
+ readonly validUntil: string | null;
56
+ /** Role comment, or null when the role carries none. */
57
+ readonly comment: string | null;
58
+ readonly memberOf: ReadonlyArray<string>;
59
+ }
60
+ /** Parsed roles, plus a warning for every row that could not be read. */
61
+ export interface IRoleRowsResult {
62
+ /** Rows that parsed cleanly. */
63
+ readonly roles: ReadonlyArray<IParsedRoleRow>;
64
+ /** One line per unreadable row; never empty when a row was skipped. */
65
+ readonly warnings: ReadonlyArray<string>;
66
+ }
67
+ /**
68
+ * Parse every row returned by {@link ROLE_ATTRIBUTES_JSON_QUERY}.
69
+ *
70
+ * @param stdout - Raw `psql -tAc` output of the JSON-wrapped query
71
+ * @returns The roles that parsed, and a warning for every row that did not
72
+ */
73
+ export declare function parseRoleRows(stdout: string): IRoleRowsResult;
74
+ /**
75
+ * Whether `DatabaseRole` adoption would leave this role's attributes alone.
76
+ *
77
+ * Every attribute `DatabaseRole.spec` can express is compared, because adoption
78
+ * resets each one the manifest omits — checking a subset reports roles as safe
79
+ * that adoption is about to change. See {@link BASELINE_ATTRIBUTES}.
80
+ *
81
+ * @param role - Parsed role row
82
+ * @returns True when every attribute matches the baseline
83
+ */
84
+ export declare function roleMatchesBaseline(role: IParsedRoleRow): boolean;
85
+ /**
86
+ * Describe how a role's attributes deviate from the nimbus baseline, for report output.
87
+ *
88
+ * @param role - Parsed role row that failed {@link roleMatchesBaseline}
89
+ * @returns A one-line, human-readable description of the deviation
90
+ */
91
+ export declare function describeRoleDeviation(role: IParsedRoleRow): string;
92
+ //# sourceMappingURL=migrate-cnpg-roles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-cnpg-roles.d.ts","sourceRoot":"","sources":["../../../src/cli/migrate-cnpg-roles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;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AqB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAKlE"}
@@ -0,0 +1,337 @@
1
+ "use strict";
2
+ /**
3
+ * Role attribute baseline and parsing for the `nimbus migrate` CNPG check.
4
+ *
5
+ * `DatabaseRole` adoption ALTERs an existing role to match the manifest,
6
+ * forcing attributes the manifest omits back to their defaults. nimbus's
7
+ * manifest sets only `login: true`, so every other attribute must already sit
8
+ * at the PostgreSQL default for adoption to be a no-op. This module parses the
9
+ * `pg_roles` query from `docs/cnpg-declarative-databases.md` (reused verbatim,
10
+ * see {@link ROLE_ATTRIBUTES_QUERY}) and flags rows that deviate.
11
+ *
12
+ * The baseline covers every attribute `DatabaseRole.spec` can express, not the
13
+ * subset that is easy to query. Checking fewer is the same false all-clear as
14
+ * skipping a row: `replication`, `validUntil` and `comment` were missing, so a
15
+ * role carrying `REPLICATION` or a finite `VALID UNTIL` was reported as sitting
16
+ * on the baseline and then had exactly that stripped on the first reconcile.
17
+ * Every field of the CRD's `spec` that maps onto a role attribute is read here;
18
+ * the ones that do not (`cluster`, `name`, `ensure`, `databaseRoleReclaimPolicy`,
19
+ * `clientCertificate`) name or govern the CR rather than the role, and
20
+ * `passwordSecret` carries the password migration re-applies deliberately.
21
+ *
22
+ * The query is run through {@link toJsonRowsQuery} rather than read as `psql`'s
23
+ * pipe-delimited output: a role name may contain a `|`, and psql escapes
24
+ * nothing, so such a row parsed as ten fields instead of nine and was discarded.
25
+ * The check then reported that every role matched the baseline while having
26
+ * skipped precisely the role whose attributes adoption would reset. Nothing is
27
+ * dropped now — a row that still cannot be read is returned as a warning.
28
+ *
29
+ * @module cli/migrate-cnpg-roles
30
+ */
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.ROLE_ATTRIBUTES_JSON_QUERY = exports.ROLE_ATTRIBUTES_QUERY = exports.BUILTIN_ROLE_NAMES = void 0;
33
+ exports.parseRoleRows = parseRoleRows;
34
+ exports.roleMatchesBaseline = roleMatchesBaseline;
35
+ exports.describeRoleDeviation = describeRoleDeviation;
36
+ const migrate_psql_js_1 = require("./migrate-psql.js");
37
+ /**
38
+ * Operator-managed roles that intentionally do not follow the nimbus baseline
39
+ * (e.g. `postgres` is a superuser by definition). Excluded from role deviation
40
+ * reporting so the check only flags roles nimbus actually provisions.
41
+ */
42
+ exports.BUILTIN_ROLE_NAMES = [
43
+ "postgres",
44
+ "streaming_replica",
45
+ "cnpg_pooler_pgbouncer",
46
+ ];
47
+ /**
48
+ * `pg_roles` query from `docs/cnpg-declarative-databases.md`, reused verbatim so this
49
+ * check and the documented manual procedure never drift apart.
50
+ */
51
+ exports.ROLE_ATTRIBUTES_QUERY = `SELECT r.rolname, r.rolcanlogin, r.rolsuper, r.rolcreatedb, r.rolcreaterole,
52
+ r.rolinherit, r.rolconnlimit, r.rolbypassrls, r.rolreplication, r.rolvaliduntil,
53
+ shobj_description(r.oid, 'pg_authid') AS rolcomment,
54
+ coalesce(array_agg(m.rolname) FILTER (WHERE m.rolname IS NOT NULL), '{}') AS memberof
55
+ FROM pg_roles r
56
+ LEFT JOIN pg_auth_members am ON am.member = r.oid
57
+ LEFT JOIN pg_roles m ON m.oid = am.roleid
58
+ WHERE r.rolname NOT LIKE 'pg\\_%'
59
+ GROUP BY 1,2,3,4,5,6,7,8,9,10,11 ORDER BY 1`;
60
+ /** {@link ROLE_ATTRIBUTES_QUERY} as the JSON document {@link parseRoleRows} reads. */
61
+ exports.ROLE_ATTRIBUTES_JSON_QUERY = (0, migrate_psql_js_1.toJsonRowsQuery)(exports.ROLE_ATTRIBUTES_QUERY);
62
+ /** What this query reads, named in warnings. */
63
+ const SUBJECT = "pg_roles";
64
+ /** Columns {@link ROLE_ATTRIBUTES_QUERY} returns, by the name `row_to_json` gives them. */
65
+ const ROLE_COLUMNS = {
66
+ NAME: "rolname",
67
+ CAN_LOGIN: "rolcanlogin",
68
+ IS_SUPERUSER: "rolsuper",
69
+ CAN_CREATE_DB: "rolcreatedb",
70
+ CAN_CREATE_ROLE: "rolcreaterole",
71
+ INHERITS: "rolinherit",
72
+ CONNECTION_LIMIT: "rolconnlimit",
73
+ BYPASSES_RLS: "rolbypassrls",
74
+ CAN_REPLICATE: "rolreplication",
75
+ VALID_UNTIL: "rolvaliduntil",
76
+ COMMENT: "rolcomment",
77
+ MEMBER_OF: "memberof",
78
+ };
79
+ /**
80
+ * PostgreSQL's other spelling of "this password never expires".
81
+ *
82
+ * `ALTER ROLE` cannot set `VALID UNTIL NULL`, so CNPG writes `infinity` when the
83
+ * manifest omits `validUntil`. A role already carrying `infinity` is therefore
84
+ * on the baseline just as surely as one carrying NULL.
85
+ */
86
+ const INFINITE_VALID_UNTIL = "infinity";
87
+ /** How a password with no expiry is rendered in a deviation line. */
88
+ const NEVER_EXPIRES = "(never)";
89
+ /** How a role with no comment is rendered in a deviation line. */
90
+ const NO_COMMENT = "(none)";
91
+ /** Longest role comment echoed back in a deviation line. */
92
+ const MAX_COMMENT_LENGTH = 60;
93
+ /**
94
+ * The attribute set `DatabaseRole` adoption leaves untouched.
95
+ *
96
+ * Both the baseline check and the deviation message are derived from this one
97
+ * value, so the message can never describe a baseline the check does not apply.
98
+ */
99
+ const BASELINE_ATTRIBUTES = {
100
+ canLogin: true,
101
+ isSuperuser: false,
102
+ canCreateDb: false,
103
+ canCreateRole: false,
104
+ inherits: true,
105
+ connectionLimit: -1,
106
+ bypassesRls: false,
107
+ canReplicate: false,
108
+ validUntil: null,
109
+ comment: null,
110
+ memberOf: [],
111
+ };
112
+ /**
113
+ * Render a boolean back into psql's `t`/`f` notation for report output.
114
+ *
115
+ * @param value - Boolean to render
116
+ * @returns "t" or "f"
117
+ */
118
+ function toPsqlBoolean(value) {
119
+ return value ? "t" : "f";
120
+ }
121
+ /**
122
+ * Render role memberships the way psql prints a `text[]`, for report output.
123
+ *
124
+ * @param memberOf - Roles this role is a member of
125
+ * @returns The memberships in `{a,b}` form
126
+ */
127
+ function toPsqlArray(memberOf) {
128
+ return `{${memberOf.join(",")}}`;
129
+ }
130
+ /**
131
+ * Whether a role's password expiry is the one adoption would leave alone.
132
+ *
133
+ * @param validUntil - `rolvaliduntil`, or null for a SQL NULL
134
+ * @returns True when the password never expires
135
+ */
136
+ function hasNoPasswordExpiry(validUntil) {
137
+ return validUntil === null || validUntil.trim().toLowerCase() === INFINITE_VALID_UNTIL;
138
+ }
139
+ /**
140
+ * Whether a role carries no comment for adoption to clear.
141
+ *
142
+ * An empty comment and no comment at all are indistinguishable to the operator,
143
+ * which reads both as the empty string, so both sit on the baseline.
144
+ *
145
+ * @param comment - `rolcomment`, or null for a SQL NULL
146
+ * @returns True when the role has nothing adoption would overwrite
147
+ */
148
+ function hasNoComment(comment) {
149
+ return comment === null || comment === "";
150
+ }
151
+ /**
152
+ * Render a password expiry for report output.
153
+ *
154
+ * A password that never expires reads as {@link NEVER_EXPIRES} whichever way
155
+ * PostgreSQL spells it, so a role on the baseline renders identically to the
156
+ * baseline rather than as a deviation with the same meaning.
157
+ *
158
+ * @param validUntil - `rolvaliduntil`, or null for a SQL NULL
159
+ * @returns The expiry, or a phrase saying there is none
160
+ */
161
+ function toReportedValidUntil(validUntil) {
162
+ // The null test is redundant against hasNoPasswordExpiry and kept because it
163
+ // is what narrows the type of the value returned below.
164
+ if (validUntil === null || hasNoPasswordExpiry(validUntil)) {
165
+ return NEVER_EXPIRES;
166
+ }
167
+ return validUntil;
168
+ }
169
+ /**
170
+ * Render a role comment for report output.
171
+ *
172
+ * A comment is free text an operator wrote: it may be long and may contain
173
+ * newlines, and a deviation line is one line, so it is collapsed and truncated.
174
+ *
175
+ * @param comment - `rolcomment`, or null for a SQL NULL
176
+ * @returns The quoted comment, or a phrase saying there is none
177
+ */
178
+ function toReportedComment(comment) {
179
+ if (comment === null || comment === "") {
180
+ return NO_COMMENT;
181
+ }
182
+ const oneLine = comment.replace(/\s+/g, " ").trim();
183
+ const shortened = oneLine.length > MAX_COMMENT_LENGTH ? `${oneLine.slice(0, MAX_COMMENT_LENGTH)}…` : oneLine;
184
+ return `"${shortened}"`;
185
+ }
186
+ /**
187
+ * Render one role's attributes in the compact form the report prints.
188
+ *
189
+ * @param attributes - A parsed role's attributes, or {@link BASELINE_ATTRIBUTES}
190
+ * @returns A single line of `key=value` pairs
191
+ */
192
+ function describeAttributes(attributes) {
193
+ return (`login=${toPsqlBoolean(attributes.canLogin)} super=${toPsqlBoolean(attributes.isSuperuser)} ` +
194
+ `createdb=${toPsqlBoolean(attributes.canCreateDb)} ` +
195
+ `createrole=${toPsqlBoolean(attributes.canCreateRole)} ` +
196
+ `inherit=${toPsqlBoolean(attributes.inherits)} connlimit=${attributes.connectionLimit} ` +
197
+ `bypassrls=${toPsqlBoolean(attributes.bypassesRls)} ` +
198
+ `replication=${toPsqlBoolean(attributes.canReplicate)} ` +
199
+ `validuntil=${toReportedValidUntil(attributes.validUntil)} ` +
200
+ `comment=${toReportedComment(attributes.comment)} memberof=${toPsqlArray(attributes.memberOf)}`);
201
+ }
202
+ /**
203
+ * Name a row in a warning, using its role name when that much was readable.
204
+ *
205
+ * @param index - Zero-based position in the result
206
+ * @param name - Role name, when it could be read
207
+ * @returns A phrase identifying the row to an operator
208
+ */
209
+ function describeRow(index, name) {
210
+ return name === undefined ? `${SUBJECT} row ${index + 1}` : `role "${name}"`;
211
+ }
212
+ /**
213
+ * Parse one row of {@link ROLE_ATTRIBUTES_QUERY}.
214
+ *
215
+ * @param row - One object from the query's JSON output
216
+ * @param index - Zero-based position in the result, for the warning
217
+ * @returns The parsed row, or a warning naming the row and its bad columns
218
+ */
219
+ function parseRoleRow(row, index) {
220
+ const name = (0, migrate_psql_js_1.readString)(row, ROLE_COLUMNS.NAME);
221
+ const canLogin = (0, migrate_psql_js_1.readBoolean)(row, ROLE_COLUMNS.CAN_LOGIN);
222
+ const isSuperuser = (0, migrate_psql_js_1.readBoolean)(row, ROLE_COLUMNS.IS_SUPERUSER);
223
+ const canCreateDb = (0, migrate_psql_js_1.readBoolean)(row, ROLE_COLUMNS.CAN_CREATE_DB);
224
+ const canCreateRole = (0, migrate_psql_js_1.readBoolean)(row, ROLE_COLUMNS.CAN_CREATE_ROLE);
225
+ const inherits = (0, migrate_psql_js_1.readBoolean)(row, ROLE_COLUMNS.INHERITS);
226
+ const connectionLimit = (0, migrate_psql_js_1.readNumber)(row, ROLE_COLUMNS.CONNECTION_LIMIT);
227
+ const bypassesRls = (0, migrate_psql_js_1.readBoolean)(row, ROLE_COLUMNS.BYPASSES_RLS);
228
+ const canReplicate = (0, migrate_psql_js_1.readBoolean)(row, ROLE_COLUMNS.CAN_REPLICATE);
229
+ const validUntil = (0, migrate_psql_js_1.readNullableString)(row, ROLE_COLUMNS.VALID_UNTIL);
230
+ const comment = (0, migrate_psql_js_1.readNullableString)(row, ROLE_COLUMNS.COMMENT);
231
+ const memberOf = (0, migrate_psql_js_1.readStringArray)(row, ROLE_COLUMNS.MEMBER_OF);
232
+ const unreadable = [
233
+ [ROLE_COLUMNS.NAME, name],
234
+ [ROLE_COLUMNS.CAN_LOGIN, canLogin],
235
+ [ROLE_COLUMNS.IS_SUPERUSER, isSuperuser],
236
+ [ROLE_COLUMNS.CAN_CREATE_DB, canCreateDb],
237
+ [ROLE_COLUMNS.CAN_CREATE_ROLE, canCreateRole],
238
+ [ROLE_COLUMNS.INHERITS, inherits],
239
+ [ROLE_COLUMNS.CONNECTION_LIMIT, connectionLimit],
240
+ [ROLE_COLUMNS.BYPASSES_RLS, bypassesRls],
241
+ [ROLE_COLUMNS.CAN_REPLICATE, canReplicate],
242
+ [ROLE_COLUMNS.VALID_UNTIL, validUntil],
243
+ [ROLE_COLUMNS.COMMENT, comment],
244
+ [ROLE_COLUMNS.MEMBER_OF, memberOf],
245
+ ];
246
+ if (name === undefined ||
247
+ canLogin === undefined ||
248
+ isSuperuser === undefined ||
249
+ canCreateDb === undefined ||
250
+ canCreateRole === undefined ||
251
+ inherits === undefined ||
252
+ connectionLimit === undefined ||
253
+ bypassesRls === undefined ||
254
+ canReplicate === undefined ||
255
+ validUntil === undefined ||
256
+ comment === undefined ||
257
+ memberOf === undefined) {
258
+ const columns = unreadable
259
+ .filter(([, value]) => value === undefined)
260
+ .map(([column]) => column)
261
+ .join(", ");
262
+ return {
263
+ warning: `${describeRow(index, name)}: could not read ${columns} from the ${SUBJECT} query ` +
264
+ "output, so this role was NOT checked against the adoption baseline.",
265
+ };
266
+ }
267
+ return {
268
+ role: {
269
+ name,
270
+ canLogin,
271
+ isSuperuser,
272
+ canCreateDb,
273
+ canCreateRole,
274
+ inherits,
275
+ connectionLimit,
276
+ bypassesRls,
277
+ canReplicate,
278
+ validUntil,
279
+ comment,
280
+ memberOf,
281
+ },
282
+ };
283
+ }
284
+ /**
285
+ * Parse every row returned by {@link ROLE_ATTRIBUTES_JSON_QUERY}.
286
+ *
287
+ * @param stdout - Raw `psql -tAc` output of the JSON-wrapped query
288
+ * @returns The roles that parsed, and a warning for every row that did not
289
+ */
290
+ function parseRoleRows(stdout) {
291
+ const parsed = (0, migrate_psql_js_1.parseJsonRows)(stdout, SUBJECT);
292
+ const roles = [];
293
+ const warnings = [...parsed.warnings];
294
+ parsed.rows.forEach((row, index) => {
295
+ const outcome = parseRoleRow(row, index);
296
+ if ("role" in outcome) {
297
+ roles.push(outcome.role);
298
+ return;
299
+ }
300
+ warnings.push(outcome.warning);
301
+ });
302
+ return { roles, warnings };
303
+ }
304
+ /**
305
+ * Whether `DatabaseRole` adoption would leave this role's attributes alone.
306
+ *
307
+ * Every attribute `DatabaseRole.spec` can express is compared, because adoption
308
+ * resets each one the manifest omits — checking a subset reports roles as safe
309
+ * that adoption is about to change. See {@link BASELINE_ATTRIBUTES}.
310
+ *
311
+ * @param role - Parsed role row
312
+ * @returns True when every attribute matches the baseline
313
+ */
314
+ function roleMatchesBaseline(role) {
315
+ return (role.canLogin === BASELINE_ATTRIBUTES.canLogin &&
316
+ role.isSuperuser === BASELINE_ATTRIBUTES.isSuperuser &&
317
+ role.canCreateDb === BASELINE_ATTRIBUTES.canCreateDb &&
318
+ role.canCreateRole === BASELINE_ATTRIBUTES.canCreateRole &&
319
+ role.inherits === BASELINE_ATTRIBUTES.inherits &&
320
+ role.connectionLimit === BASELINE_ATTRIBUTES.connectionLimit &&
321
+ role.bypassesRls === BASELINE_ATTRIBUTES.bypassesRls &&
322
+ role.canReplicate === BASELINE_ATTRIBUTES.canReplicate &&
323
+ hasNoPasswordExpiry(role.validUntil) &&
324
+ hasNoComment(role.comment) &&
325
+ role.memberOf.length === 0);
326
+ }
327
+ /**
328
+ * Describe how a role's attributes deviate from the nimbus baseline, for report output.
329
+ *
330
+ * @param role - Parsed role row that failed {@link roleMatchesBaseline}
331
+ * @returns A one-line, human-readable description of the deviation
332
+ */
333
+ function describeRoleDeviation(role) {
334
+ return (`role "${role.name}": ${describeAttributes(role)} ` +
335
+ `(baseline: ${describeAttributes(BASELINE_ATTRIBUTES)})`);
336
+ }
337
+ //# sourceMappingURL=migrate-cnpg-roles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-cnpg-roles.js","sourceRoot":"","sources":["../../../src/cli/migrate-cnpg-roles.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAqUH,sCAeC;AAYD,kDAcC;AAQD,sDAKC;AAzXD,uDAQ2B;AAE3B;;;;GAIG;AACU,QAAA,kBAAkB,GAAsB;IACnD,UAAU;IACV,mBAAmB;IACnB,uBAAuB;CACxB,CAAC;AAEF;;;GAGG;AACU,QAAA,qBAAqB,GAAG;;;;;;;;4CAQO,CAAC;AAE7C,sFAAsF;AACzE,QAAA,0BAA0B,GAAG,IAAA,iCAAe,EAAC,6BAAqB,CAAC,CAAC;AAEjF,gDAAgD;AAChD,MAAM,OAAO,GAAG,UAAU,CAAC;AAE3B,2FAA2F;AAC3F,MAAM,YAAY,GAAG;IACnB,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,aAAa;IACxB,YAAY,EAAE,UAAU;IACxB,aAAa,EAAE,aAAa;IAC5B,eAAe,EAAE,eAAe;IAChC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