graphile-bucket-provisioner-plugin 0.11.2 → 0.12.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.
- package/esm/plugin.js +5 -5
- package/package.json +4 -4
- package/plugin.js +5 -5
package/esm/plugin.js
CHANGED
|
@@ -38,12 +38,12 @@ import { BucketProvisioner, } from '@constructive-io/bucket-provisioner';
|
|
|
38
38
|
const log = new Logger('graphile-bucket-provisioner:plugin');
|
|
39
39
|
// --- Storage module queries ---
|
|
40
40
|
/**
|
|
41
|
-
* Resolve the app-level storage module (
|
|
41
|
+
* Resolve the app-level storage module (scope = 'app').
|
|
42
42
|
*/
|
|
43
43
|
const APP_STORAGE_MODULE_QUERY = `
|
|
44
44
|
SELECT
|
|
45
45
|
sm.id,
|
|
46
|
-
sm.
|
|
46
|
+
sm.scope,
|
|
47
47
|
sm.entity_table_id,
|
|
48
48
|
bs.schema_name AS buckets_schema,
|
|
49
49
|
bt.name AS buckets_table,
|
|
@@ -55,7 +55,7 @@ const APP_STORAGE_MODULE_QUERY = `
|
|
|
55
55
|
JOIN metaschema_public.table bt ON bt.id = sm.buckets_table_id
|
|
56
56
|
JOIN metaschema_public.schema bs ON bs.id = bt.schema_id
|
|
57
57
|
WHERE sm.database_id = $1
|
|
58
|
-
AND sm.
|
|
58
|
+
AND sm.scope = 'app'
|
|
59
59
|
LIMIT 1
|
|
60
60
|
`;
|
|
61
61
|
/**
|
|
@@ -64,7 +64,7 @@ const APP_STORAGE_MODULE_QUERY = `
|
|
|
64
64
|
const ALL_STORAGE_MODULES_QUERY = `
|
|
65
65
|
SELECT
|
|
66
66
|
sm.id,
|
|
67
|
-
sm.
|
|
67
|
+
sm.scope,
|
|
68
68
|
sm.entity_table_id,
|
|
69
69
|
bs.schema_name AS buckets_schema,
|
|
70
70
|
bt.name AS buckets_table,
|
|
@@ -301,7 +301,7 @@ export function createBucketProvisionerPlugin(options) {
|
|
|
301
301
|
: 'STORAGE_MODULE_NOT_PROVISIONED');
|
|
302
302
|
}
|
|
303
303
|
// Look up the bucket row (RLS enforced via pgSettings)
|
|
304
|
-
const hasOwner = ownerId && storageModule.
|
|
304
|
+
const hasOwner = ownerId && storageModule.scope !== 'app';
|
|
305
305
|
const bucketsTable = QuoteUtils.quoteQualifiedIdentifier(storageModule.buckets_schema, storageModule.buckets_table);
|
|
306
306
|
const bucketResult = await pgClient.query(hasOwner
|
|
307
307
|
? `SELECT id, key, type, is_public, allowed_origins
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-bucket-provisioner-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Bucket provisioning plugin for PostGraphile v5 — auto-provisions S3 buckets on bucket table mutations",
|
|
5
5
|
"author": "Constructive <developers@constructive.io>",
|
|
6
6
|
"homepage": "https://github.com/constructive-io/constructive",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"url": "https://github.com/constructive-io/constructive/issues"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@constructive-io/bucket-provisioner": "^0.
|
|
44
|
-
"@pgpmjs/logger": "^2.
|
|
43
|
+
"@constructive-io/bucket-provisioner": "^0.12.0",
|
|
44
|
+
"@pgpmjs/logger": "^2.12.0",
|
|
45
45
|
"@pgsql/quotes": "^17.1.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"@types/node": "^22.19.11",
|
|
58
58
|
"makage": "^0.3.0"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "0503916f414a3b8a6f6cbe46e03a59988b2f3cb5"
|
|
61
61
|
}
|
package/plugin.js
CHANGED
|
@@ -42,12 +42,12 @@ const bucket_provisioner_1 = require("@constructive-io/bucket-provisioner");
|
|
|
42
42
|
const log = new logger_1.Logger('graphile-bucket-provisioner:plugin');
|
|
43
43
|
// --- Storage module queries ---
|
|
44
44
|
/**
|
|
45
|
-
* Resolve the app-level storage module (
|
|
45
|
+
* Resolve the app-level storage module (scope = 'app').
|
|
46
46
|
*/
|
|
47
47
|
const APP_STORAGE_MODULE_QUERY = `
|
|
48
48
|
SELECT
|
|
49
49
|
sm.id,
|
|
50
|
-
sm.
|
|
50
|
+
sm.scope,
|
|
51
51
|
sm.entity_table_id,
|
|
52
52
|
bs.schema_name AS buckets_schema,
|
|
53
53
|
bt.name AS buckets_table,
|
|
@@ -59,7 +59,7 @@ const APP_STORAGE_MODULE_QUERY = `
|
|
|
59
59
|
JOIN metaschema_public.table bt ON bt.id = sm.buckets_table_id
|
|
60
60
|
JOIN metaschema_public.schema bs ON bs.id = bt.schema_id
|
|
61
61
|
WHERE sm.database_id = $1
|
|
62
|
-
AND sm.
|
|
62
|
+
AND sm.scope = 'app'
|
|
63
63
|
LIMIT 1
|
|
64
64
|
`;
|
|
65
65
|
/**
|
|
@@ -68,7 +68,7 @@ const APP_STORAGE_MODULE_QUERY = `
|
|
|
68
68
|
const ALL_STORAGE_MODULES_QUERY = `
|
|
69
69
|
SELECT
|
|
70
70
|
sm.id,
|
|
71
|
-
sm.
|
|
71
|
+
sm.scope,
|
|
72
72
|
sm.entity_table_id,
|
|
73
73
|
bs.schema_name AS buckets_schema,
|
|
74
74
|
bt.name AS buckets_table,
|
|
@@ -305,7 +305,7 @@ function createBucketProvisionerPlugin(options) {
|
|
|
305
305
|
: 'STORAGE_MODULE_NOT_PROVISIONED');
|
|
306
306
|
}
|
|
307
307
|
// Look up the bucket row (RLS enforced via pgSettings)
|
|
308
|
-
const hasOwner = ownerId && storageModule.
|
|
308
|
+
const hasOwner = ownerId && storageModule.scope !== 'app';
|
|
309
309
|
const bucketsTable = quotes_1.QuoteUtils.quoteQualifiedIdentifier(storageModule.buckets_schema, storageModule.buckets_table);
|
|
310
310
|
const bucketResult = await pgClient.query(hasOwner
|
|
311
311
|
? `SELECT id, key, type, is_public, allowed_origins
|