graphile-presigned-url-plugin 0.12.1 → 0.12.2

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 CHANGED
@@ -137,6 +137,11 @@ export function createPresignedUrlPlugin(options) {
137
137
  log.debug(`Skipping mutation entry point for ${codec.name}: no PgResource found`);
138
138
  continue;
139
139
  }
140
+ // Resolve the GraphQL type for ownerId from the codec's attribute codec
141
+ // (e.g. UUID scalar instead of String) so Grafast's type matching works.
142
+ const ownerIdType = hasOwnerId
143
+ ? build.getGraphQLTypeByPgCodec(codec.attributes.owner_id.codec, 'input')
144
+ : null;
140
145
  log.debug(`Adding mutation entry point "${fieldName}" for bucket type ${typeName} (entity-scoped=${hasOwnerId})`);
141
146
  newFields[fieldName] = context.fieldWithHooks({ fieldName }, {
142
147
  description: `Look up a ${typeName} by key for mutation operations (upload, etc.).`,
@@ -144,7 +149,7 @@ export function createPresignedUrlPlugin(options) {
144
149
  args: {
145
150
  key: { type: new GraphQLNonNull(GraphQLString), description: 'Bucket key (e.g., "public", "private")' },
146
151
  ...(hasOwnerId
147
- ? { ownerId: { type: new GraphQLNonNull(GraphQLString), description: 'Owner entity ID (required for entity-scoped buckets)' } }
152
+ ? { ownerId: { type: new GraphQLNonNull(ownerIdType || GraphQLString), description: 'Owner entity ID (required for entity-scoped buckets)' } }
148
153
  : {}),
149
154
  },
150
155
  plan(_$mutation, fieldArgs) {
@@ -95,6 +95,7 @@ export declare function resolveStorageConfigFromCodec(pgCodec: {
95
95
  extensions?: {
96
96
  pg?: {
97
97
  schemaName?: string;
98
+ name?: string;
98
99
  };
99
100
  };
100
101
  sqlType?: string;
@@ -296,7 +296,7 @@ export async function loadAllStorageModules(pgClient, databaseId) {
296
296
  */
297
297
  export function resolveStorageConfigFromCodec(pgCodec, allConfigs) {
298
298
  const schemaName = pgCodec.extensions?.pg?.schemaName;
299
- const tableName = pgCodec.name;
299
+ const tableName = pgCodec.extensions?.pg?.name ?? pgCodec.name;
300
300
  if (!schemaName || !tableName)
301
301
  return null;
302
302
  return allConfigs.find((c) => (c.filesTableName === tableName && c.schemaName === schemaName) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphile-presigned-url-plugin",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
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": "3491da5ae42fc87daf9b7c39c8735fcae51218a1"
63
+ "gitHead": "e1421fda3dabc22a37e42fd224d181bffb613779"
64
64
  }
package/plugin.js CHANGED
@@ -141,6 +141,11 @@ function createPresignedUrlPlugin(options) {
141
141
  log.debug(`Skipping mutation entry point for ${codec.name}: no PgResource found`);
142
142
  continue;
143
143
  }
144
+ // Resolve the GraphQL type for ownerId from the codec's attribute codec
145
+ // (e.g. UUID scalar instead of String) so Grafast's type matching works.
146
+ const ownerIdType = hasOwnerId
147
+ ? build.getGraphQLTypeByPgCodec(codec.attributes.owner_id.codec, 'input')
148
+ : null;
144
149
  log.debug(`Adding mutation entry point "${fieldName}" for bucket type ${typeName} (entity-scoped=${hasOwnerId})`);
145
150
  newFields[fieldName] = context.fieldWithHooks({ fieldName }, {
146
151
  description: `Look up a ${typeName} by key for mutation operations (upload, etc.).`,
@@ -148,7 +153,7 @@ function createPresignedUrlPlugin(options) {
148
153
  args: {
149
154
  key: { type: new GraphQLNonNull(GraphQLString), description: 'Bucket key (e.g., "public", "private")' },
150
155
  ...(hasOwnerId
151
- ? { ownerId: { type: new GraphQLNonNull(GraphQLString), description: 'Owner entity ID (required for entity-scoped buckets)' } }
156
+ ? { ownerId: { type: new GraphQLNonNull(ownerIdType || GraphQLString), description: 'Owner entity ID (required for entity-scoped buckets)' } }
152
157
  : {}),
153
158
  },
154
159
  plan(_$mutation, fieldArgs) {
@@ -95,6 +95,7 @@ export declare function resolveStorageConfigFromCodec(pgCodec: {
95
95
  extensions?: {
96
96
  pg?: {
97
97
  schemaName?: string;
98
+ name?: string;
98
99
  };
99
100
  };
100
101
  sqlType?: string;
@@ -308,7 +308,7 @@ async function loadAllStorageModules(pgClient, databaseId) {
308
308
  */
309
309
  function resolveStorageConfigFromCodec(pgCodec, allConfigs) {
310
310
  const schemaName = pgCodec.extensions?.pg?.schemaName;
311
- const tableName = pgCodec.name;
311
+ const tableName = pgCodec.extensions?.pg?.name ?? pgCodec.name;
312
312
  if (!schemaName || !tableName)
313
313
  return null;
314
314
  return allConfigs.find((c) => (c.filesTableName === tableName && c.schemaName === schemaName) ||