graphile-presigned-url-plugin 0.7.0 → 0.9.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/README.md CHANGED
@@ -17,11 +17,9 @@ Presigned URL upload plugin for PostGraphile v5.
17
17
  ## Features
18
18
 
19
19
  - `requestUploadUrl` mutation — generates presigned PUT URLs for direct client-to-S3 upload
20
- - `confirmUpload` mutation — verifies upload and transitions file status to 'ready'
21
20
  - `downloadUrl` computed field — presigned GET URLs for private files, public URLs for public files
22
21
  - Content-hash based S3 keys (SHA-256) with automatic deduplication
23
22
  - Per-bucket MIME type and file size validation
24
- - Upload request tracking for audit and rate limiting
25
23
 
26
24
  ## Usage
27
25
 
@@ -96,7 +96,6 @@ function createDownloadUrlPlugin(options) {
96
96
  const $key = $parent.get('key');
97
97
  const $isPublic = $parent.get('is_public');
98
98
  const $filename = $parent.get('filename');
99
- const $status = $parent.get('status');
100
99
  // Access GraphQL context for per-database config resolution
101
100
  const $withPgClient = (0, grafast_1.context)().get('withPgClient');
102
101
  const $pgSettings = (0, grafast_1.context)().get('pgSettings');
@@ -104,17 +103,12 @@ function createDownloadUrlPlugin(options) {
104
103
  key: $key,
105
104
  isPublic: $isPublic,
106
105
  filename: $filename,
107
- status: $status,
108
106
  withPgClient: $withPgClient,
109
107
  pgSettings: $pgSettings,
110
108
  });
111
- return (0, grafast_1.lambda)($combined, async ({ key, isPublic, filename, status, withPgClient, pgSettings }) => {
109
+ return (0, grafast_1.lambda)($combined, async ({ key, isPublic, filename, withPgClient, pgSettings }) => {
112
110
  if (!key)
113
111
  return null;
114
- // Only provide download URLs for ready/processed files
115
- if (status !== 'ready' && status !== 'processed') {
116
- return null;
117
- }
118
112
  // Resolve per-database config (bucket, publicUrlPrefix, expiry)
119
113
  let s3ForDb = resolveS3(options); // fallback to global
120
114
  let downloadUrlExpirySeconds = 3600; // fallback default
@@ -93,7 +93,6 @@ export function createDownloadUrlPlugin(options) {
93
93
  const $key = $parent.get('key');
94
94
  const $isPublic = $parent.get('is_public');
95
95
  const $filename = $parent.get('filename');
96
- const $status = $parent.get('status');
97
96
  // Access GraphQL context for per-database config resolution
98
97
  const $withPgClient = grafastContext().get('withPgClient');
99
98
  const $pgSettings = grafastContext().get('pgSettings');
@@ -101,17 +100,12 @@ export function createDownloadUrlPlugin(options) {
101
100
  key: $key,
102
101
  isPublic: $isPublic,
103
102
  filename: $filename,
104
- status: $status,
105
103
  withPgClient: $withPgClient,
106
104
  pgSettings: $pgSettings,
107
105
  });
108
- return lambda($combined, async ({ key, isPublic, filename, status, withPgClient, pgSettings }) => {
106
+ return lambda($combined, async ({ key, isPublic, filename, withPgClient, pgSettings }) => {
109
107
  if (!key)
110
108
  return null;
111
- // Only provide download URLs for ready/processed files
112
- if (status !== 'ready' && status !== 'processed') {
113
- return null;
114
- }
115
109
  // Resolve per-database config (bucket, publicUrlPrefix, expiry)
116
110
  let s3ForDb = resolveS3(options); // fallback to global
117
111
  let downloadUrlExpirySeconds = 3600; // fallback default
package/esm/index.d.ts CHANGED
@@ -2,8 +2,7 @@
2
2
  * Presigned URL Plugin for PostGraphile v5
3
3
  *
4
4
  * Provides presigned URL upload capabilities for PostGraphile v5:
5
- * - requestUploadUrl mutation (presigned PUT URL generation)
6
- * - confirmUpload mutation (upload verification + status transition)
5
+ * - requestUploadUrl mutation (presigned PUT URL generation + dedup)
7
6
  * - downloadUrl computed field (presigned GET URL / public URL)
8
7
  *
9
8
  * @example
@@ -31,4 +30,4 @@ export { createDownloadUrlPlugin } from './download-url-field';
31
30
  export { PresignedUrlPreset } from './preset';
32
31
  export { getStorageModuleConfig, getStorageModuleConfigForOwner, getBucketConfig, resolveStorageModuleByFileId, clearStorageModuleCache, clearBucketCache, isS3BucketProvisioned, markS3BucketProvisioned } from './storage-module-cache';
33
32
  export { generatePresignedPutUrl, generatePresignedGetUrl, headObject } from './s3-signer';
34
- export type { BucketConfig, StorageModuleConfig, RequestUploadUrlInput, RequestUploadUrlPayload, ConfirmUploadInput, ConfirmUploadPayload, S3Config, S3ConfigOrGetter, PresignedUrlPluginOptions, BucketNameResolver, EnsureBucketProvisioned, } from './types';
33
+ export type { BucketConfig, StorageModuleConfig, RequestUploadUrlInput, RequestUploadUrlPayload, S3Config, S3ConfigOrGetter, PresignedUrlPluginOptions, BucketNameResolver, EnsureBucketProvisioned, } from './types';
package/esm/index.js CHANGED
@@ -2,8 +2,7 @@
2
2
  * Presigned URL Plugin for PostGraphile v5
3
3
  *
4
4
  * Provides presigned URL upload capabilities for PostGraphile v5:
5
- * - requestUploadUrl mutation (presigned PUT URL generation)
6
- * - confirmUpload mutation (upload verification + status transition)
5
+ * - requestUploadUrl mutation (presigned PUT URL generation + dedup)
7
6
  * - downloadUrl computed field (presigned GET URL / public URL)
8
7
  *
9
8
  * @example
package/esm/plugin.d.ts CHANGED
@@ -5,13 +5,9 @@
5
5
  *
6
6
  * 1. `requestUploadUrl` mutation — generates a presigned PUT URL for direct
7
7
  * client-to-S3 upload. Checks bucket access via RLS, deduplicates by
8
- * content hash, tracks the request in upload_requests.
8
+ * content hash via UNIQUE(bucket_id, key) constraint.
9
9
  *
10
- * 2. `confirmUpload` mutation confirms a file was uploaded to S3, verifies
11
- * the object exists with correct content-type, transitions file status
12
- * from 'pending' to 'ready'.
13
- *
14
- * 3. `downloadUrl` computed field on File types — generates presigned GET URLs
10
+ * 2. `downloadUrl` computed field on File types generates presigned GET URLs
15
11
  * for private files, returns public URL prefix + key for public files.
16
12
  *
17
13
  * Uses the extendSchema + grafast plan pattern (same as PublicKeySignature).