@geekmidas/cloud 10.0.0-alpha.33 → 10.0.0-alpha.34

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.33",
3
+ "version": "10.0.0-alpha.34",
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.33",
45
- "@geekmidas/manifest": "10.0.0-alpha.33"
44
+ "@geekmidas/envkit": "10.0.0-alpha.34",
45
+ "@geekmidas/manifest": "10.0.0-alpha.34"
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.33",
62
- "@geekmidas/storage": "^10.0.0-alpha.33",
63
- "@geekmidas/events": "^10.0.0-alpha.33",
64
- "@geekmidas/db": "^10.0.0-alpha.33"
61
+ "@geekmidas/manifest": "^10.0.0-alpha.34",
62
+ "@geekmidas/storage": "^10.0.0-alpha.34",
63
+ "@geekmidas/events": "^10.0.0-alpha.34",
64
+ "@geekmidas/db": "^10.0.0-alpha.34"
65
65
  },
66
66
  "peerDependenciesMeta": {
67
67
  "@geekmidas/manifest": {
@@ -65,6 +65,8 @@ export class DatabaseBootstrap {
65
65
  runtime: string;
66
66
  owner: string;
67
67
  reader?: string;
68
+ /** The database's own roles, whose owner may create in it. */
69
+ ownsDatabase?: boolean;
68
70
  }): { runtime: $util.Output<string>; reader?: $util.Output<string> } {
69
71
  const runtime = this.password(tenant.runtime);
70
72
  const reader = tenant.reader ? this.password(tenant.reader) : undefined;
@@ -75,6 +77,7 @@ export class DatabaseBootstrap {
75
77
  runtime: tenant.runtime,
76
78
  owner: tenant.owner,
77
79
  ...(tenant.reader ? { reader: tenant.reader } : {}),
80
+ ...(tenant.ownsDatabase ? { ownsDatabase: true } : {}),
78
81
  // Filled in by `bootstrapEvent` once the outputs resolve. The function
79
82
  // reads them straight out of its input and never fetches a secret, so
80
83
  // it needs no IAM to read one.
@@ -28,6 +28,11 @@ export interface BootstrapTenant {
28
28
  runtime: string;
29
29
  owner: string;
30
30
  reader?: string;
31
+ /**
32
+ * The database's own roles rather than a tenant's: its owner may create in
33
+ * the database, for trusted extensions.
34
+ */
35
+ ownsDatabase?: boolean;
31
36
  passwords: { runtime: string; owner: string; reader?: string };
32
37
  }
33
38
 
@@ -75,7 +80,11 @@ export async function handler(event: BootstrapEvent): Promise<BootstrapResult> {
75
80
 
76
81
  try {
77
82
  for (const tenant of event.tenants) {
78
- for (const statement of roleStatements(tenant)) {
83
+ const spec = {
84
+ ...tenant,
85
+ ...(tenant.ownsDatabase ? { database: event.master.database } : {}),
86
+ };
87
+ for (const statement of roleStatements(spec)) {
79
88
  if (statement.exists) {
80
89
  const { rows } = await client.query(
81
90
  statement.exists.sql,
@@ -241,6 +241,7 @@ const PROVISIONERS: Partial<Record<DeclarationKind, Provisioner>> = {
241
241
  schema: d.schema,
242
242
  runtime,
243
243
  owner: ownerRole(runtime),
244
+ ownsDatabase: true,
244
245
  ...(hasReader(d.id, context) ? { reader: readerRole(runtime) } : {}),
245
246
  });
246
247