graphile-presigned-url-plugin 0.14.0 → 0.14.1
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 +14 -3
- package/package.json +2 -2
- package/plugin.js +14 -3
package/esm/plugin.js
CHANGED
|
@@ -171,10 +171,21 @@ export function createPresignedUrlPlugin(options) {
|
|
|
171
171
|
for (const filesCodec of fileCodecs) {
|
|
172
172
|
const filesTypeName = build.inflection.tableType(filesCodec);
|
|
173
173
|
const filesSchemaName = filesCodec.extensions?.pg?.schemaName;
|
|
174
|
-
// Find the matching bucket codec by
|
|
175
|
-
|
|
174
|
+
// Find the matching bucket codec by table name prefix.
|
|
175
|
+
// Schema-name matching is ambiguous when multiple storage modules share
|
|
176
|
+
// the same PG schema (e.g. app_files + data_room_files both in storage_public).
|
|
177
|
+
// Instead, derive the prefix from the raw SQL table name:
|
|
178
|
+
// "data_room_files" → prefix "data_room" → matches "data_room_buckets"
|
|
179
|
+
// "app_files" → prefix "app" → matches "app_buckets"
|
|
180
|
+
const filesRawName = filesCodec.extensions?.pg?.name;
|
|
181
|
+
const filesPrefix = filesRawName?.replace(/_files$/, '');
|
|
182
|
+
const matchingBucketCodec = bucketCodecs.find((bc) => {
|
|
183
|
+
const bucketRawName = bc.extensions?.pg?.name;
|
|
184
|
+
const bucketPrefix = bucketRawName?.replace(/_buckets$/, '');
|
|
185
|
+
return bucketPrefix === filesPrefix;
|
|
186
|
+
});
|
|
176
187
|
if (!matchingBucketCodec) {
|
|
177
|
-
log.debug(`Skipping
|
|
188
|
+
log.debug(`Skipping upload mutation for ${filesCodec.name}: no matching bucket codec with prefix "${filesPrefix}"`);
|
|
178
189
|
continue;
|
|
179
190
|
}
|
|
180
191
|
const hasOwnerId = !!matchingBucketCodec.attributes.owner_id;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-presigned-url-plugin",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Presigned URL upload plugin for PostGraphile v5 — requestUploadUrl mutation and downloadUrl computed field",
|
|
5
5
|
"author": "Constructive <developers@constructive.io>",
|
|
6
6
|
"homepage": "https://github.com/constructive-io/constructive",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"@types/node": "^22.19.11",
|
|
61
61
|
"makage": "^0.1.10"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "96452226da9196a4d2cceb24fe30869ce318aeae"
|
|
64
64
|
}
|
package/plugin.js
CHANGED
|
@@ -175,10 +175,21 @@ function createPresignedUrlPlugin(options) {
|
|
|
175
175
|
for (const filesCodec of fileCodecs) {
|
|
176
176
|
const filesTypeName = build.inflection.tableType(filesCodec);
|
|
177
177
|
const filesSchemaName = filesCodec.extensions?.pg?.schemaName;
|
|
178
|
-
// Find the matching bucket codec by
|
|
179
|
-
|
|
178
|
+
// Find the matching bucket codec by table name prefix.
|
|
179
|
+
// Schema-name matching is ambiguous when multiple storage modules share
|
|
180
|
+
// the same PG schema (e.g. app_files + data_room_files both in storage_public).
|
|
181
|
+
// Instead, derive the prefix from the raw SQL table name:
|
|
182
|
+
// "data_room_files" → prefix "data_room" → matches "data_room_buckets"
|
|
183
|
+
// "app_files" → prefix "app" → matches "app_buckets"
|
|
184
|
+
const filesRawName = filesCodec.extensions?.pg?.name;
|
|
185
|
+
const filesPrefix = filesRawName?.replace(/_files$/, '');
|
|
186
|
+
const matchingBucketCodec = bucketCodecs.find((bc) => {
|
|
187
|
+
const bucketRawName = bc.extensions?.pg?.name;
|
|
188
|
+
const bucketPrefix = bucketRawName?.replace(/_buckets$/, '');
|
|
189
|
+
return bucketPrefix === filesPrefix;
|
|
190
|
+
});
|
|
180
191
|
if (!matchingBucketCodec) {
|
|
181
|
-
log.debug(`Skipping
|
|
192
|
+
log.debug(`Skipping upload mutation for ${filesCodec.name}: no matching bucket codec with prefix "${filesPrefix}"`);
|
|
182
193
|
continue;
|
|
183
194
|
}
|
|
184
195
|
const hasOwnerId = !!matchingBucketCodec.attributes.owner_id;
|