graphile-presigned-url-plugin 1.16.0 → 1.16.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.
@@ -9,6 +9,7 @@
9
9
  * environment-level bucket standing in for a tenant's.
10
10
  */
11
11
  import { Logger } from '@pgpmjs/logger';
12
+ import { recordPhysicalName } from 'graphile-storage-registry';
12
13
  import { withRequestPgClient } from './request-pg-client';
13
14
  import { s3FailureError } from './s3-failure';
14
15
  import { isS3BucketProvisioned, markS3BucketProvisioned } from './storage-module-cache';
@@ -108,12 +109,7 @@ export async function provisionAndRecordPhysicalBucket(options, withPgClient, st
108
109
  // guard keeps this idempotent and race-safe across concurrent first uploads.
109
110
  // The catalog-sync trigger on this UPDATE needs `jwt.claims.database_id`, so the
110
111
  // write runs under the resolved database claim (privileged role preserved).
111
- await withRequestPgClient(withPgClient, { 'jwt.claims.database_id': databaseId }, (client) => client.query({
112
- text: `UPDATE ${storageConfig.bucketsQualifiedName}
113
- SET physical_name = $1
114
- WHERE id = $2 AND physical_name IS NULL`,
115
- values: [s3BucketName, bucket.id],
116
- }));
112
+ await withRequestPgClient(withPgClient, { 'jwt.claims.database_id': databaseId }, (client) => recordPhysicalName((query) => client.query(query), storageConfig.bucketsQualifiedName, bucket.id, s3BucketName));
117
113
  bucket.physical_name = s3BucketName;
118
114
  log.info(`Recorded physical_name="${s3BucketName}" on bucket ${bucket.id}`);
119
115
  return s3BucketName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphile-presigned-url-plugin",
3
- "version": "1.16.0",
3
+ "version": "1.16.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",
@@ -44,7 +44,7 @@
44
44
  "@aws-sdk/s3-request-presigner": "^3.1052.0",
45
45
  "@pgpmjs/logger": "^2.25.0",
46
46
  "@pgsql/quotes": "^18.2.4",
47
- "graphile-storage-registry": "^0.1.0",
47
+ "graphile-storage-registry": "^0.1.1",
48
48
  "lru-cache": "^11.2.7",
49
49
  "mime-bytes": "^0.32.0"
50
50
  },
@@ -62,5 +62,5 @@
62
62
  "@types/node": "^22.19.11",
63
63
  "makage": "^0.3.0"
64
64
  },
65
- "gitHead": "df6b6613c844b505813e5d02d3a4afd918b74eab"
65
+ "gitHead": "7e6cc68f5659d12ec852835a7d8fcca6b05a8f50"
66
66
  }
@@ -15,6 +15,7 @@ exports.mintPhysicalBucketName = mintPhysicalBucketName;
15
15
  exports.resolveS3ForDatabase = resolveS3ForDatabase;
16
16
  exports.provisionAndRecordPhysicalBucket = provisionAndRecordPhysicalBucket;
17
17
  const logger_1 = require("@pgpmjs/logger");
18
+ const graphile_storage_registry_1 = require("graphile-storage-registry");
18
19
  const request_pg_client_1 = require("./request-pg-client");
19
20
  const s3_failure_1 = require("./s3-failure");
20
21
  const storage_module_cache_1 = require("./storage-module-cache");
@@ -114,12 +115,7 @@ async function provisionAndRecordPhysicalBucket(options, withPgClient, storageCo
114
115
  // guard keeps this idempotent and race-safe across concurrent first uploads.
115
116
  // The catalog-sync trigger on this UPDATE needs `jwt.claims.database_id`, so the
116
117
  // write runs under the resolved database claim (privileged role preserved).
117
- await (0, request_pg_client_1.withRequestPgClient)(withPgClient, { 'jwt.claims.database_id': databaseId }, (client) => client.query({
118
- text: `UPDATE ${storageConfig.bucketsQualifiedName}
119
- SET physical_name = $1
120
- WHERE id = $2 AND physical_name IS NULL`,
121
- values: [s3BucketName, bucket.id],
122
- }));
118
+ await (0, request_pg_client_1.withRequestPgClient)(withPgClient, { 'jwt.claims.database_id': databaseId }, (client) => (0, graphile_storage_registry_1.recordPhysicalName)((query) => client.query(query), storageConfig.bucketsQualifiedName, bucket.id, s3BucketName));
123
119
  bucket.physical_name = s3BucketName;
124
120
  log.info(`Recorded physical_name="${s3BucketName}" on bucket ${bucket.id}`);
125
121
  return s3BucketName;