@reyemtech/nimbus 2.12.6 → 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 (262) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/cli/migrate-cnpg-ownership.d.ts +43 -0
  3. package/dist/cjs/cli/migrate-cnpg-ownership.d.ts.map +1 -0
  4. package/dist/cjs/cli/migrate-cnpg-ownership.js +67 -0
  5. package/dist/cjs/cli/migrate-cnpg-ownership.js.map +1 -0
  6. package/dist/cjs/cli/migrate-cnpg-roles.d.ts +92 -0
  7. package/dist/cjs/cli/migrate-cnpg-roles.d.ts.map +1 -0
  8. package/dist/cjs/cli/migrate-cnpg-roles.js +337 -0
  9. package/dist/cjs/cli/migrate-cnpg-roles.js.map +1 -0
  10. package/dist/cjs/cli/migrate-cnpg.d.ts +38 -0
  11. package/dist/cjs/cli/migrate-cnpg.d.ts.map +1 -0
  12. package/dist/cjs/cli/migrate-cnpg.js +258 -0
  13. package/dist/cjs/cli/migrate-cnpg.js.map +1 -0
  14. package/dist/cjs/cli/migrate-exec.d.ts +45 -0
  15. package/dist/cjs/cli/migrate-exec.d.ts.map +1 -0
  16. package/dist/cjs/cli/migrate-exec.js +104 -0
  17. package/dist/cjs/cli/migrate-exec.js.map +1 -0
  18. package/dist/cjs/cli/migrate-psql.d.ts +125 -0
  19. package/dist/cjs/cli/migrate-psql.d.ts.map +1 -0
  20. package/dist/cjs/cli/migrate-psql.js +213 -0
  21. package/dist/cjs/cli/migrate-psql.js.map +1 -0
  22. package/dist/cjs/cli/migrate-report.d.ts +27 -0
  23. package/dist/cjs/cli/migrate-report.d.ts.map +1 -0
  24. package/dist/cjs/cli/migrate-report.js +29 -0
  25. package/dist/cjs/cli/migrate-report.js.map +1 -0
  26. package/dist/cjs/cli/migrate-superuser.d.ts +22 -0
  27. package/dist/cjs/cli/migrate-superuser.d.ts.map +1 -0
  28. package/dist/cjs/cli/migrate-superuser.js +73 -0
  29. package/dist/cjs/cli/migrate-superuser.js.map +1 -0
  30. package/dist/cjs/cli/migrate.d.ts +37 -0
  31. package/dist/cjs/cli/migrate.d.ts.map +1 -0
  32. package/dist/cjs/cli/migrate.js +67 -0
  33. package/dist/cjs/cli/migrate.js.map +1 -0
  34. package/dist/cjs/cli.d.ts +1 -0
  35. package/dist/cjs/cli.d.ts.map +1 -1
  36. package/dist/cjs/cli.js +6 -0
  37. package/dist/cjs/cli.js.map +1 -1
  38. package/dist/cjs/index.d.ts +1 -1
  39. package/dist/cjs/index.d.ts.map +1 -1
  40. package/dist/cjs/index.js.map +1 -1
  41. package/dist/cjs/operator/cnpg-common.d.ts +56 -0
  42. package/dist/cjs/operator/cnpg-common.d.ts.map +1 -0
  43. package/dist/cjs/operator/cnpg-common.js +82 -0
  44. package/dist/cjs/operator/cnpg-common.js.map +1 -0
  45. package/dist/cjs/operator/cnpg-database.d.ts +66 -0
  46. package/dist/cjs/operator/cnpg-database.d.ts.map +1 -0
  47. package/dist/cjs/operator/cnpg-database.js +296 -0
  48. package/dist/cjs/operator/cnpg-database.js.map +1 -0
  49. package/dist/cjs/operator/cnpg-roles.d.ts +173 -0
  50. package/dist/cjs/operator/cnpg-roles.d.ts.map +1 -0
  51. package/dist/cjs/operator/cnpg-roles.js +225 -0
  52. package/dist/cjs/operator/cnpg-roles.js.map +1 -0
  53. package/dist/cjs/operator/cnpg.d.ts.map +1 -1
  54. package/dist/cjs/operator/cnpg.js +50 -162
  55. package/dist/cjs/operator/cnpg.js.map +1 -1
  56. package/dist/cjs/operator/connection-uri.d.ts +44 -0
  57. package/dist/cjs/operator/connection-uri.d.ts.map +1 -0
  58. package/dist/cjs/operator/connection-uri.js +49 -0
  59. package/dist/cjs/operator/connection-uri.js.map +1 -0
  60. package/dist/cjs/operator/credentials.d.ts +76 -0
  61. package/dist/cjs/operator/credentials.d.ts.map +1 -0
  62. package/dist/cjs/operator/credentials.js +106 -0
  63. package/dist/cjs/operator/credentials.js.map +1 -0
  64. package/dist/cjs/operator/database-options.d.ts +121 -0
  65. package/dist/cjs/operator/database-options.d.ts.map +1 -0
  66. package/dist/cjs/operator/database-options.js +131 -0
  67. package/dist/cjs/operator/database-options.js.map +1 -0
  68. package/dist/cjs/operator/grants/postgres-job.d.ts +109 -0
  69. package/dist/cjs/operator/grants/postgres-job.d.ts.map +1 -0
  70. package/dist/cjs/operator/grants/postgres-job.js +232 -0
  71. package/dist/cjs/operator/grants/postgres-job.js.map +1 -0
  72. package/dist/cjs/operator/grants/postgres-sql.d.ts +130 -0
  73. package/dist/cjs/operator/grants/postgres-sql.d.ts.map +1 -0
  74. package/dist/cjs/operator/grants/postgres-sql.js +305 -0
  75. package/dist/cjs/operator/grants/postgres-sql.js.map +1 -0
  76. package/dist/cjs/operator/grants/privileges.d.ts +24 -0
  77. package/dist/cjs/operator/grants/privileges.d.ts.map +1 -0
  78. package/dist/cjs/operator/grants/privileges.js +35 -0
  79. package/dist/cjs/operator/grants/privileges.js.map +1 -0
  80. package/dist/cjs/operator/grants/role-config.d.ts +80 -0
  81. package/dist/cjs/operator/grants/role-config.d.ts.map +1 -0
  82. package/dist/cjs/operator/grants/role-config.js +134 -0
  83. package/dist/cjs/operator/grants/role-config.js.map +1 -0
  84. package/dist/cjs/operator/index.d.ts +1 -1
  85. package/dist/cjs/operator/index.d.ts.map +1 -1
  86. package/dist/cjs/operator/index.js.map +1 -1
  87. package/dist/cjs/operator/interfaces.d.ts +223 -1
  88. package/dist/cjs/operator/interfaces.d.ts.map +1 -1
  89. package/dist/cjs/operator/interfaces.js.map +1 -1
  90. package/dist/cjs/operator/mariadb-common.d.ts +99 -0
  91. package/dist/cjs/operator/mariadb-common.d.ts.map +1 -0
  92. package/dist/cjs/operator/mariadb-common.js +141 -0
  93. package/dist/cjs/operator/mariadb-common.js.map +1 -0
  94. package/dist/cjs/operator/mariadb-database.d.ts +65 -0
  95. package/dist/cjs/operator/mariadb-database.d.ts.map +1 -0
  96. package/dist/cjs/operator/mariadb-database.js +285 -0
  97. package/dist/cjs/operator/mariadb-database.js.map +1 -0
  98. package/dist/cjs/operator/mariadb-roles.d.ts +264 -0
  99. package/dist/cjs/operator/mariadb-roles.d.ts.map +1 -0
  100. package/dist/cjs/operator/mariadb-roles.js +366 -0
  101. package/dist/cjs/operator/mariadb-roles.js.map +1 -0
  102. package/dist/cjs/operator/mariadb.d.ts.map +1 -1
  103. package/dist/cjs/operator/mariadb.js +35 -147
  104. package/dist/cjs/operator/mariadb.js.map +1 -1
  105. package/dist/cjs/operator/neo4j-common.d.ts +62 -0
  106. package/dist/cjs/operator/neo4j-common.d.ts.map +1 -0
  107. package/dist/cjs/operator/neo4j-common.js +89 -0
  108. package/dist/cjs/operator/neo4j-common.js.map +1 -0
  109. package/dist/cjs/operator/neo4j-database.d.ts +88 -0
  110. package/dist/cjs/operator/neo4j-database.d.ts.map +1 -0
  111. package/dist/cjs/operator/neo4j-database.js +274 -0
  112. package/dist/cjs/operator/neo4j-database.js.map +1 -0
  113. package/dist/cjs/operator/neo4j-roles.d.ts +203 -0
  114. package/dist/cjs/operator/neo4j-roles.d.ts.map +1 -0
  115. package/dist/cjs/operator/neo4j-roles.js +298 -0
  116. package/dist/cjs/operator/neo4j-roles.js.map +1 -0
  117. package/dist/cjs/operator/neo4j.d.ts.map +1 -1
  118. package/dist/cjs/operator/neo4j.js +32 -132
  119. package/dist/cjs/operator/neo4j.js.map +1 -1
  120. package/dist/cjs/operator/resource-identity.d.ts +170 -0
  121. package/dist/cjs/operator/resource-identity.d.ts.map +1 -0
  122. package/dist/cjs/operator/resource-identity.js +231 -0
  123. package/dist/cjs/operator/resource-identity.js.map +1 -0
  124. package/dist/cjs/operator/role-registry.d.ts +85 -0
  125. package/dist/cjs/operator/role-registry.d.ts.map +1 -0
  126. package/dist/cjs/operator/role-registry.js +72 -0
  127. package/dist/cjs/operator/role-registry.js.map +1 -0
  128. package/dist/cjs/types/errors.d.ts +3 -0
  129. package/dist/cjs/types/errors.d.ts.map +1 -1
  130. package/dist/cjs/types/errors.js +3 -0
  131. package/dist/cjs/types/errors.js.map +1 -1
  132. package/dist/esm/cli/migrate-cnpg-ownership.d.ts +43 -0
  133. package/dist/esm/cli/migrate-cnpg-ownership.d.ts.map +1 -0
  134. package/dist/esm/cli/migrate-cnpg-ownership.js +67 -0
  135. package/dist/esm/cli/migrate-cnpg-ownership.js.map +1 -0
  136. package/dist/esm/cli/migrate-cnpg-roles.d.ts +92 -0
  137. package/dist/esm/cli/migrate-cnpg-roles.d.ts.map +1 -0
  138. package/dist/esm/cli/migrate-cnpg-roles.js +337 -0
  139. package/dist/esm/cli/migrate-cnpg-roles.js.map +1 -0
  140. package/dist/esm/cli/migrate-cnpg.d.ts +38 -0
  141. package/dist/esm/cli/migrate-cnpg.d.ts.map +1 -0
  142. package/dist/esm/cli/migrate-cnpg.js +258 -0
  143. package/dist/esm/cli/migrate-cnpg.js.map +1 -0
  144. package/dist/esm/cli/migrate-exec.d.ts +45 -0
  145. package/dist/esm/cli/migrate-exec.d.ts.map +1 -0
  146. package/dist/esm/cli/migrate-exec.js +104 -0
  147. package/dist/esm/cli/migrate-exec.js.map +1 -0
  148. package/dist/esm/cli/migrate-psql.d.ts +125 -0
  149. package/dist/esm/cli/migrate-psql.d.ts.map +1 -0
  150. package/dist/esm/cli/migrate-psql.js +213 -0
  151. package/dist/esm/cli/migrate-psql.js.map +1 -0
  152. package/dist/esm/cli/migrate-report.d.ts +27 -0
  153. package/dist/esm/cli/migrate-report.d.ts.map +1 -0
  154. package/dist/esm/cli/migrate-report.js +29 -0
  155. package/dist/esm/cli/migrate-report.js.map +1 -0
  156. package/dist/esm/cli/migrate-superuser.d.ts +22 -0
  157. package/dist/esm/cli/migrate-superuser.d.ts.map +1 -0
  158. package/dist/esm/cli/migrate-superuser.js +73 -0
  159. package/dist/esm/cli/migrate-superuser.js.map +1 -0
  160. package/dist/esm/cli/migrate.d.ts +37 -0
  161. package/dist/esm/cli/migrate.d.ts.map +1 -0
  162. package/dist/esm/cli/migrate.js +67 -0
  163. package/dist/esm/cli/migrate.js.map +1 -0
  164. package/dist/esm/cli.d.ts +1 -0
  165. package/dist/esm/cli.d.ts.map +1 -1
  166. package/dist/esm/cli.js +6 -0
  167. package/dist/esm/cli.js.map +1 -1
  168. package/dist/esm/index.d.ts +1 -1
  169. package/dist/esm/index.d.ts.map +1 -1
  170. package/dist/esm/index.js.map +1 -1
  171. package/dist/esm/operator/cnpg-common.d.ts +56 -0
  172. package/dist/esm/operator/cnpg-common.d.ts.map +1 -0
  173. package/dist/esm/operator/cnpg-common.js +82 -0
  174. package/dist/esm/operator/cnpg-common.js.map +1 -0
  175. package/dist/esm/operator/cnpg-database.d.ts +66 -0
  176. package/dist/esm/operator/cnpg-database.d.ts.map +1 -0
  177. package/dist/esm/operator/cnpg-database.js +296 -0
  178. package/dist/esm/operator/cnpg-database.js.map +1 -0
  179. package/dist/esm/operator/cnpg-roles.d.ts +173 -0
  180. package/dist/esm/operator/cnpg-roles.d.ts.map +1 -0
  181. package/dist/esm/operator/cnpg-roles.js +225 -0
  182. package/dist/esm/operator/cnpg-roles.js.map +1 -0
  183. package/dist/esm/operator/cnpg.d.ts.map +1 -1
  184. package/dist/esm/operator/cnpg.js +50 -162
  185. package/dist/esm/operator/cnpg.js.map +1 -1
  186. package/dist/esm/operator/connection-uri.d.ts +44 -0
  187. package/dist/esm/operator/connection-uri.d.ts.map +1 -0
  188. package/dist/esm/operator/connection-uri.js +49 -0
  189. package/dist/esm/operator/connection-uri.js.map +1 -0
  190. package/dist/esm/operator/credentials.d.ts +76 -0
  191. package/dist/esm/operator/credentials.d.ts.map +1 -0
  192. package/dist/esm/operator/credentials.js +106 -0
  193. package/dist/esm/operator/credentials.js.map +1 -0
  194. package/dist/esm/operator/database-options.d.ts +121 -0
  195. package/dist/esm/operator/database-options.d.ts.map +1 -0
  196. package/dist/esm/operator/database-options.js +131 -0
  197. package/dist/esm/operator/database-options.js.map +1 -0
  198. package/dist/esm/operator/grants/postgres-job.d.ts +109 -0
  199. package/dist/esm/operator/grants/postgres-job.d.ts.map +1 -0
  200. package/dist/esm/operator/grants/postgres-job.js +232 -0
  201. package/dist/esm/operator/grants/postgres-job.js.map +1 -0
  202. package/dist/esm/operator/grants/postgres-sql.d.ts +130 -0
  203. package/dist/esm/operator/grants/postgres-sql.d.ts.map +1 -0
  204. package/dist/esm/operator/grants/postgres-sql.js +305 -0
  205. package/dist/esm/operator/grants/postgres-sql.js.map +1 -0
  206. package/dist/esm/operator/grants/privileges.d.ts +24 -0
  207. package/dist/esm/operator/grants/privileges.d.ts.map +1 -0
  208. package/dist/esm/operator/grants/privileges.js +35 -0
  209. package/dist/esm/operator/grants/privileges.js.map +1 -0
  210. package/dist/esm/operator/grants/role-config.d.ts +80 -0
  211. package/dist/esm/operator/grants/role-config.d.ts.map +1 -0
  212. package/dist/esm/operator/grants/role-config.js +134 -0
  213. package/dist/esm/operator/grants/role-config.js.map +1 -0
  214. package/dist/esm/operator/index.d.ts +1 -1
  215. package/dist/esm/operator/index.d.ts.map +1 -1
  216. package/dist/esm/operator/index.js.map +1 -1
  217. package/dist/esm/operator/interfaces.d.ts +223 -1
  218. package/dist/esm/operator/interfaces.d.ts.map +1 -1
  219. package/dist/esm/operator/interfaces.js.map +1 -1
  220. package/dist/esm/operator/mariadb-common.d.ts +99 -0
  221. package/dist/esm/operator/mariadb-common.d.ts.map +1 -0
  222. package/dist/esm/operator/mariadb-common.js +141 -0
  223. package/dist/esm/operator/mariadb-common.js.map +1 -0
  224. package/dist/esm/operator/mariadb-database.d.ts +65 -0
  225. package/dist/esm/operator/mariadb-database.d.ts.map +1 -0
  226. package/dist/esm/operator/mariadb-database.js +285 -0
  227. package/dist/esm/operator/mariadb-database.js.map +1 -0
  228. package/dist/esm/operator/mariadb-roles.d.ts +264 -0
  229. package/dist/esm/operator/mariadb-roles.d.ts.map +1 -0
  230. package/dist/esm/operator/mariadb-roles.js +366 -0
  231. package/dist/esm/operator/mariadb-roles.js.map +1 -0
  232. package/dist/esm/operator/mariadb.d.ts.map +1 -1
  233. package/dist/esm/operator/mariadb.js +35 -147
  234. package/dist/esm/operator/mariadb.js.map +1 -1
  235. package/dist/esm/operator/neo4j-common.d.ts +62 -0
  236. package/dist/esm/operator/neo4j-common.d.ts.map +1 -0
  237. package/dist/esm/operator/neo4j-common.js +89 -0
  238. package/dist/esm/operator/neo4j-common.js.map +1 -0
  239. package/dist/esm/operator/neo4j-database.d.ts +88 -0
  240. package/dist/esm/operator/neo4j-database.d.ts.map +1 -0
  241. package/dist/esm/operator/neo4j-database.js +274 -0
  242. package/dist/esm/operator/neo4j-database.js.map +1 -0
  243. package/dist/esm/operator/neo4j-roles.d.ts +203 -0
  244. package/dist/esm/operator/neo4j-roles.d.ts.map +1 -0
  245. package/dist/esm/operator/neo4j-roles.js +298 -0
  246. package/dist/esm/operator/neo4j-roles.js.map +1 -0
  247. package/dist/esm/operator/neo4j.d.ts.map +1 -1
  248. package/dist/esm/operator/neo4j.js +32 -132
  249. package/dist/esm/operator/neo4j.js.map +1 -1
  250. package/dist/esm/operator/resource-identity.d.ts +170 -0
  251. package/dist/esm/operator/resource-identity.d.ts.map +1 -0
  252. package/dist/esm/operator/resource-identity.js +231 -0
  253. package/dist/esm/operator/resource-identity.js.map +1 -0
  254. package/dist/esm/operator/role-registry.d.ts +85 -0
  255. package/dist/esm/operator/role-registry.d.ts.map +1 -0
  256. package/dist/esm/operator/role-registry.js +72 -0
  257. package/dist/esm/operator/role-registry.js.map +1 -0
  258. package/dist/esm/types/errors.d.ts +3 -0
  259. package/dist/esm/types/errors.d.ts.map +1 -1
  260. package/dist/esm/types/errors.js +3 -0
  261. package/dist/esm/types/errors.js.map +1 -1
  262. package/package.json +1 -1
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Deriving Pulumi logical names and Kubernetes object names from raw database
3
+ * identifiers.
4
+ *
5
+ * A role name, or a table name, is a caller-controlled string in the engine's
6
+ * own identifier space, which is far wider than the DNS-1123 space Kubernetes
7
+ * object names live in. Narrowing one into the other is lossy — `Read_Only` and
8
+ * `read_only` are two distinct, simultaneously valid PostgreSQL roles that both
9
+ * narrow to `read-only` — and a lossy name is not merely untidy here: Pulumi
10
+ * identifies a resource by its logical name, so two resources deriving the same
11
+ * one abort the whole preview with a duplicate-URN error. Nothing is
12
+ * provisioned, including the resources that had nothing to do with the clash.
13
+ *
14
+ * {@link toIdentitySegment} closes that by appending a short hash of the raw
15
+ * value to **every** segment it derives, not only to the ones sanitizing
16
+ * changed. Hashing only the lossy ones leaves two namespaces sharing one output
17
+ * space: `Read_Only` encodes to `read-only-7b1060cf`, and the perfectly valid
18
+ * role name `read-only-7b1060cf` — which needs no sanitizing — would pass
19
+ * through unchanged onto that same string. The two roles' Secrets then collide
20
+ * on one Pulumi logical name and abort the preview, which is the exact failure
21
+ * the hash exists to prevent. Hashing unconditionally makes the mapping
22
+ * injective by construction: the hash covers the raw value, so distinct raw
23
+ * inputs cannot meet. The cost is an opaque suffix on every name, which is a
24
+ * fair price for a rule with no exceptions to reason about.
25
+ *
26
+ * **These helpers are for `addRole()`-path names only.** The names
27
+ * `createDatabase()` emits for a database owner are already live in released
28
+ * stacks and are pinned byte-for-byte by each backend's `ownerRoleNaming`;
29
+ * re-deriving one through here would rename it, and Pulumi reads a rename as
30
+ * delete-and-recreate — which for a credential Secret regenerates the password
31
+ * and breaks every application already reading it.
32
+ *
33
+ * @module operator/resource-identity
34
+ */
35
+ /**
36
+ * Longest DNS-1123 *label*: the cap on a label value and on a Job's name.
37
+ *
38
+ * Kubernetes enforces it on every label value, and `batch` validation enforces
39
+ * it on a Job's `metadata.name` — a Job stamps its own name onto the `job-name`
40
+ * label of every Pod it creates, so a longer name could not be labelled.
41
+ */
42
+ export declare const DNS_1123_LABEL_MAX_LENGTH = 63;
43
+ /**
44
+ * Longest DNS-1123 *subdomain*: the cap on `metadata.name` for a Secret,
45
+ * ConfigMap, or custom resource.
46
+ *
47
+ * Deliberately not collapsed into {@link DNS_1123_LABEL_MAX_LENGTH}. Bounding
48
+ * every name by the strictest limit would be one rule instead of two, but a
49
+ * perfectly ordinary `Grant` CR name already runs past 63 characters, and
50
+ * truncating it would replace a name an operator can read with an opaque hash
51
+ * for no gain — the API accepts it. Each name is bounded by the limit that
52
+ * actually applies to the object it names.
53
+ */
54
+ export declare const DNS_1123_SUBDOMAIN_MAX_LENGTH = 253;
55
+ /**
56
+ * Normalize a string into a DNS-1123 subdomain usable as `metadata.name`.
57
+ *
58
+ * Lossy by construction: every character outside `[a-z0-9-]` becomes `-`, so
59
+ * distinct inputs can produce one output. Use {@link toIdentitySegment} instead
60
+ * wherever the result identifies a resource.
61
+ *
62
+ * @param value - Raw name
63
+ * @returns A lowercase, `-`-separated name safe for `metadata.name`, possibly empty
64
+ */
65
+ export declare function toDnsSegment(value: string): string;
66
+ /**
67
+ * Derive a resource-name segment that survives sanitization without collisions.
68
+ *
69
+ * The sanitized value is kept as a readable head and the raw value's hash is
70
+ * always appended. Appending it only where sanitizing was lossy would leave the
71
+ * encoded and the pass-through forms sharing one output space — see this
72
+ * module's note — so the suffix is unconditional and the mapping from raw value
73
+ * to segment is injective by construction.
74
+ *
75
+ * The result is a pure function of `value`: a role called `reader` derives
76
+ * `reader-3d094196` on every call, in every process, forever. That matters more
77
+ * than readability here, because Pulumi reads a changed logical name as
78
+ * delete-and-recreate.
79
+ *
80
+ * @param value - Raw identifier as it exists in the database engine
81
+ * @returns A DNS-1123-safe segment, distinct for every distinct raw value
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * toIdentitySegment("reader"); // "reader-3d094196"
86
+ * toIdentitySegment("Read_Only"); // "read-only-7b1060cf"
87
+ * toIdentitySegment("read_only"); // "read-only-9c586a9b" — a different role
88
+ * toIdentitySegment("read-only-7b1060cf"); // "read-only-7b1060cf-707a9bc6"
89
+ * toIdentitySegment("@@"); // "3330e5ba" — nothing survives sanitizing
90
+ * ```
91
+ */
92
+ export declare function toIdentitySegment(value: string): string;
93
+ /**
94
+ * Derive a resource-name segment for an identity made of more than one part.
95
+ *
96
+ * Not every engine identifies an account by its name alone: a MariaDB account is
97
+ * the `username`@`host` pair, and `reader`@`%` and `reader`@`10.0.0.1` are two
98
+ * accounts that exist at once with their own passwords and their own grants.
99
+ * Deriving names from the username alone made the second of them register under
100
+ * the first's Pulumi logical names, which aborts the preview with a duplicate
101
+ * URN — so the second account could never be created at all.
102
+ *
103
+ * The head stays readable by sanitizing the **first** part only, which is the
104
+ * one a human recognises the resource by; every part is folded into the hash, so
105
+ * the mapping stays injective the way {@link toIdentitySegment}'s is. The hash
106
+ * covers `JSON.stringify(parts)` rather than the parts joined by a separator,
107
+ * because a part may itself contain any separator: `["a@b", "c"]` and
108
+ * `["a", "b@c"]` are different identities and must not serialize alike.
109
+ *
110
+ * @param parts - The identity's raw parts, most identifying first
111
+ * @returns A DNS-1123-safe segment, distinct for every distinct identity
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * toCompositeIdentitySegment(["reader", "%"]); // "reader-8b6a1a09"
116
+ * toCompositeIdentitySegment(["reader", "10.0.0.1"]); // "reader-…" — another account
117
+ * ```
118
+ */
119
+ export declare function toCompositeIdentitySegment(parts: readonly [string, ...string[]]): string;
120
+ /**
121
+ * Bound an already-derived name to a length limit without losing its identity.
122
+ *
123
+ * Cluster, database, role and table names are all caller-controlled and
124
+ * unbounded, so a name composed from them is unbounded too — and an over-long
125
+ * one is not a cosmetic problem. Kubernetes rejects a Job whose `metadata.name`
126
+ * exceeds {@link DNS_1123_LABEL_MAX_LENGTH} outright, which happens at apply
127
+ * time: preview passes, then the object the account depends on is refused and
128
+ * the account is never created.
129
+ *
130
+ * Truncation is lossy in exactly the way sanitizing is — two names agreeing on
131
+ * their first characters cut down to one string — so it is disambiguated the
132
+ * same way: keep a readable head, and append a hash of the **whole** name. Two
133
+ * distinct inputs therefore stay distinct, and a name that already fits is
134
+ * returned untouched so short names keep their readable form.
135
+ *
136
+ * @param name - Derived name, already sanitized into the target character set
137
+ * @param maxLength - The limit that applies to the object this names — see
138
+ * {@link DNS_1123_LABEL_MAX_LENGTH} and {@link DNS_1123_SUBDOMAIN_MAX_LENGTH}.
139
+ * Must leave room for the hash suffix (at least {@link SHORT_HASH_LENGTH} + 1
140
+ * characters). Default: {@link DNS_1123_LABEL_MAX_LENGTH}
141
+ * @returns The name unchanged when it fits, otherwise a truncated,
142
+ * hash-suffixed form of at most `maxLength` characters
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * toBoundedName("cnpg-grants-analytics"); // unchanged — it already fits
147
+ * toBoundedName("a".repeat(80)); // "aaa…a-3e2f1c7d" — 63 characters
148
+ * ```
149
+ */
150
+ export declare function toBoundedName(name: string, maxLength?: number): string;
151
+ /**
152
+ * Derive a Kubernetes label *value* from a raw identifier.
153
+ *
154
+ * Label values are far more restricted than the identifiers engines accept: the
155
+ * shared role-name validator deliberately permits `reporting@corp`, and `@` is
156
+ * not a legal label character, so the raw name would be rejected by the
157
+ * Kubernetes API when the object carrying the label is applied — after preview
158
+ * has passed and, for a Job, before it can ever run. Values are additionally
159
+ * capped at {@link DNS_1123_LABEL_MAX_LENGTH} characters, which is what
160
+ * {@link toBoundedName} enforces here.
161
+ *
162
+ * The raw identifier must still be used everywhere it has to be exact: the SQL
163
+ * or Cypher statement that creates the account, and the Secret payload
164
+ * applications authenticate with. This is for labels only.
165
+ *
166
+ * @param value - Raw identifier as it exists in the database engine
167
+ * @returns A valid label value, truncated with a hash suffix when over-long
168
+ */
169
+ export declare function toLabelValue(value: string): string;
170
+ //# sourceMappingURL=resource-identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-identity.d.ts","sourceRoot":"","sources":["../../../src/operator/resource-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAiBH;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAWjD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlD;AAYD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,GAAG,MAAM,CAIxF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAkC,GAAG,MAAM,CAQjG;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD"}
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+ /**
3
+ * Deriving Pulumi logical names and Kubernetes object names from raw database
4
+ * identifiers.
5
+ *
6
+ * A role name, or a table name, is a caller-controlled string in the engine's
7
+ * own identifier space, which is far wider than the DNS-1123 space Kubernetes
8
+ * object names live in. Narrowing one into the other is lossy — `Read_Only` and
9
+ * `read_only` are two distinct, simultaneously valid PostgreSQL roles that both
10
+ * narrow to `read-only` — and a lossy name is not merely untidy here: Pulumi
11
+ * identifies a resource by its logical name, so two resources deriving the same
12
+ * one abort the whole preview with a duplicate-URN error. Nothing is
13
+ * provisioned, including the resources that had nothing to do with the clash.
14
+ *
15
+ * {@link toIdentitySegment} closes that by appending a short hash of the raw
16
+ * value to **every** segment it derives, not only to the ones sanitizing
17
+ * changed. Hashing only the lossy ones leaves two namespaces sharing one output
18
+ * space: `Read_Only` encodes to `read-only-7b1060cf`, and the perfectly valid
19
+ * role name `read-only-7b1060cf` — which needs no sanitizing — would pass
20
+ * through unchanged onto that same string. The two roles' Secrets then collide
21
+ * on one Pulumi logical name and abort the preview, which is the exact failure
22
+ * the hash exists to prevent. Hashing unconditionally makes the mapping
23
+ * injective by construction: the hash covers the raw value, so distinct raw
24
+ * inputs cannot meet. The cost is an opaque suffix on every name, which is a
25
+ * fair price for a rule with no exceptions to reason about.
26
+ *
27
+ * **These helpers are for `addRole()`-path names only.** The names
28
+ * `createDatabase()` emits for a database owner are already live in released
29
+ * stacks and are pinned byte-for-byte by each backend's `ownerRoleNaming`;
30
+ * re-deriving one through here would rename it, and Pulumi reads a rename as
31
+ * delete-and-recreate — which for a credential Secret regenerates the password
32
+ * and breaks every application already reading it.
33
+ *
34
+ * @module operator/resource-identity
35
+ */
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.DNS_1123_SUBDOMAIN_MAX_LENGTH = exports.DNS_1123_LABEL_MAX_LENGTH = void 0;
38
+ exports.toDnsSegment = toDnsSegment;
39
+ exports.toIdentitySegment = toIdentitySegment;
40
+ exports.toCompositeIdentitySegment = toCompositeIdentitySegment;
41
+ exports.toBoundedName = toBoundedName;
42
+ exports.toLabelValue = toLabelValue;
43
+ const node_crypto_1 = require("node:crypto");
44
+ /** Digest the short hash is truncated from. */
45
+ const HASH_ALGORITHM = "sha256";
46
+ /**
47
+ * Hex characters of the digest kept as a disambiguating suffix.
48
+ *
49
+ * Eight hex characters is 32 bits. The suffix does not carry the security
50
+ * burden a full digest would — it separates a handful of role names within one
51
+ * database, not arbitrary attacker-chosen preimages — so the length is chosen
52
+ * for readability at a collision probability that is negligible at this scale.
53
+ */
54
+ const SHORT_HASH_LENGTH = 8;
55
+ /**
56
+ * Longest DNS-1123 *label*: the cap on a label value and on a Job's name.
57
+ *
58
+ * Kubernetes enforces it on every label value, and `batch` validation enforces
59
+ * it on a Job's `metadata.name` — a Job stamps its own name onto the `job-name`
60
+ * label of every Pod it creates, so a longer name could not be labelled.
61
+ */
62
+ exports.DNS_1123_LABEL_MAX_LENGTH = 63;
63
+ /**
64
+ * Longest DNS-1123 *subdomain*: the cap on `metadata.name` for a Secret,
65
+ * ConfigMap, or custom resource.
66
+ *
67
+ * Deliberately not collapsed into {@link DNS_1123_LABEL_MAX_LENGTH}. Bounding
68
+ * every name by the strictest limit would be one rule instead of two, but a
69
+ * perfectly ordinary `Grant` CR name already runs past 63 characters, and
70
+ * truncating it would replace a name an operator can read with an opaque hash
71
+ * for no gain — the API accepts it. Each name is bounded by the limit that
72
+ * actually applies to the object it names.
73
+ */
74
+ exports.DNS_1123_SUBDOMAIN_MAX_LENGTH = 253;
75
+ /** Characters a DNS-1123 subdomain may not contain, once lowercased. */
76
+ const DISALLOWED_CHARS = /[^a-z0-9-]/g;
77
+ /** Runs of separators left behind by {@link DISALLOWED_CHARS} replacement. */
78
+ const REPEATED_SEPARATORS = /-+/g;
79
+ /** Leading and trailing separators, which a DNS-1123 name may not have. */
80
+ const EDGE_SEPARATORS = /^-|-$/g;
81
+ /**
82
+ * Normalize a string into a DNS-1123 subdomain usable as `metadata.name`.
83
+ *
84
+ * Lossy by construction: every character outside `[a-z0-9-]` becomes `-`, so
85
+ * distinct inputs can produce one output. Use {@link toIdentitySegment} instead
86
+ * wherever the result identifies a resource.
87
+ *
88
+ * @param value - Raw name
89
+ * @returns A lowercase, `-`-separated name safe for `metadata.name`, possibly empty
90
+ */
91
+ function toDnsSegment(value) {
92
+ return value
93
+ .toLowerCase()
94
+ .replace(DISALLOWED_CHARS, "-")
95
+ .replace(REPEATED_SEPARATORS, "-")
96
+ .replace(EDGE_SEPARATORS, "");
97
+ }
98
+ /**
99
+ * A short, deterministic hash of a raw identifier.
100
+ *
101
+ * @param value - Raw identifier, hashed exactly as given
102
+ * @returns The first {@link SHORT_HASH_LENGTH} hex characters of its digest
103
+ */
104
+ function shortHash(value) {
105
+ return (0, node_crypto_1.createHash)(HASH_ALGORITHM).update(value, "utf8").digest("hex").slice(0, SHORT_HASH_LENGTH);
106
+ }
107
+ /**
108
+ * Derive a resource-name segment that survives sanitization without collisions.
109
+ *
110
+ * The sanitized value is kept as a readable head and the raw value's hash is
111
+ * always appended. Appending it only where sanitizing was lossy would leave the
112
+ * encoded and the pass-through forms sharing one output space — see this
113
+ * module's note — so the suffix is unconditional and the mapping from raw value
114
+ * to segment is injective by construction.
115
+ *
116
+ * The result is a pure function of `value`: a role called `reader` derives
117
+ * `reader-3d094196` on every call, in every process, forever. That matters more
118
+ * than readability here, because Pulumi reads a changed logical name as
119
+ * delete-and-recreate.
120
+ *
121
+ * @param value - Raw identifier as it exists in the database engine
122
+ * @returns A DNS-1123-safe segment, distinct for every distinct raw value
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * toIdentitySegment("reader"); // "reader-3d094196"
127
+ * toIdentitySegment("Read_Only"); // "read-only-7b1060cf"
128
+ * toIdentitySegment("read_only"); // "read-only-9c586a9b" — a different role
129
+ * toIdentitySegment("read-only-7b1060cf"); // "read-only-7b1060cf-707a9bc6"
130
+ * toIdentitySegment("@@"); // "3330e5ba" — nothing survives sanitizing
131
+ * ```
132
+ */
133
+ function toIdentitySegment(value) {
134
+ const sanitized = toDnsSegment(value);
135
+ // Sanitizing can erase the value entirely (`"@@"`, or the empty string), and
136
+ // a bare `-`-prefixed hash is not a valid DNS-1123 name — so the hash stands
137
+ // alone rather than being suffixed onto nothing.
138
+ return sanitized === "" ? shortHash(value) : `${sanitized}-${shortHash(value)}`;
139
+ }
140
+ /**
141
+ * Derive a resource-name segment for an identity made of more than one part.
142
+ *
143
+ * Not every engine identifies an account by its name alone: a MariaDB account is
144
+ * the `username`@`host` pair, and `reader`@`%` and `reader`@`10.0.0.1` are two
145
+ * accounts that exist at once with their own passwords and their own grants.
146
+ * Deriving names from the username alone made the second of them register under
147
+ * the first's Pulumi logical names, which aborts the preview with a duplicate
148
+ * URN — so the second account could never be created at all.
149
+ *
150
+ * The head stays readable by sanitizing the **first** part only, which is the
151
+ * one a human recognises the resource by; every part is folded into the hash, so
152
+ * the mapping stays injective the way {@link toIdentitySegment}'s is. The hash
153
+ * covers `JSON.stringify(parts)` rather than the parts joined by a separator,
154
+ * because a part may itself contain any separator: `["a@b", "c"]` and
155
+ * `["a", "b@c"]` are different identities and must not serialize alike.
156
+ *
157
+ * @param parts - The identity's raw parts, most identifying first
158
+ * @returns A DNS-1123-safe segment, distinct for every distinct identity
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * toCompositeIdentitySegment(["reader", "%"]); // "reader-8b6a1a09"
163
+ * toCompositeIdentitySegment(["reader", "10.0.0.1"]); // "reader-…" — another account
164
+ * ```
165
+ */
166
+ function toCompositeIdentitySegment(parts) {
167
+ const sanitized = toDnsSegment(parts[0]);
168
+ const hash = shortHash(JSON.stringify(parts));
169
+ return sanitized === "" ? hash : `${sanitized}-${hash}`;
170
+ }
171
+ /**
172
+ * Bound an already-derived name to a length limit without losing its identity.
173
+ *
174
+ * Cluster, database, role and table names are all caller-controlled and
175
+ * unbounded, so a name composed from them is unbounded too — and an over-long
176
+ * one is not a cosmetic problem. Kubernetes rejects a Job whose `metadata.name`
177
+ * exceeds {@link DNS_1123_LABEL_MAX_LENGTH} outright, which happens at apply
178
+ * time: preview passes, then the object the account depends on is refused and
179
+ * the account is never created.
180
+ *
181
+ * Truncation is lossy in exactly the way sanitizing is — two names agreeing on
182
+ * their first characters cut down to one string — so it is disambiguated the
183
+ * same way: keep a readable head, and append a hash of the **whole** name. Two
184
+ * distinct inputs therefore stay distinct, and a name that already fits is
185
+ * returned untouched so short names keep their readable form.
186
+ *
187
+ * @param name - Derived name, already sanitized into the target character set
188
+ * @param maxLength - The limit that applies to the object this names — see
189
+ * {@link DNS_1123_LABEL_MAX_LENGTH} and {@link DNS_1123_SUBDOMAIN_MAX_LENGTH}.
190
+ * Must leave room for the hash suffix (at least {@link SHORT_HASH_LENGTH} + 1
191
+ * characters). Default: {@link DNS_1123_LABEL_MAX_LENGTH}
192
+ * @returns The name unchanged when it fits, otherwise a truncated,
193
+ * hash-suffixed form of at most `maxLength` characters
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * toBoundedName("cnpg-grants-analytics"); // unchanged — it already fits
198
+ * toBoundedName("a".repeat(80)); // "aaa…a-3e2f1c7d" — 63 characters
199
+ * ```
200
+ */
201
+ function toBoundedName(name, maxLength = exports.DNS_1123_LABEL_MAX_LENGTH) {
202
+ if (name.length <= maxLength) {
203
+ return name;
204
+ }
205
+ const head = name.slice(0, maxLength - SHORT_HASH_LENGTH - 1).replace(EDGE_SEPARATORS, "");
206
+ // A budget small enough to erase the head still has to produce a valid
207
+ // DNS-1123 name, and a bare `-`-prefixed hash is not one.
208
+ return head === "" ? shortHash(name) : `${head}-${shortHash(name)}`;
209
+ }
210
+ /**
211
+ * Derive a Kubernetes label *value* from a raw identifier.
212
+ *
213
+ * Label values are far more restricted than the identifiers engines accept: the
214
+ * shared role-name validator deliberately permits `reporting@corp`, and `@` is
215
+ * not a legal label character, so the raw name would be rejected by the
216
+ * Kubernetes API when the object carrying the label is applied — after preview
217
+ * has passed and, for a Job, before it can ever run. Values are additionally
218
+ * capped at {@link DNS_1123_LABEL_MAX_LENGTH} characters, which is what
219
+ * {@link toBoundedName} enforces here.
220
+ *
221
+ * The raw identifier must still be used everywhere it has to be exact: the SQL
222
+ * or Cypher statement that creates the account, and the Secret payload
223
+ * applications authenticate with. This is for labels only.
224
+ *
225
+ * @param value - Raw identifier as it exists in the database engine
226
+ * @returns A valid label value, truncated with a hash suffix when over-long
227
+ */
228
+ function toLabelValue(value) {
229
+ return toBoundedName(toIdentitySegment(value));
230
+ }
231
+ //# sourceMappingURL=resource-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-identity.js","sourceRoot":"","sources":["../../../src/operator/resource-identity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;AA0DH,oCAMC;AAsCD,8CAMC;AA4BD,gEAIC;AAgCD,sCAQC;AAoBD,oCAEC;AAxMD,6CAAyC;AAEzC,+CAA+C;AAC/C,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM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C,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9C,OAAO,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAgB,aAAa,CAAC,IAAY,EAAE,YAAoB,iCAAyB;IACvF,IAAI,IAAI,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,iBAAiB,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAC3F,uEAAuE;IACvE,0DAA0D;IAC1D,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AACtE,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,YAAY,CAAC,KAAa;IACxC,OAAO,aAAa,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Cluster-scoped bookkeeping of the role identities a stack has claimed.
3
+ *
4
+ * Every engine nimbus supports keeps login identities at the *server* level, not
5
+ * inside the database: a PostgreSQL role and a MariaDB account both exist once
6
+ * per cluster and are merely granted privileges on individual databases. nimbus'
7
+ * `addRole()` is scoped to a database, so nothing in the shape of the API stops
8
+ * two databases on one cluster from each asking for a role called `reader`.
9
+ *
10
+ * That is not a duplicate resource Pulumi can catch. Each database derives its
11
+ * own Pulumi logical names, so `pulumi preview` sees two unrelated resources and
12
+ * reports no conflict — while on the cluster both reconcile the *same* account
13
+ * against *different* generated password Secrets, rewriting its password against
14
+ * each other forever. At least one database's replicated connection Secrets then
15
+ * holds a credential that no longer authenticates, and nothing in the diff says
16
+ * why.
17
+ *
18
+ * A registry lives for the lifetime of one cluster object and refuses the second
19
+ * claim, so the collision surfaces at preview instead of in production. The
20
+ * alternative — silently renaming the second role, say by prefixing it with the
21
+ * database name — is worse: it would hand back an account that is not the one
22
+ * the caller asked for.
23
+ *
24
+ * @module operator/role-registry
25
+ */
26
+ /** Wording a registry uses to describe the scope its identities are global to. */
27
+ export interface IRoleRegistryOptions {
28
+ /** Cluster or instance the registry covers, named in the error message. */
29
+ readonly clusterName: string;
30
+ /** What that thing is called for this engine, e.g. `"cluster"`, `"instance"`. */
31
+ readonly scopeNoun: string;
32
+ /** Sentences explaining why identities are scope-global and what a clash breaks. */
33
+ readonly scopeExplanation: string;
34
+ }
35
+ /** One request to claim a role identity. */
36
+ export interface IRoleClaim {
37
+ /**
38
+ * The value two roles must not share.
39
+ *
40
+ * This is the engine's own notion of account identity, which is not always
41
+ * just the name — MariaDB accounts are identified by username *and* host, so
42
+ * two roles named `reader` on genuinely different hosts are distinct accounts
43
+ * and must both be allowed.
44
+ */
45
+ readonly identity: string;
46
+ /** How the identity is rendered in the error message, e.g. `"reader"@"%"`. */
47
+ readonly label: string;
48
+ /** Database whose configuration is making the claim. */
49
+ readonly databaseName: string;
50
+ }
51
+ /** Records which role identities a cluster has already handed out. */
52
+ export interface IRoleRegistry {
53
+ /**
54
+ * Claim an identity for a database, or fail because something else holds it.
55
+ *
56
+ * @param claim - Identity to claim, its display form, and the claiming database
57
+ * @throws {AnyCloudError} code `UNSUPPORTED_ROLE_OPTION` when the identity was
58
+ * already claimed on this cluster, by any database
59
+ */
60
+ claim(claim: IRoleClaim): void;
61
+ }
62
+ /**
63
+ * Create an empty registry for one cluster.
64
+ *
65
+ * Callers hold exactly one per cluster and thread it through every database
66
+ * created on it — both the owner created by `createDatabase()` and every role
67
+ * added by `addRole()` must claim, or the guard has a hole.
68
+ *
69
+ * @param options - Cluster name and the engine's wording for scope and consequence
70
+ * @returns A registry with no identities claimed yet
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * const registry = createRoleRegistry({
75
+ * clusterName: "pgsql-main",
76
+ * scopeNoun: "cluster",
77
+ * scopeExplanation: "PostgreSQL roles are cluster-global.",
78
+ * });
79
+ * registry.claim({ identity: "reader", label: '"reader"', databaseName: "billing" });
80
+ * // Throws: "reader" is already claimed by database "billing".
81
+ * registry.claim({ identity: "reader", label: '"reader"', databaseName: "analytics" });
82
+ * ```
83
+ */
84
+ export declare function createRoleRegistry(options: IRoleRegistryOptions): IRoleRegistry;
85
+ //# sourceMappingURL=role-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role-registry.d.ts","sourceRoot":"","sources":["../../../src/operator/role-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,kFAAkF;AAClF,MAAM,WAAW,oBAAoB;IACnC,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oFAAoF;IACpF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED,4CAA4C;AAC5C,MAAM,WAAW,UAAU;IACzB;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAwB/E"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ /**
3
+ * Cluster-scoped bookkeeping of the role identities a stack has claimed.
4
+ *
5
+ * Every engine nimbus supports keeps login identities at the *server* level, not
6
+ * inside the database: a PostgreSQL role and a MariaDB account both exist once
7
+ * per cluster and are merely granted privileges on individual databases. nimbus'
8
+ * `addRole()` is scoped to a database, so nothing in the shape of the API stops
9
+ * two databases on one cluster from each asking for a role called `reader`.
10
+ *
11
+ * That is not a duplicate resource Pulumi can catch. Each database derives its
12
+ * own Pulumi logical names, so `pulumi preview` sees two unrelated resources and
13
+ * reports no conflict — while on the cluster both reconcile the *same* account
14
+ * against *different* generated password Secrets, rewriting its password against
15
+ * each other forever. At least one database's replicated connection Secrets then
16
+ * holds a credential that no longer authenticates, and nothing in the diff says
17
+ * why.
18
+ *
19
+ * A registry lives for the lifetime of one cluster object and refuses the second
20
+ * claim, so the collision surfaces at preview instead of in production. The
21
+ * alternative — silently renaming the second role, say by prefixing it with the
22
+ * database name — is worse: it would hand back an account that is not the one
23
+ * the caller asked for.
24
+ *
25
+ * @module operator/role-registry
26
+ */
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.createRoleRegistry = createRoleRegistry;
29
+ const errors_js_1 = require("../types/errors.js");
30
+ /**
31
+ * Create an empty registry for one cluster.
32
+ *
33
+ * Callers hold exactly one per cluster and thread it through every database
34
+ * created on it — both the owner created by `createDatabase()` and every role
35
+ * added by `addRole()` must claim, or the guard has a hole.
36
+ *
37
+ * @param options - Cluster name and the engine's wording for scope and consequence
38
+ * @returns A registry with no identities claimed yet
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const registry = createRoleRegistry({
43
+ * clusterName: "pgsql-main",
44
+ * scopeNoun: "cluster",
45
+ * scopeExplanation: "PostgreSQL roles are cluster-global.",
46
+ * });
47
+ * registry.claim({ identity: "reader", label: '"reader"', databaseName: "billing" });
48
+ * // Throws: "reader" is already claimed by database "billing".
49
+ * registry.claim({ identity: "reader", label: '"reader"', databaseName: "analytics" });
50
+ * ```
51
+ */
52
+ function createRoleRegistry(options) {
53
+ /** identity → the database that claimed it first. */
54
+ const claimedBy = new Map();
55
+ return {
56
+ claim({ identity, label, databaseName }) {
57
+ const holder = claimedBy.get(identity);
58
+ if (holder !== undefined) {
59
+ const scope = `${options.scopeNoun} "${options.clusterName}"`;
60
+ const where = holder === databaseName
61
+ ? `already claimed by database "${holder}"`
62
+ : `already claimed by database "${holder}" and cannot be claimed again by ` +
63
+ `database "${databaseName}"`;
64
+ throw new errors_js_1.AnyCloudError(`Role ${label} is ${where} on ${scope}. ${options.scopeExplanation} ` +
65
+ `Give one of them a different name — nimbus will not silently rename it for ` +
66
+ `you, because the role you would get back is not the one you asked for.`, errors_js_1.ERROR_CODES.UNSUPPORTED_ROLE_OPTION);
67
+ }
68
+ claimedBy.set(identity, databaseName);
69
+ },
70
+ };
71
+ }
72
+ //# sourceMappingURL=role-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role-registry.js","sourceRoot":"","sources":["../../../src/operator/role-registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;AAiEH,gDAwBC;AAvFD,kDAAgE;AAyChE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,kBAAkB,CAAC,OAA6B;IAC9D,qDAAqD;IACrD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE5C,OAAO;QACL,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAc;YACjD,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,MAAM,KAAK,GAAG,GAAG,OAAO,CAAC,SAAS,KAAK,OAAO,CAAC,WAAW,GAAG,CAAC;gBAC9D,MAAM,KAAK,GACT,MAAM,KAAK,YAAY;oBACrB,CAAC,CAAC,gCAAgC,MAAM,GAAG;oBAC3C,CAAC,CAAC,gCAAgC,MAAM,mCAAmC;wBACzE,aAAa,YAAY,GAAG,CAAC;gBACnC,MAAM,IAAI,yBAAa,CACrB,QAAQ,KAAK,OAAO,KAAK,OAAO,KAAK,KAAK,OAAO,CAAC,gBAAgB,GAAG;oBACnE,6EAA6E;oBAC7E,wEAAwE,EAC1E,uBAAW,CAAC,uBAAuB,CACpC,CAAC;YACJ,CAAC;YACD,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -16,6 +16,9 @@ export declare const ERROR_CODES: {
16
16
  readonly CONFIG_INVALID: "CONFIG_INVALID";
17
17
  readonly SECRET_NOT_FOUND: "SECRET_NOT_FOUND";
18
18
  readonly PROVIDER_MISMATCH: "PROVIDER_MISMATCH";
19
+ readonly INVALID_GRANT: "INVALID_GRANT";
20
+ readonly UNSUPPORTED_PRIVILEGE: "UNSUPPORTED_PRIVILEGE";
21
+ readonly UNSUPPORTED_ROLE_OPTION: "UNSUPPORTED_ROLE_OPTION";
19
22
  };
20
23
  export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
21
24
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,yCAAyC;AACzC,eAAO,MAAM,WAAW;;;;;;;;;CASd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEvE;;;;;;;;;;;;;GAaG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;CAM7C;AAED;;;;;GAKG;AACH,qBA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;gBACzC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,aAAa;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;gBAGrC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,cAAc,GAAG,cAAc,EACrC,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC;CAMhC;AAED;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAS9C;AAED;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,aAAa;IAC5C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEhB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,SAAS,CAAC,EAAE,MAAM;CAK3F;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAE/C"}
@@ -20,6 +20,9 @@ exports.ERROR_CODES = {
20
20
  CONFIG_INVALID: "CONFIG_INVALID",
21
21
  SECRET_NOT_FOUND: "SECRET_NOT_FOUND",
22
22
  PROVIDER_MISMATCH: "PROVIDER_MISMATCH",
23
+ INVALID_GRANT: "INVALID_GRANT",
24
+ UNSUPPORTED_PRIVILEGE: "UNSUPPORTED_PRIVILEGE",
25
+ UNSUPPORTED_ROLE_OPTION: "UNSUPPORTED_ROLE_OPTION",
23
26
  };
24
27
  /**
25
28
  * Base error for all nimbus errors.
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/types/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA+HH,kCAEC;AA/HD,yCAAyC;AAC5B,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