graphile-settings 4.1.1 → 4.3.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/index.d.ts +1 -2
- package/esm/index.js +2 -4
- package/esm/plugins/index.d.ts +4 -13
- package/esm/plugins/index.js +5 -21
- package/esm/presets/constructive-preset.d.ts +4 -0
- package/esm/presets/constructive-preset.js +17 -9
- package/esm/upload-resolver.d.ts +43 -0
- package/esm/upload-resolver.js +168 -0
- package/index.d.ts +1 -2
- package/index.js +4 -7
- package/package.json +14 -6
- package/plugins/index.d.ts +4 -13
- package/plugins/index.js +32 -44
- package/presets/constructive-preset.d.ts +4 -0
- package/presets/constructive-preset.js +26 -18
- package/upload-resolver.d.ts +43 -0
- package/upload-resolver.js +175 -0
- package/esm/plugins/conflict-detector.d.ts +0 -7
- package/esm/plugins/conflict-detector.js +0 -67
- package/esm/plugins/custom-inflector.d.ts +0 -9
- package/esm/plugins/custom-inflector.js +0 -382
- package/esm/plugins/enable-all-filter-columns.d.ts +0 -60
- package/esm/plugins/enable-all-filter-columns.js +0 -85
- package/esm/plugins/inflector-logger.d.ts +0 -7
- package/esm/plugins/inflector-logger.js +0 -215
- package/esm/plugins/many-to-many-preset.d.ts +0 -62
- package/esm/plugins/many-to-many-preset.js +0 -86
- package/esm/plugins/meta-schema/cache.d.ts +0 -4
- package/esm/plugins/meta-schema/cache.js +0 -7
- package/esm/plugins/meta-schema/constraint-meta-builders.d.ts +0 -13
- package/esm/plugins/meta-schema/constraint-meta-builders.js +0 -51
- package/esm/plugins/meta-schema/graphql-meta-field.d.ts +0 -4
- package/esm/plugins/meta-schema/graphql-meta-field.js +0 -201
- package/esm/plugins/meta-schema/inflection-utils.d.ts +0 -4
- package/esm/plugins/meta-schema/inflection-utils.js +0 -20
- package/esm/plugins/meta-schema/name-meta-builders.d.ts +0 -4
- package/esm/plugins/meta-schema/name-meta-builders.js +0 -38
- package/esm/plugins/meta-schema/plugin.d.ts +0 -2
- package/esm/plugins/meta-schema/plugin.js +0 -23
- package/esm/plugins/meta-schema/relation-meta-builders.d.ts +0 -8
- package/esm/plugins/meta-schema/relation-meta-builders.js +0 -115
- package/esm/plugins/meta-schema/table-meta-builder.d.ts +0 -2
- package/esm/plugins/meta-schema/table-meta-builder.js +0 -69
- package/esm/plugins/meta-schema/table-meta-context.d.ts +0 -13
- package/esm/plugins/meta-schema/table-meta-context.js +0 -11
- package/esm/plugins/meta-schema/table-resource-utils.d.ts +0 -12
- package/esm/plugins/meta-schema/table-resource-utils.js +0 -50
- package/esm/plugins/meta-schema/type-mappings.d.ts +0 -3
- package/esm/plugins/meta-schema/type-mappings.js +0 -75
- package/esm/plugins/meta-schema/types.d.ts +0 -206
- package/esm/plugins/meta-schema/types.js +0 -1
- package/esm/plugins/meta-schema.d.ts +0 -19
- package/esm/plugins/meta-schema.js +0 -20
- package/esm/plugins/minimal-preset.d.ts +0 -7
- package/esm/plugins/minimal-preset.js +0 -42
- package/esm/plugins/pg-type-mappings.d.ts +0 -41
- package/esm/plugins/pg-type-mappings.js +0 -122
- package/esm/plugins/primary-key-only.d.ts +0 -96
- package/esm/plugins/primary-key-only.js +0 -143
- package/plugins/conflict-detector.d.ts +0 -7
- package/plugins/conflict-detector.js +0 -70
- package/plugins/custom-inflector.d.ts +0 -9
- package/plugins/custom-inflector.js +0 -385
- package/plugins/enable-all-filter-columns.d.ts +0 -60
- package/plugins/enable-all-filter-columns.js +0 -88
- package/plugins/inflector-logger.d.ts +0 -7
- package/plugins/inflector-logger.js +0 -218
- package/plugins/many-to-many-preset.d.ts +0 -62
- package/plugins/many-to-many-preset.js +0 -89
- package/plugins/meta-schema/cache.d.ts +0 -4
- package/plugins/meta-schema/cache.js +0 -12
- package/plugins/meta-schema/constraint-meta-builders.d.ts +0 -13
- package/plugins/meta-schema/constraint-meta-builders.js +0 -58
- package/plugins/meta-schema/graphql-meta-field.d.ts +0 -4
- package/plugins/meta-schema/graphql-meta-field.js +0 -204
- package/plugins/meta-schema/inflection-utils.d.ts +0 -4
- package/plugins/meta-schema/inflection-utils.js +0 -25
- package/plugins/meta-schema/name-meta-builders.d.ts +0 -4
- package/plugins/meta-schema/name-meta-builders.js +0 -43
- package/plugins/meta-schema/plugin.d.ts +0 -2
- package/plugins/meta-schema/plugin.js +0 -26
- package/plugins/meta-schema/relation-meta-builders.d.ts +0 -8
- package/plugins/meta-schema/relation-meta-builders.js +0 -120
- package/plugins/meta-schema/table-meta-builder.d.ts +0 -2
- package/plugins/meta-schema/table-meta-builder.js +0 -72
- package/plugins/meta-schema/table-meta-context.d.ts +0 -13
- package/plugins/meta-schema/table-meta-context.js +0 -15
- package/plugins/meta-schema/table-resource-utils.d.ts +0 -12
- package/plugins/meta-schema/table-resource-utils.js +0 -60
- package/plugins/meta-schema/type-mappings.d.ts +0 -3
- package/plugins/meta-schema/type-mappings.js +0 -79
- package/plugins/meta-schema/types.d.ts +0 -206
- package/plugins/meta-schema/types.js +0 -2
- package/plugins/meta-schema.d.ts +0 -19
- package/plugins/meta-schema.js +0 -20
- package/plugins/minimal-preset.d.ts +0 -7
- package/plugins/minimal-preset.js +0 -45
- package/plugins/pg-type-mappings.d.ts +0 -41
- package/plugins/pg-type-mappings.js +0 -128
- package/plugins/primary-key-only.d.ts +0 -96
- package/plugins/primary-key-only.js +0 -147
package/esm/index.d.ts
CHANGED
|
@@ -32,6 +32,5 @@ import 'graphile-build';
|
|
|
32
32
|
export { ConstructivePreset } from './presets/constructive-preset';
|
|
33
33
|
export * from './plugins/index';
|
|
34
34
|
export * from './presets/index';
|
|
35
|
-
import { MinimalPreset } from './plugins/minimal-preset';
|
|
36
|
-
export { MinimalPreset };
|
|
37
35
|
export { makePgService };
|
|
36
|
+
export { streamToStorage } from './upload-resolver';
|
package/esm/index.js
CHANGED
|
@@ -46,9 +46,7 @@ export * from './presets/index';
|
|
|
46
46
|
// ============================================================================
|
|
47
47
|
// Utilities
|
|
48
48
|
// ============================================================================
|
|
49
|
-
// Import the new MinimalPreset from plugins
|
|
50
|
-
import { MinimalPreset } from './plugins/minimal-preset';
|
|
51
|
-
// Re-export MinimalPreset for backward compatibility
|
|
52
|
-
export { MinimalPreset };
|
|
53
49
|
// Re-export makePgService for convenience
|
|
54
50
|
export { makePgService };
|
|
51
|
+
// Upload utilities
|
|
52
|
+
export { streamToStorage } from './upload-resolver';
|
package/esm/plugins/index.d.ts
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PostGraphile v5 Plugins
|
|
3
3
|
*
|
|
4
|
-
* This module exports all custom plugins
|
|
5
|
-
*
|
|
4
|
+
* This module re-exports all custom plugins.
|
|
5
|
+
* Plugin implementations have been moved to graphile-misc-plugins.
|
|
6
6
|
*/
|
|
7
|
-
export { MinimalPreset } from '
|
|
8
|
-
export {
|
|
9
|
-
export { ConflictDetectorPlugin, ConflictDetectorPreset, } from './conflict-detector';
|
|
10
|
-
export { InflectorLoggerPlugin, InflectorLoggerPreset, } from './inflector-logger';
|
|
11
|
-
export { EnableAllFilterColumnsPlugin, EnableAllFilterColumnsPreset, } from './enable-all-filter-columns';
|
|
12
|
-
export { ManyToManyOptInPlugin, ManyToManyOptInPreset, } from './many-to-many-preset';
|
|
13
|
-
export { createUniqueLookupPlugin, PrimaryKeyOnlyPlugin, NoUniqueLookupPlugin, PrimaryKeyOnlyPreset, NoUniqueLookupPreset, } from './primary-key-only';
|
|
14
|
-
export type { UniqueLookupOptions } from './primary-key-only';
|
|
15
|
-
export { MetaSchemaPlugin, MetaSchemaPreset, } from './meta-schema';
|
|
16
|
-
export { PgTypeMappingsPlugin, PgTypeMappingsPreset, } from './pg-type-mappings';
|
|
17
|
-
export type { TypeMapping } from './pg-type-mappings';
|
|
7
|
+
export { MinimalPreset, InflektPlugin, InflektPreset, CustomInflectorPlugin, CustomInflectorPreset, ConflictDetectorPlugin, ConflictDetectorPreset, InflectorLoggerPlugin, InflectorLoggerPreset, EnableAllFilterColumnsPlugin, EnableAllFilterColumnsPreset, ManyToManyOptInPlugin, ManyToManyOptInPreset, createUniqueLookupPlugin, PrimaryKeyOnlyPlugin, NoUniqueLookupPlugin, PrimaryKeyOnlyPreset, NoUniqueLookupPreset, MetaSchemaPlugin, MetaSchemaPreset, PgTypeMappingsPlugin, PgTypeMappingsPreset, PublicKeySignature, _cachedTablesMeta, _pgTypeToGqlType, _buildFieldMeta, } from 'graphile-misc-plugins';
|
|
8
|
+
export type { UniqueLookupOptions, TypeMapping, PublicKeyChallengeConfig } from 'graphile-misc-plugins';
|
|
18
9
|
export { PgSearchPlugin, PgSearchPreset, createPgSearchPlugin, TsvectorCodecPlugin, TsvectorCodecPreset, } from 'graphile-search-plugin';
|
|
19
10
|
export type { PgSearchPluginOptions } from 'graphile-search-plugin';
|
package/esm/plugins/index.js
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PostGraphile v5 Plugins
|
|
3
3
|
*
|
|
4
|
-
* This module exports all custom plugins
|
|
5
|
-
*
|
|
4
|
+
* This module re-exports all custom plugins.
|
|
5
|
+
* Plugin implementations have been moved to graphile-misc-plugins.
|
|
6
6
|
*/
|
|
7
|
-
//
|
|
8
|
-
export { MinimalPreset } from '
|
|
9
|
-
//
|
|
10
|
-
export { InflektPlugin, InflektPreset, CustomInflectorPlugin, CustomInflectorPreset, } from './custom-inflector';
|
|
11
|
-
// Conflict detector for multi-schema setups
|
|
12
|
-
export { ConflictDetectorPlugin, ConflictDetectorPreset, } from './conflict-detector';
|
|
13
|
-
// Inflector logger for debugging
|
|
14
|
-
export { InflectorLoggerPlugin, InflectorLoggerPreset, } from './inflector-logger';
|
|
15
|
-
// Enable filtering on all columns (not just indexed)
|
|
16
|
-
export { EnableAllFilterColumnsPlugin, EnableAllFilterColumnsPreset, } from './enable-all-filter-columns';
|
|
17
|
-
// Many-to-many with opt-in behavior
|
|
18
|
-
export { ManyToManyOptInPlugin, ManyToManyOptInPreset, } from './many-to-many-preset';
|
|
19
|
-
// Primary key only lookups (disable non-PK unique constraints)
|
|
20
|
-
export { createUniqueLookupPlugin, PrimaryKeyOnlyPlugin, NoUniqueLookupPlugin, PrimaryKeyOnlyPreset, NoUniqueLookupPreset, } from './primary-key-only';
|
|
21
|
-
// Meta schema plugin for introspection (tables, fields, indexes, constraints)
|
|
22
|
-
export { MetaSchemaPlugin, MetaSchemaPreset, } from './meta-schema';
|
|
23
|
-
// PG type mappings for custom PostgreSQL types (email, url, etc.)
|
|
24
|
-
export { PgTypeMappingsPlugin, PgTypeMappingsPreset, } from './pg-type-mappings';
|
|
25
|
-
// Search plugin for tsvector full-text search conditions (includes TsvectorCodec)
|
|
7
|
+
// Re-export all plugins from graphile-misc-plugins
|
|
8
|
+
export { MinimalPreset, InflektPlugin, InflektPreset, CustomInflectorPlugin, CustomInflectorPreset, ConflictDetectorPlugin, ConflictDetectorPreset, InflectorLoggerPlugin, InflectorLoggerPreset, EnableAllFilterColumnsPlugin, EnableAllFilterColumnsPreset, ManyToManyOptInPlugin, ManyToManyOptInPreset, createUniqueLookupPlugin, PrimaryKeyOnlyPlugin, NoUniqueLookupPlugin, PrimaryKeyOnlyPreset, NoUniqueLookupPreset, MetaSchemaPlugin, MetaSchemaPreset, PgTypeMappingsPlugin, PgTypeMappingsPreset, PublicKeySignature, _cachedTablesMeta, _pgTypeToGqlType, _buildFieldMeta, } from 'graphile-misc-plugins';
|
|
9
|
+
// Search plugin (stays in graphile-search-plugin, re-exported here for convenience)
|
|
26
10
|
export { PgSearchPlugin, PgSearchPreset, createPgSearchPlugin, TsvectorCodecPlugin, TsvectorCodecPreset, } from 'graphile-search-plugin';
|
|
@@ -14,6 +14,10 @@ import type { GraphileConfig } from 'graphile-config';
|
|
|
14
14
|
* - Connection filter plugin with all columns filterable
|
|
15
15
|
* - Many-to-many relationships (opt-in via @behavior +manyToMany)
|
|
16
16
|
* - Meta schema plugin (_meta query for introspection of tables, fields, indexes)
|
|
17
|
+
* - PostGIS support (geometry/geography types, GeoJSON scalar — auto-detects PostGIS extension)
|
|
18
|
+
* - PostGIS connection filter operators (spatial filtering on geometry/geography columns)
|
|
19
|
+
* - Upload plugin (file upload to S3/MinIO for image, upload, attachment domain columns)
|
|
20
|
+
* - SQL expression validator (validates @sqlExpression columns in mutations)
|
|
17
21
|
* - PG type mappings (maps custom types like email, url to GraphQL scalars)
|
|
18
22
|
*
|
|
19
23
|
* DISABLED PLUGINS:
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { PostGraphileConnectionFilterPreset } from 'postgraphile-plugin-connection-filter';
|
|
2
|
-
import { MinimalPreset } from '
|
|
3
|
-
import { InflektPreset } from '../plugins/custom-inflector';
|
|
4
|
-
import { ConflictDetectorPreset } from '../plugins/conflict-detector';
|
|
5
|
-
import { InflectorLoggerPreset } from '../plugins/inflector-logger';
|
|
6
|
-
import { NoUniqueLookupPreset } from '../plugins/primary-key-only';
|
|
7
|
-
import { EnableAllFilterColumnsPreset } from '../plugins/enable-all-filter-columns';
|
|
8
|
-
import { ManyToManyOptInPreset } from '../plugins/many-to-many-preset';
|
|
9
|
-
import { MetaSchemaPreset } from '../plugins/meta-schema';
|
|
2
|
+
import { MinimalPreset, InflektPreset, ConflictDetectorPreset, InflectorLoggerPreset, NoUniqueLookupPreset, EnableAllFilterColumnsPreset, ManyToManyOptInPreset, MetaSchemaPreset, PgTypeMappingsPreset, } from 'graphile-misc-plugins';
|
|
10
3
|
import { PgSearchPreset } from 'graphile-search-plugin';
|
|
11
|
-
import {
|
|
4
|
+
import { GraphilePostgisPreset } from 'graphile-postgis';
|
|
5
|
+
import { PostgisConnectionFilterPreset } from 'graphile-plugin-connection-filter-postgis';
|
|
6
|
+
import { UploadPreset } from 'graphile-upload-plugin';
|
|
7
|
+
import { SqlExpressionValidatorPreset } from 'graphile-sql-expression-validator';
|
|
8
|
+
import { constructiveUploadFieldDefinitions } from '../upload-resolver';
|
|
12
9
|
/**
|
|
13
10
|
* Constructive PostGraphile v5 Preset
|
|
14
11
|
*
|
|
@@ -24,6 +21,10 @@ import { PgTypeMappingsPreset } from '../plugins/pg-type-mappings';
|
|
|
24
21
|
* - Connection filter plugin with all columns filterable
|
|
25
22
|
* - Many-to-many relationships (opt-in via @behavior +manyToMany)
|
|
26
23
|
* - Meta schema plugin (_meta query for introspection of tables, fields, indexes)
|
|
24
|
+
* - PostGIS support (geometry/geography types, GeoJSON scalar — auto-detects PostGIS extension)
|
|
25
|
+
* - PostGIS connection filter operators (spatial filtering on geometry/geography columns)
|
|
26
|
+
* - Upload plugin (file upload to S3/MinIO for image, upload, attachment domain columns)
|
|
27
|
+
* - SQL expression validator (validates @sqlExpression columns in mutations)
|
|
27
28
|
* - PG type mappings (maps custom types like email, url to GraphQL scalars)
|
|
28
29
|
*
|
|
29
30
|
* DISABLED PLUGINS:
|
|
@@ -58,6 +59,13 @@ export const ConstructivePreset = {
|
|
|
58
59
|
ManyToManyOptInPreset,
|
|
59
60
|
MetaSchemaPreset,
|
|
60
61
|
PgSearchPreset({ pgSearchPrefix: 'fullText' }),
|
|
62
|
+
GraphilePostgisPreset,
|
|
63
|
+
PostgisConnectionFilterPreset,
|
|
64
|
+
UploadPreset({
|
|
65
|
+
uploadFieldDefinitions: constructiveUploadFieldDefinitions,
|
|
66
|
+
maxFileSize: 10 * 1024 * 1024, // 10MB
|
|
67
|
+
}),
|
|
68
|
+
SqlExpressionValidatorPreset(),
|
|
61
69
|
PgTypeMappingsPreset,
|
|
62
70
|
],
|
|
63
71
|
/**
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload resolver for the Constructive upload plugin.
|
|
3
|
+
*
|
|
4
|
+
* Reads CDN/S3/MinIO configuration from environment variables (via getEnvOptions)
|
|
5
|
+
* and streams uploaded files to the configured storage backend.
|
|
6
|
+
*
|
|
7
|
+
* Lazily initializes the S3 streamer on first upload to avoid requiring
|
|
8
|
+
* env vars at module load time.
|
|
9
|
+
*
|
|
10
|
+
* ENV VARS:
|
|
11
|
+
* BUCKET_PROVIDER - 'minio' | 's3' (default: 'minio')
|
|
12
|
+
* BUCKET_NAME - bucket name (default: 'test-bucket')
|
|
13
|
+
* AWS_REGION - AWS region (default: 'us-east-1')
|
|
14
|
+
* AWS_ACCESS_KEY - access key (default: 'minioadmin')
|
|
15
|
+
* AWS_SECRET_KEY - secret key (default: 'minioadmin')
|
|
16
|
+
* MINIO_ENDPOINT - MinIO endpoint (default: 'http://localhost:9000')
|
|
17
|
+
*/
|
|
18
|
+
import type { Readable } from 'stream';
|
|
19
|
+
import type { UploadFieldDefinition } from 'graphile-upload-plugin';
|
|
20
|
+
/**
|
|
21
|
+
* Streams a file to S3/MinIO storage and returns the URL and metadata.
|
|
22
|
+
*
|
|
23
|
+
* Reusable by both the GraphQL upload resolver and REST /upload endpoint.
|
|
24
|
+
*/
|
|
25
|
+
export declare function streamToStorage(readStream: Readable, filename: string): Promise<{
|
|
26
|
+
url: string;
|
|
27
|
+
filename: string;
|
|
28
|
+
mime: string;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Upload field definitions for Constructive's three upload domain types.
|
|
32
|
+
*
|
|
33
|
+
* These match columns whose PostgreSQL type is one of the domains defined
|
|
34
|
+
* in constructive-db/pgpm-modules/types/:
|
|
35
|
+
*
|
|
36
|
+
* - `image` (public schema) — jsonb domain for images with versions
|
|
37
|
+
* - `upload` (public schema) — jsonb domain for generic file uploads
|
|
38
|
+
* - `attachment` (public schema) — text domain for simple URL attachments
|
|
39
|
+
*
|
|
40
|
+
* These domain types are part of the platform's core type system, deployed
|
|
41
|
+
* to every application database. They rarely change, so this config is stable.
|
|
42
|
+
*/
|
|
43
|
+
export declare const constructiveUploadFieldDefinitions: UploadFieldDefinition[];
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload resolver for the Constructive upload plugin.
|
|
3
|
+
*
|
|
4
|
+
* Reads CDN/S3/MinIO configuration from environment variables (via getEnvOptions)
|
|
5
|
+
* and streams uploaded files to the configured storage backend.
|
|
6
|
+
*
|
|
7
|
+
* Lazily initializes the S3 streamer on first upload to avoid requiring
|
|
8
|
+
* env vars at module load time.
|
|
9
|
+
*
|
|
10
|
+
* ENV VARS:
|
|
11
|
+
* BUCKET_PROVIDER - 'minio' | 's3' (default: 'minio')
|
|
12
|
+
* BUCKET_NAME - bucket name (default: 'test-bucket')
|
|
13
|
+
* AWS_REGION - AWS region (default: 'us-east-1')
|
|
14
|
+
* AWS_ACCESS_KEY - access key (default: 'minioadmin')
|
|
15
|
+
* AWS_SECRET_KEY - secret key (default: 'minioadmin')
|
|
16
|
+
* MINIO_ENDPOINT - MinIO endpoint (default: 'http://localhost:9000')
|
|
17
|
+
*/
|
|
18
|
+
import Streamer from '@constructive-io/s3-streamer';
|
|
19
|
+
import uploadNames from '@constructive-io/upload-names';
|
|
20
|
+
import { getEnvOptions } from '@constructive-io/graphql-env';
|
|
21
|
+
import { Logger } from '@pgpmjs/logger';
|
|
22
|
+
import { randomBytes } from 'crypto';
|
|
23
|
+
const log = new Logger('upload-resolver');
|
|
24
|
+
const DEFAULT_IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/svg+xml'];
|
|
25
|
+
let streamer = null;
|
|
26
|
+
let bucketName;
|
|
27
|
+
function getStreamer() {
|
|
28
|
+
if (streamer)
|
|
29
|
+
return streamer;
|
|
30
|
+
const opts = getEnvOptions();
|
|
31
|
+
const cdn = opts.cdn || {};
|
|
32
|
+
const provider = cdn.provider || 'minio';
|
|
33
|
+
bucketName = cdn.bucketName || 'test-bucket';
|
|
34
|
+
const awsRegion = cdn.awsRegion || 'us-east-1';
|
|
35
|
+
const awsAccessKey = cdn.awsAccessKey || 'minioadmin';
|
|
36
|
+
const awsSecretKey = cdn.awsSecretKey || 'minioadmin';
|
|
37
|
+
const minioEndpoint = cdn.minioEndpoint || 'http://localhost:9000';
|
|
38
|
+
if (process.env.NODE_ENV === 'production') {
|
|
39
|
+
if (!cdn.awsAccessKey || !cdn.awsSecretKey) {
|
|
40
|
+
log.warn('[upload-resolver] WARNING: Using default credentials in production.');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
log.info(`[upload-resolver] Initializing: provider=${provider} bucket=${bucketName}`);
|
|
44
|
+
streamer = new Streamer({
|
|
45
|
+
defaultBucket: bucketName,
|
|
46
|
+
awsRegion,
|
|
47
|
+
awsSecretKey,
|
|
48
|
+
awsAccessKey,
|
|
49
|
+
minioEndpoint,
|
|
50
|
+
provider,
|
|
51
|
+
});
|
|
52
|
+
return streamer;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Generates a randomized storage key from a filename.
|
|
56
|
+
* Format: {random10chars}-{sanitized-filename}
|
|
57
|
+
*/
|
|
58
|
+
function generateKey(filename) {
|
|
59
|
+
const rand = randomBytes(12).toString('hex');
|
|
60
|
+
return `${rand}-${uploadNames(filename)}`;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Streams a file to S3/MinIO storage and returns the URL and metadata.
|
|
64
|
+
*
|
|
65
|
+
* Reusable by both the GraphQL upload resolver and REST /upload endpoint.
|
|
66
|
+
*/
|
|
67
|
+
export async function streamToStorage(readStream, filename) {
|
|
68
|
+
const s3 = getStreamer();
|
|
69
|
+
const key = generateKey(filename);
|
|
70
|
+
const result = await s3.upload({
|
|
71
|
+
readStream,
|
|
72
|
+
filename,
|
|
73
|
+
key,
|
|
74
|
+
bucket: bucketName,
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
url: result.upload.Location,
|
|
78
|
+
filename,
|
|
79
|
+
mime: result.contentType,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Upload resolver that streams files to S3/MinIO.
|
|
84
|
+
*
|
|
85
|
+
* Returns different shapes based on the column's type hint:
|
|
86
|
+
* - 'image' / 'upload' → { filename, mime, url } (for jsonb domain columns)
|
|
87
|
+
* - 'attachment' / default → url string (for text domain columns)
|
|
88
|
+
*
|
|
89
|
+
* MIME validation happens before persistence: content type is detected from
|
|
90
|
+
* stream bytes, validated against smart-tag/type rules, and only then uploaded.
|
|
91
|
+
*/
|
|
92
|
+
async function uploadResolver(upload, _args, _context, info) {
|
|
93
|
+
const { tags, type } = info.uploadPlugin;
|
|
94
|
+
const s3 = getStreamer();
|
|
95
|
+
const { filename } = upload;
|
|
96
|
+
const key = generateKey(filename);
|
|
97
|
+
// MIME type validation from smart tags
|
|
98
|
+
const typ = type || tags?.type;
|
|
99
|
+
const VALID_MIME = /^[a-z]+\/[a-z0-9][a-z0-9!#$&\-.^_+]*$/i;
|
|
100
|
+
const mim = tags?.mime
|
|
101
|
+
? String(tags.mime)
|
|
102
|
+
.trim()
|
|
103
|
+
.split(',')
|
|
104
|
+
.map((a) => a.trim())
|
|
105
|
+
.filter((m) => VALID_MIME.test(m))
|
|
106
|
+
: typ === 'image'
|
|
107
|
+
? DEFAULT_IMAGE_MIME_TYPES
|
|
108
|
+
: [];
|
|
109
|
+
const detected = await s3.detectContentType({
|
|
110
|
+
readStream: upload.createReadStream(),
|
|
111
|
+
filename,
|
|
112
|
+
});
|
|
113
|
+
const detectedContentType = detected.contentType;
|
|
114
|
+
if (mim.length && !mim.includes(detectedContentType)) {
|
|
115
|
+
detected.stream.destroy();
|
|
116
|
+
throw new Error('UPLOAD_MIMETYPE');
|
|
117
|
+
}
|
|
118
|
+
const result = await s3.uploadWithContentType({
|
|
119
|
+
readStream: detected.stream,
|
|
120
|
+
contentType: detectedContentType,
|
|
121
|
+
magic: detected.magic,
|
|
122
|
+
key,
|
|
123
|
+
bucket: bucketName,
|
|
124
|
+
});
|
|
125
|
+
const url = result.upload.Location;
|
|
126
|
+
const { contentType } = result;
|
|
127
|
+
switch (typ) {
|
|
128
|
+
case 'image':
|
|
129
|
+
case 'upload':
|
|
130
|
+
return { filename, mime: contentType, url };
|
|
131
|
+
case 'attachment':
|
|
132
|
+
default:
|
|
133
|
+
return url;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Upload field definitions for Constructive's three upload domain types.
|
|
138
|
+
*
|
|
139
|
+
* These match columns whose PostgreSQL type is one of the domains defined
|
|
140
|
+
* in constructive-db/pgpm-modules/types/:
|
|
141
|
+
*
|
|
142
|
+
* - `image` (public schema) — jsonb domain for images with versions
|
|
143
|
+
* - `upload` (public schema) — jsonb domain for generic file uploads
|
|
144
|
+
* - `attachment` (public schema) — text domain for simple URL attachments
|
|
145
|
+
*
|
|
146
|
+
* These domain types are part of the platform's core type system, deployed
|
|
147
|
+
* to every application database. They rarely change, so this config is stable.
|
|
148
|
+
*/
|
|
149
|
+
export const constructiveUploadFieldDefinitions = [
|
|
150
|
+
{
|
|
151
|
+
name: 'image',
|
|
152
|
+
namespaceName: 'public',
|
|
153
|
+
type: 'image',
|
|
154
|
+
resolve: uploadResolver,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: 'upload',
|
|
158
|
+
namespaceName: 'public',
|
|
159
|
+
type: 'upload',
|
|
160
|
+
resolve: uploadResolver,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'attachment',
|
|
164
|
+
namespaceName: 'public',
|
|
165
|
+
type: 'attachment',
|
|
166
|
+
resolve: uploadResolver,
|
|
167
|
+
},
|
|
168
|
+
];
|
package/index.d.ts
CHANGED
|
@@ -32,6 +32,5 @@ import 'graphile-build';
|
|
|
32
32
|
export { ConstructivePreset } from './presets/constructive-preset';
|
|
33
33
|
export * from './plugins/index';
|
|
34
34
|
export * from './presets/index';
|
|
35
|
-
import { MinimalPreset } from './plugins/minimal-preset';
|
|
36
|
-
export { MinimalPreset };
|
|
37
35
|
export { makePgService };
|
|
36
|
+
export { streamToStorage } from './upload-resolver';
|
package/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
42
42
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.
|
|
45
|
+
exports.streamToStorage = exports.makePgService = exports.ConstructivePreset = void 0;
|
|
46
46
|
const pg_1 = require("postgraphile/adaptors/pg");
|
|
47
47
|
Object.defineProperty(exports, "makePgService", { enumerable: true, get: function () { return pg_1.makePgService; } });
|
|
48
48
|
// Import modules for type augmentation
|
|
@@ -62,9 +62,6 @@ Object.defineProperty(exports, "ConstructivePreset", { enumerable: true, get: fu
|
|
|
62
62
|
__exportStar(require("./plugins/index"), exports);
|
|
63
63
|
// Re-export presets
|
|
64
64
|
__exportStar(require("./presets/index"), exports);
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// Import the new MinimalPreset from plugins
|
|
69
|
-
const minimal_preset_1 = require("./plugins/minimal-preset");
|
|
70
|
-
Object.defineProperty(exports, "MinimalPreset", { enumerable: true, get: function () { return minimal_preset_1.MinimalPreset; } });
|
|
65
|
+
// Upload utilities
|
|
66
|
+
var upload_resolver_1 = require("./upload-resolver");
|
|
67
|
+
Object.defineProperty(exports, "streamToStorage", { enumerable: true, get: function () { return upload_resolver_1.streamToStorage; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-settings",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "graphile settings",
|
|
6
6
|
"main": "index.js",
|
|
@@ -29,12 +29,15 @@
|
|
|
29
29
|
"test:watch": "jest --watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@constructive-io/graphql-env": "^3.
|
|
33
|
-
"@constructive-io/graphql-types": "^3.
|
|
32
|
+
"@constructive-io/graphql-env": "^3.2.0",
|
|
33
|
+
"@constructive-io/graphql-types": "^3.1.0",
|
|
34
|
+
"@constructive-io/s3-streamer": "^2.14.0",
|
|
35
|
+
"@constructive-io/upload-names": "^2.7.0",
|
|
34
36
|
"@dataplan/json": "1.0.0-rc.5",
|
|
35
37
|
"@dataplan/pg": "1.0.0-rc.5",
|
|
36
38
|
"@graphile-contrib/pg-many-to-many": "2.0.0-rc.1",
|
|
37
|
-
"@pgpmjs/
|
|
39
|
+
"@pgpmjs/logger": "^2.2.0",
|
|
40
|
+
"@pgpmjs/types": "^2.17.0",
|
|
38
41
|
"cors": "^2.8.5",
|
|
39
42
|
"express": "^5.2.1",
|
|
40
43
|
"grafast": "1.0.0-rc.7",
|
|
@@ -42,7 +45,12 @@
|
|
|
42
45
|
"graphile-build": "5.0.0-rc.4",
|
|
43
46
|
"graphile-build-pg": "5.0.0-rc.5",
|
|
44
47
|
"graphile-config": "1.0.0-rc.5",
|
|
45
|
-
"graphile-
|
|
48
|
+
"graphile-misc-plugins": "^1.1.0",
|
|
49
|
+
"graphile-plugin-connection-filter-postgis": "^2.2.0",
|
|
50
|
+
"graphile-postgis": "^2.2.0",
|
|
51
|
+
"graphile-search-plugin": "^3.2.0",
|
|
52
|
+
"graphile-sql-expression-validator": "^2.2.0",
|
|
53
|
+
"graphile-upload-plugin": "^2.2.0",
|
|
46
54
|
"graphql": "^16.9.0",
|
|
47
55
|
"inflekt": "^0.3.0",
|
|
48
56
|
"lru-cache": "^11.2.4",
|
|
@@ -69,5 +77,5 @@
|
|
|
69
77
|
"constructive",
|
|
70
78
|
"graphql"
|
|
71
79
|
],
|
|
72
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "b758178b808ce0bf451e86c0bd7e92079155db7c"
|
|
73
81
|
}
|
package/plugins/index.d.ts
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PostGraphile v5 Plugins
|
|
3
3
|
*
|
|
4
|
-
* This module exports all custom plugins
|
|
5
|
-
*
|
|
4
|
+
* This module re-exports all custom plugins.
|
|
5
|
+
* Plugin implementations have been moved to graphile-misc-plugins.
|
|
6
6
|
*/
|
|
7
|
-
export { MinimalPreset } from '
|
|
8
|
-
export {
|
|
9
|
-
export { ConflictDetectorPlugin, ConflictDetectorPreset, } from './conflict-detector';
|
|
10
|
-
export { InflectorLoggerPlugin, InflectorLoggerPreset, } from './inflector-logger';
|
|
11
|
-
export { EnableAllFilterColumnsPlugin, EnableAllFilterColumnsPreset, } from './enable-all-filter-columns';
|
|
12
|
-
export { ManyToManyOptInPlugin, ManyToManyOptInPreset, } from './many-to-many-preset';
|
|
13
|
-
export { createUniqueLookupPlugin, PrimaryKeyOnlyPlugin, NoUniqueLookupPlugin, PrimaryKeyOnlyPreset, NoUniqueLookupPreset, } from './primary-key-only';
|
|
14
|
-
export type { UniqueLookupOptions } from './primary-key-only';
|
|
15
|
-
export { MetaSchemaPlugin, MetaSchemaPreset, } from './meta-schema';
|
|
16
|
-
export { PgTypeMappingsPlugin, PgTypeMappingsPreset, } from './pg-type-mappings';
|
|
17
|
-
export type { TypeMapping } from './pg-type-mappings';
|
|
7
|
+
export { MinimalPreset, InflektPlugin, InflektPreset, CustomInflectorPlugin, CustomInflectorPreset, ConflictDetectorPlugin, ConflictDetectorPreset, InflectorLoggerPlugin, InflectorLoggerPreset, EnableAllFilterColumnsPlugin, EnableAllFilterColumnsPreset, ManyToManyOptInPlugin, ManyToManyOptInPreset, createUniqueLookupPlugin, PrimaryKeyOnlyPlugin, NoUniqueLookupPlugin, PrimaryKeyOnlyPreset, NoUniqueLookupPreset, MetaSchemaPlugin, MetaSchemaPreset, PgTypeMappingsPlugin, PgTypeMappingsPreset, PublicKeySignature, _cachedTablesMeta, _pgTypeToGqlType, _buildFieldMeta, } from 'graphile-misc-plugins';
|
|
8
|
+
export type { UniqueLookupOptions, TypeMapping, PublicKeyChallengeConfig } from 'graphile-misc-plugins';
|
|
18
9
|
export { PgSearchPlugin, PgSearchPreset, createPgSearchPlugin, TsvectorCodecPlugin, TsvectorCodecPreset, } from 'graphile-search-plugin';
|
|
19
10
|
export type { PgSearchPluginOptions } from 'graphile-search-plugin';
|
package/plugins/index.js
CHANGED
|
@@ -2,52 +2,40 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* PostGraphile v5 Plugins
|
|
4
4
|
*
|
|
5
|
-
* This module exports all custom plugins
|
|
6
|
-
*
|
|
5
|
+
* This module re-exports all custom plugins.
|
|
6
|
+
* Plugin implementations have been moved to graphile-misc-plugins.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.TsvectorCodecPreset = exports.TsvectorCodecPlugin = exports.createPgSearchPlugin = exports.PgSearchPreset = exports.PgSearchPlugin = exports.PgTypeMappingsPreset = exports.PgTypeMappingsPlugin = exports.MetaSchemaPreset = exports.MetaSchemaPlugin = exports.NoUniqueLookupPreset = exports.PrimaryKeyOnlyPreset = exports.NoUniqueLookupPlugin = exports.PrimaryKeyOnlyPlugin = exports.createUniqueLookupPlugin = exports.ManyToManyOptInPreset = exports.ManyToManyOptInPlugin = exports.EnableAllFilterColumnsPreset = exports.EnableAllFilterColumnsPlugin = exports.InflectorLoggerPreset = exports.InflectorLoggerPlugin = exports.ConflictDetectorPreset = exports.ConflictDetectorPlugin = exports.CustomInflectorPreset = exports.CustomInflectorPlugin = exports.InflektPreset = exports.InflektPlugin = exports.MinimalPreset = void 0;
|
|
10
|
-
//
|
|
11
|
-
var
|
|
12
|
-
Object.defineProperty(exports, "MinimalPreset", { enumerable: true, get: function () { return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Object.defineProperty(exports, "
|
|
16
|
-
Object.defineProperty(exports, "
|
|
17
|
-
Object.defineProperty(exports, "
|
|
18
|
-
Object.defineProperty(exports, "
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Object.defineProperty(exports, "
|
|
22
|
-
Object.defineProperty(exports, "
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(exports, "
|
|
26
|
-
Object.defineProperty(exports, "
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Object.defineProperty(exports, "
|
|
30
|
-
Object.defineProperty(exports, "
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Object.defineProperty(exports, "
|
|
34
|
-
Object.defineProperty(exports, "
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Object.defineProperty(exports, "
|
|
38
|
-
|
|
39
|
-
Object.defineProperty(exports, "NoUniqueLookupPlugin", { enumerable: true, get: function () { return primary_key_only_1.NoUniqueLookupPlugin; } });
|
|
40
|
-
Object.defineProperty(exports, "PrimaryKeyOnlyPreset", { enumerable: true, get: function () { return primary_key_only_1.PrimaryKeyOnlyPreset; } });
|
|
41
|
-
Object.defineProperty(exports, "NoUniqueLookupPreset", { enumerable: true, get: function () { return primary_key_only_1.NoUniqueLookupPreset; } });
|
|
42
|
-
// Meta schema plugin for introspection (tables, fields, indexes, constraints)
|
|
43
|
-
var meta_schema_1 = require("./meta-schema");
|
|
44
|
-
Object.defineProperty(exports, "MetaSchemaPlugin", { enumerable: true, get: function () { return meta_schema_1.MetaSchemaPlugin; } });
|
|
45
|
-
Object.defineProperty(exports, "MetaSchemaPreset", { enumerable: true, get: function () { return meta_schema_1.MetaSchemaPreset; } });
|
|
46
|
-
// PG type mappings for custom PostgreSQL types (email, url, etc.)
|
|
47
|
-
var pg_type_mappings_1 = require("./pg-type-mappings");
|
|
48
|
-
Object.defineProperty(exports, "PgTypeMappingsPlugin", { enumerable: true, get: function () { return pg_type_mappings_1.PgTypeMappingsPlugin; } });
|
|
49
|
-
Object.defineProperty(exports, "PgTypeMappingsPreset", { enumerable: true, get: function () { return pg_type_mappings_1.PgTypeMappingsPreset; } });
|
|
50
|
-
// Search plugin for tsvector full-text search conditions (includes TsvectorCodec)
|
|
9
|
+
exports.TsvectorCodecPreset = exports.TsvectorCodecPlugin = exports.createPgSearchPlugin = exports.PgSearchPreset = exports.PgSearchPlugin = exports._buildFieldMeta = exports._pgTypeToGqlType = exports._cachedTablesMeta = exports.PublicKeySignature = exports.PgTypeMappingsPreset = exports.PgTypeMappingsPlugin = exports.MetaSchemaPreset = exports.MetaSchemaPlugin = exports.NoUniqueLookupPreset = exports.PrimaryKeyOnlyPreset = exports.NoUniqueLookupPlugin = exports.PrimaryKeyOnlyPlugin = exports.createUniqueLookupPlugin = exports.ManyToManyOptInPreset = exports.ManyToManyOptInPlugin = exports.EnableAllFilterColumnsPreset = exports.EnableAllFilterColumnsPlugin = exports.InflectorLoggerPreset = exports.InflectorLoggerPlugin = exports.ConflictDetectorPreset = exports.ConflictDetectorPlugin = exports.CustomInflectorPreset = exports.CustomInflectorPlugin = exports.InflektPreset = exports.InflektPlugin = exports.MinimalPreset = void 0;
|
|
10
|
+
// Re-export all plugins from graphile-misc-plugins
|
|
11
|
+
var graphile_misc_plugins_1 = require("graphile-misc-plugins");
|
|
12
|
+
Object.defineProperty(exports, "MinimalPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.MinimalPreset; } });
|
|
13
|
+
Object.defineProperty(exports, "InflektPlugin", { enumerable: true, get: function () { return graphile_misc_plugins_1.InflektPlugin; } });
|
|
14
|
+
Object.defineProperty(exports, "InflektPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.InflektPreset; } });
|
|
15
|
+
Object.defineProperty(exports, "CustomInflectorPlugin", { enumerable: true, get: function () { return graphile_misc_plugins_1.CustomInflectorPlugin; } });
|
|
16
|
+
Object.defineProperty(exports, "CustomInflectorPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.CustomInflectorPreset; } });
|
|
17
|
+
Object.defineProperty(exports, "ConflictDetectorPlugin", { enumerable: true, get: function () { return graphile_misc_plugins_1.ConflictDetectorPlugin; } });
|
|
18
|
+
Object.defineProperty(exports, "ConflictDetectorPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.ConflictDetectorPreset; } });
|
|
19
|
+
Object.defineProperty(exports, "InflectorLoggerPlugin", { enumerable: true, get: function () { return graphile_misc_plugins_1.InflectorLoggerPlugin; } });
|
|
20
|
+
Object.defineProperty(exports, "InflectorLoggerPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.InflectorLoggerPreset; } });
|
|
21
|
+
Object.defineProperty(exports, "EnableAllFilterColumnsPlugin", { enumerable: true, get: function () { return graphile_misc_plugins_1.EnableAllFilterColumnsPlugin; } });
|
|
22
|
+
Object.defineProperty(exports, "EnableAllFilterColumnsPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.EnableAllFilterColumnsPreset; } });
|
|
23
|
+
Object.defineProperty(exports, "ManyToManyOptInPlugin", { enumerable: true, get: function () { return graphile_misc_plugins_1.ManyToManyOptInPlugin; } });
|
|
24
|
+
Object.defineProperty(exports, "ManyToManyOptInPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.ManyToManyOptInPreset; } });
|
|
25
|
+
Object.defineProperty(exports, "createUniqueLookupPlugin", { enumerable: true, get: function () { return graphile_misc_plugins_1.createUniqueLookupPlugin; } });
|
|
26
|
+
Object.defineProperty(exports, "PrimaryKeyOnlyPlugin", { enumerable: true, get: function () { return graphile_misc_plugins_1.PrimaryKeyOnlyPlugin; } });
|
|
27
|
+
Object.defineProperty(exports, "NoUniqueLookupPlugin", { enumerable: true, get: function () { return graphile_misc_plugins_1.NoUniqueLookupPlugin; } });
|
|
28
|
+
Object.defineProperty(exports, "PrimaryKeyOnlyPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.PrimaryKeyOnlyPreset; } });
|
|
29
|
+
Object.defineProperty(exports, "NoUniqueLookupPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.NoUniqueLookupPreset; } });
|
|
30
|
+
Object.defineProperty(exports, "MetaSchemaPlugin", { enumerable: true, get: function () { return graphile_misc_plugins_1.MetaSchemaPlugin; } });
|
|
31
|
+
Object.defineProperty(exports, "MetaSchemaPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.MetaSchemaPreset; } });
|
|
32
|
+
Object.defineProperty(exports, "PgTypeMappingsPlugin", { enumerable: true, get: function () { return graphile_misc_plugins_1.PgTypeMappingsPlugin; } });
|
|
33
|
+
Object.defineProperty(exports, "PgTypeMappingsPreset", { enumerable: true, get: function () { return graphile_misc_plugins_1.PgTypeMappingsPreset; } });
|
|
34
|
+
Object.defineProperty(exports, "PublicKeySignature", { enumerable: true, get: function () { return graphile_misc_plugins_1.PublicKeySignature; } });
|
|
35
|
+
Object.defineProperty(exports, "_cachedTablesMeta", { enumerable: true, get: function () { return graphile_misc_plugins_1._cachedTablesMeta; } });
|
|
36
|
+
Object.defineProperty(exports, "_pgTypeToGqlType", { enumerable: true, get: function () { return graphile_misc_plugins_1._pgTypeToGqlType; } });
|
|
37
|
+
Object.defineProperty(exports, "_buildFieldMeta", { enumerable: true, get: function () { return graphile_misc_plugins_1._buildFieldMeta; } });
|
|
38
|
+
// Search plugin (stays in graphile-search-plugin, re-exported here for convenience)
|
|
51
39
|
var graphile_search_plugin_1 = require("graphile-search-plugin");
|
|
52
40
|
Object.defineProperty(exports, "PgSearchPlugin", { enumerable: true, get: function () { return graphile_search_plugin_1.PgSearchPlugin; } });
|
|
53
41
|
Object.defineProperty(exports, "PgSearchPreset", { enumerable: true, get: function () { return graphile_search_plugin_1.PgSearchPreset; } });
|
|
@@ -14,6 +14,10 @@ import type { GraphileConfig } from 'graphile-config';
|
|
|
14
14
|
* - Connection filter plugin with all columns filterable
|
|
15
15
|
* - Many-to-many relationships (opt-in via @behavior +manyToMany)
|
|
16
16
|
* - Meta schema plugin (_meta query for introspection of tables, fields, indexes)
|
|
17
|
+
* - PostGIS support (geometry/geography types, GeoJSON scalar — auto-detects PostGIS extension)
|
|
18
|
+
* - PostGIS connection filter operators (spatial filtering on geometry/geography columns)
|
|
19
|
+
* - Upload plugin (file upload to S3/MinIO for image, upload, attachment domain columns)
|
|
20
|
+
* - SQL expression validator (validates @sqlExpression columns in mutations)
|
|
17
21
|
* - PG type mappings (maps custom types like email, url to GraphQL scalars)
|
|
18
22
|
*
|
|
19
23
|
* DISABLED PLUGINS:
|
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConstructivePreset = void 0;
|
|
4
4
|
const postgraphile_plugin_connection_filter_1 = require("postgraphile-plugin-connection-filter");
|
|
5
|
-
const
|
|
6
|
-
const custom_inflector_1 = require("../plugins/custom-inflector");
|
|
7
|
-
const conflict_detector_1 = require("../plugins/conflict-detector");
|
|
8
|
-
const inflector_logger_1 = require("../plugins/inflector-logger");
|
|
9
|
-
const primary_key_only_1 = require("../plugins/primary-key-only");
|
|
10
|
-
const enable_all_filter_columns_1 = require("../plugins/enable-all-filter-columns");
|
|
11
|
-
const many_to_many_preset_1 = require("../plugins/many-to-many-preset");
|
|
12
|
-
const meta_schema_1 = require("../plugins/meta-schema");
|
|
5
|
+
const graphile_misc_plugins_1 = require("graphile-misc-plugins");
|
|
13
6
|
const graphile_search_plugin_1 = require("graphile-search-plugin");
|
|
14
|
-
const
|
|
7
|
+
const graphile_postgis_1 = require("graphile-postgis");
|
|
8
|
+
const graphile_plugin_connection_filter_postgis_1 = require("graphile-plugin-connection-filter-postgis");
|
|
9
|
+
const graphile_upload_plugin_1 = require("graphile-upload-plugin");
|
|
10
|
+
const graphile_sql_expression_validator_1 = require("graphile-sql-expression-validator");
|
|
11
|
+
const upload_resolver_1 = require("../upload-resolver");
|
|
15
12
|
/**
|
|
16
13
|
* Constructive PostGraphile v5 Preset
|
|
17
14
|
*
|
|
@@ -27,6 +24,10 @@ const pg_type_mappings_1 = require("../plugins/pg-type-mappings");
|
|
|
27
24
|
* - Connection filter plugin with all columns filterable
|
|
28
25
|
* - Many-to-many relationships (opt-in via @behavior +manyToMany)
|
|
29
26
|
* - Meta schema plugin (_meta query for introspection of tables, fields, indexes)
|
|
27
|
+
* - PostGIS support (geometry/geography types, GeoJSON scalar — auto-detects PostGIS extension)
|
|
28
|
+
* - PostGIS connection filter operators (spatial filtering on geometry/geography columns)
|
|
29
|
+
* - Upload plugin (file upload to S3/MinIO for image, upload, attachment domain columns)
|
|
30
|
+
* - SQL expression validator (validates @sqlExpression columns in mutations)
|
|
30
31
|
* - PG type mappings (maps custom types like email, url to GraphQL scalars)
|
|
31
32
|
*
|
|
32
33
|
* DISABLED PLUGINS:
|
|
@@ -51,17 +52,24 @@ const pg_type_mappings_1 = require("../plugins/pg-type-mappings");
|
|
|
51
52
|
*/
|
|
52
53
|
exports.ConstructivePreset = {
|
|
53
54
|
extends: [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
graphile_misc_plugins_1.MinimalPreset,
|
|
56
|
+
graphile_misc_plugins_1.ConflictDetectorPreset,
|
|
57
|
+
graphile_misc_plugins_1.InflektPreset,
|
|
58
|
+
graphile_misc_plugins_1.InflectorLoggerPreset,
|
|
59
|
+
graphile_misc_plugins_1.NoUniqueLookupPreset,
|
|
59
60
|
postgraphile_plugin_connection_filter_1.PostGraphileConnectionFilterPreset,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
graphile_misc_plugins_1.EnableAllFilterColumnsPreset,
|
|
62
|
+
graphile_misc_plugins_1.ManyToManyOptInPreset,
|
|
63
|
+
graphile_misc_plugins_1.MetaSchemaPreset,
|
|
63
64
|
(0, graphile_search_plugin_1.PgSearchPreset)({ pgSearchPrefix: 'fullText' }),
|
|
64
|
-
|
|
65
|
+
graphile_postgis_1.GraphilePostgisPreset,
|
|
66
|
+
graphile_plugin_connection_filter_postgis_1.PostgisConnectionFilterPreset,
|
|
67
|
+
(0, graphile_upload_plugin_1.UploadPreset)({
|
|
68
|
+
uploadFieldDefinitions: upload_resolver_1.constructiveUploadFieldDefinitions,
|
|
69
|
+
maxFileSize: 10 * 1024 * 1024, // 10MB
|
|
70
|
+
}),
|
|
71
|
+
(0, graphile_sql_expression_validator_1.SqlExpressionValidatorPreset)(),
|
|
72
|
+
graphile_misc_plugins_1.PgTypeMappingsPreset,
|
|
65
73
|
],
|
|
66
74
|
/**
|
|
67
75
|
* Disable relation filter plugins from postgraphile-plugin-connection-filter.
|