@geekmidas/cloud 10.0.0-alpha.116 → 10.0.0-alpha.118

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekmidas/cloud",
3
- "version": "10.0.0-alpha.116",
3
+ "version": "10.0.0-alpha.118",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -41,8 +41,8 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "lodash.snakecase": "~4.1.1",
44
- "@geekmidas/envkit": "10.0.0-alpha.116",
45
- "@geekmidas/manifest": "10.0.0-alpha.116"
44
+ "@geekmidas/envkit": "10.0.0-alpha.118",
45
+ "@geekmidas/manifest": "10.0.0-alpha.118"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/lodash.get": "~4.4.9",
@@ -58,10 +58,10 @@
58
58
  "@pulumi/aws": ">=7.47.0",
59
59
  "@pulumi/random": ">=4.21.2",
60
60
  "@pulumi/pulumi": ">=3.263.0",
61
- "@geekmidas/manifest": "^10.0.0-alpha.116",
62
- "@geekmidas/storage": "^10.0.0-alpha.116",
63
- "@geekmidas/events": "^10.0.0-alpha.116",
64
- "@geekmidas/db": "^10.0.0-alpha.116"
61
+ "@geekmidas/manifest": "^10.0.0-alpha.118",
62
+ "@geekmidas/storage": "^10.0.0-alpha.118",
63
+ "@geekmidas/events": "^10.0.0-alpha.118",
64
+ "@geekmidas/db": "^10.0.0-alpha.118"
65
65
  },
66
66
  "peerDependenciesMeta": {
67
67
  "@geekmidas/manifest": {
@@ -113,6 +113,21 @@ describe('bootstrapEvent', () => {
113
113
  expect(roleStatements(event.tenants[0]).length).toBeGreaterThan(0);
114
114
  });
115
115
 
116
+ it('carries a declared extension through to the DDL the master runs', () => {
117
+ // RDS ships PostGIS, but only the master may create it.
118
+ const event = JSON.parse(
119
+ bootstrapEvent(
120
+ master,
121
+ [{ ...tenant, extensions: ['postgis'] }],
122
+ passwords,
123
+ ),
124
+ );
125
+
126
+ expect(roleStatements(event.tenants[0]).map((s) => s.sql)).toContain(
127
+ 'CREATE EXTENSION IF NOT EXISTS "postgis" SCHEMA public',
128
+ );
129
+ });
130
+
116
131
  it('carries a reader password only where a reader was named', () => {
117
132
  const withReader = { ...tenant, reader: 'authdb_reader' };
118
133
  const event = JSON.parse(
@@ -67,6 +67,8 @@ export class DatabaseBootstrap {
67
67
  reader?: string;
68
68
  /** The database's own roles, whose owner may create in it. */
69
69
  ownsDatabase?: boolean;
70
+ /** Extensions the database declared, created as the master. */
71
+ extensions?: readonly string[];
70
72
  }): { runtime: $util.Output<string>; reader?: $util.Output<string> } {
71
73
  const runtime = this.password(tenant.runtime);
72
74
  const reader = tenant.reader ? this.password(tenant.reader) : undefined;
@@ -78,6 +80,7 @@ export class DatabaseBootstrap {
78
80
  owner: tenant.owner,
79
81
  ...(tenant.reader ? { reader: tenant.reader } : {}),
80
82
  ...(tenant.ownsDatabase ? { ownsDatabase: true } : {}),
83
+ ...(tenant.extensions?.length ? { extensions: tenant.extensions } : {}),
81
84
  // Filled in by `bootstrapEvent` once the outputs resolve. The function
82
85
  // reads them straight out of its input and never fetches a secret, so
83
86
  // it needs no IAM to read one.
@@ -33,6 +33,8 @@ export interface BootstrapTenant {
33
33
  * the database, for trusted extensions.
34
34
  */
35
35
  ownsDatabase?: boolean;
36
+ /** Extensions the database declared, created as the master. */
37
+ extensions?: readonly string[];
36
38
  passwords: { runtime: string; owner: string; reader?: string };
37
39
  }
38
40
 
@@ -239,6 +239,9 @@ const PROVISIONERS: Partial<Record<DeclarationKind, Provisioner>> = {
239
239
  runtime,
240
240
  owner: ownerRole(runtime),
241
241
  ownsDatabase: true,
242
+ // RDS ships PostGIS, so the image is not a question here — only the
243
+ // `CREATE EXTENSION`, which the master can run and the owner cannot.
244
+ ...(d.extensions?.length ? { extensions: d.extensions } : {}),
242
245
  ...(hasReader(d.id, context) ? { reader: readerRole(runtime) } : {}),
243
246
  });
244
247