postgraphile-core
Advanced tools
Comparing version 4.2.0 to 4.3.0
import { Plugin, Options, SchemaListener, Build, Context, SchemaBuilder, Inflection } from "graphile-build"; | ||
import { GraphQLSchema } from "graphql"; | ||
import { inflections, Inflector, formatSQLForDebugging } from "graphile-build-pg"; | ||
import { formatSQLForDebugging } from "graphile-build-pg"; | ||
import { Pool, Client } from "pg"; | ||
@@ -20,3 +20,2 @@ export { Plugin, Build, Context, SchemaBuilder, SchemaListener, Inflection, Options, formatSQLForDebugging, }; | ||
jwtSecret?: string; | ||
inflector?: Inflector; | ||
pgColumnFilter?: <TSource>(attr: mixed, build: Build, context: Context<TSource>) => boolean; | ||
@@ -38,11 +37,7 @@ viewUniqueKey?: string; | ||
declare type PgConfig = Client | Pool | string; | ||
export { inflections }; | ||
export declare const postGraphileBaseOverrides: { | ||
enumName(value: string): any; | ||
}; | ||
export declare const postGraphileClassicIdsOverrides: { | ||
column(name: string, _table: string, _schema?: string | undefined): any; | ||
}; | ||
export declare const postGraphileInflection: any; | ||
export declare const postGraphileClassicIdsInflection: any; | ||
export declare const inflections: {}; | ||
export declare const postGraphileBaseOverrides: {}; | ||
export declare const postGraphileClassicIdsOverrides: {}; | ||
export declare const postGraphileInflection: {}; | ||
export declare const postGraphileClassicIdsInflection: {}; | ||
export declare const PostGraphileInflectionPlugin: Plugin; | ||
@@ -52,11 +47,7 @@ export declare const PostGraphileClassicIdsInflectionPlugin: Plugin; | ||
export declare const watchPostGraphileSchema: (pgConfig: PgConfig, schemas: string | string[], options: PostGraphileCoreOptions | undefined, onNewSchema: SchemaListener) => Promise<() => Promise<void>>; | ||
export declare const postGraphQLBaseOverrides: { | ||
enumName(value: string): any; | ||
}; | ||
export declare const postGraphQLClassicIdsOverrides: { | ||
column(name: string, _table: string, _schema?: string | undefined): any; | ||
}; | ||
export declare const postGraphQLInflection: any; | ||
export declare const postGraphQLClassicIdsInflection: any; | ||
export declare const postGraphQLBaseOverrides: {}; | ||
export declare const postGraphQLClassicIdsOverrides: {}; | ||
export declare const postGraphQLInflection: {}; | ||
export declare const postGraphQLClassicIdsInflection: {}; | ||
export declare const createPostGraphQLSchema: (pgConfig: PgConfig, schemas: string | string[], options?: PostGraphileCoreOptions) => Promise<GraphQLSchema>; | ||
export declare const watchPostGraphQLSchema: (pgConfig: PgConfig, schemas: string | string[], options: PostGraphileCoreOptions | undefined, onNewSchema: SchemaListener) => Promise<() => Promise<void>>; |
@@ -8,4 +8,10 @@ "use strict"; | ||
const graphile_build_pg_1 = require("graphile-build-pg"); | ||
exports.inflections = graphile_build_pg_1.inflections; | ||
exports.formatSQLForDebugging = graphile_build_pg_1.formatSQLForDebugging; | ||
function errorProxy(message) { | ||
return new Proxy({}, { | ||
get: () => { | ||
throw new Error(message); | ||
}, | ||
}); | ||
} | ||
const ensureValidPlugins = (name, arr) => { | ||
@@ -22,15 +28,11 @@ if (!Array.isArray(arr)) { | ||
}; | ||
exports.postGraphileBaseOverrides = { | ||
enumName(value) { | ||
return graphile_build_pg_1.inflections.defaultUtils.constantCase(graphile_build_pg_1.inflections.defaultInflection.enumName(value)); | ||
}, | ||
}; | ||
exports.postGraphileClassicIdsOverrides = { | ||
column(name, _table, _schema) { | ||
return name === "id" ? "rowId" : graphile_build_pg_1.inflections.defaultUtils.camelCase(name); | ||
}, | ||
}; | ||
exports.postGraphileInflection = graphile_build_pg_1.inflections.newInflector(exports.postGraphileBaseOverrides); | ||
exports.postGraphileClassicIdsInflection = graphile_build_pg_1.inflections.newInflector(Object.assign({}, exports.postGraphileBaseOverrides, exports.postGraphileClassicIdsOverrides)); | ||
/* | ||
* BELOW HERE IS DEPRECATED!! | ||
*/ | ||
exports.inflections = errorProxy("`inflections` was deprecated in v4.0.0-beta.7; instead please write an inflector plugin: https://www.graphile.org/postgraphile/inflection/"); | ||
exports.postGraphileBaseOverrides = errorProxy("Passing an inflector via PostGraphile options was deprecated in v4.0.0-beta.7; instead please write an inflector plugin: https://www.graphile.org/postgraphile/inflection/"); | ||
exports.postGraphileClassicIdsOverrides = errorProxy("Passing an inflector via PostGraphile options was deprecated in v4.0.0-beta.7; instead please write an inflector plugin: https://www.graphile.org/postgraphile/inflection/"); | ||
exports.postGraphileInflection = errorProxy("Passing an inflector via PostGraphile options was deprecated in v4.0.0-beta.7; instead please write an inflector plugin: https://www.graphile.org/postgraphile/inflection/"); | ||
exports.postGraphileClassicIdsInflection = errorProxy("Passing an inflector via PostGraphile options was deprecated in v4.0.0-beta.7; instead please write an inflector plugin: https://www.graphile.org/postgraphile/inflection/"); | ||
/* | ||
* ABOVE HERE IS DEPRECATED. | ||
@@ -75,4 +77,7 @@ */ | ||
const getPostGraphileBuilder = async (pgConfig, schemas, options = {}) => { | ||
// @ts-ignore | ||
if (options.inflector) { | ||
throw new Error("Passing an inflector via PostGraphile options was deprecated in v4.0.0-beta.7; instead please write an inflector plugin: https://www.graphile.org/postgraphile/inflection/"); | ||
} | ||
const { dynamicJson, classicIds, nodeIdFieldName, replaceAllPlugins, appendPlugins = [], prependPlugins = [], skipPlugins = [], jwtPgTypeIdentifier, jwtSecret, disableDefaultMutations, graphileBuildOptions, graphqlBuildOptions, // DEPRECATED! | ||
inflector, // NO LONGER SUPPORTED! | ||
pgColumnFilter, viewUniqueKey, enableTags = true, readCache, writeCache, setWriteCacheCallback, legacyRelations = "deprecated", // TODO:v5: Change to 'omit' in v5 | ||
@@ -158,5 +163,2 @@ setofFunctionsContainNulls = true, legacyJsonUuid = false, simpleCollections = "omit", includeExtensionResources = false, ignoreRBAC = true, // TODO:v5: Change to 'false' in v5 | ||
ensureValidPlugins("skipPlugins", skipPlugins); | ||
if (inflector) { | ||
throw new Error("Custom inflector arguments are no longer supported, please use the inflector plugin API instead"); | ||
} | ||
const inflectionOverridePlugins = classicIds | ||
@@ -189,4 +191,3 @@ ? [exports.PostGraphileInflectionPlugin, exports.PostGraphileClassicIdsInflectionPlugin] | ||
const finalPluginList = basePluginList.filter(p => skipPlugins.indexOf(p) === -1); | ||
return graphile_build_1.getBuilder(finalPluginList, Object.assign({ pgConfig, pgSchemas: Array.isArray(schemas) ? schemas : [schemas], pgExtendedTypes: !!dynamicJson, pgColumnFilter: pgColumnFilter || (() => true), pgInflection: inflector || | ||
(classicIds ? exports.postGraphileClassicIdsInflection : exports.postGraphileInflection), nodeIdFieldName: nodeIdFieldName || (classicIds ? "id" : "nodeId"), pgJwtTypeIdentifier: jwtPgTypeIdentifier, pgJwtSecret: jwtSecret, pgDisableDefaultMutations: disableDefaultMutations, pgViewUniqueKey: viewUniqueKey, pgEnableTags: enableTags, pgLegacyRelations: legacyRelations, pgLegacyJsonUuid: legacyJsonUuid, persistentMemoizeWithKey, pgForbidSetofFunctionsToReturnNull: !setofFunctionsContainNulls, pgSimpleCollections: simpleCollections, pgIncludeExtensionResources: includeExtensionResources, pgIgnoreRBAC: ignoreRBAC, pgLegacyFunctionsOnly: legacyFunctionsOnly, pgIgnoreIndexes: ignoreIndexes }, graphileBuildOptions, graphqlBuildOptions)); | ||
return graphile_build_1.getBuilder(finalPluginList, Object.assign({ pgConfig, pgSchemas: Array.isArray(schemas) ? schemas : [schemas], pgExtendedTypes: !!dynamicJson, pgColumnFilter: pgColumnFilter || (() => true), pgInflection: errorProxy("The PostGraphile options `pgInflection` key was deprecated in v4.0.0-beta.7; instead please use `build.inflection` (and note that the call signatures are now simpler): https://www.graphile.org/postgraphile/inflection/"), nodeIdFieldName: nodeIdFieldName || (classicIds ? "id" : "nodeId"), pgJwtTypeIdentifier: jwtPgTypeIdentifier, pgJwtSecret: jwtSecret, pgDisableDefaultMutations: disableDefaultMutations, pgViewUniqueKey: viewUniqueKey, pgEnableTags: enableTags, pgLegacyRelations: legacyRelations, pgLegacyJsonUuid: legacyJsonUuid, persistentMemoizeWithKey, pgForbidSetofFunctionsToReturnNull: !setofFunctionsContainNulls, pgSimpleCollections: simpleCollections, pgIncludeExtensionResources: includeExtensionResources, pgIgnoreRBAC: ignoreRBAC, pgLegacyFunctionsOnly: legacyFunctionsOnly, pgIgnoreIndexes: ignoreIndexes }, graphileBuildOptions, graphqlBuildOptions)); | ||
}; | ||
@@ -193,0 +194,0 @@ function abort(e) { |
{ | ||
"name": "postgraphile-core", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"description": "", | ||
@@ -24,4 +24,4 @@ "main": "node8plus/index.js", | ||
"@types/graphql": "^14.0.3", | ||
"graphile-build": "4.1.0", | ||
"graphile-build-pg": "4.2.0" | ||
"graphile-build": "4.3.0", | ||
"graphile-build-pg": "4.3.0" | ||
}, | ||
@@ -57,3 +57,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "26381acb99aaa20e2c1075a7f2627b5b22147e1e" | ||
"gitHead": "adae926ba5801f62ec1a8ec5c456271fe744f8b0" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30683
298
+ Addedgraphile-build@4.3.0(transitive)
+ Addedgraphile-build-pg@4.3.0(transitive)
- Removedgraphile-build@4.1.0(transitive)
- Removedgraphile-build-pg@4.2.0(transitive)
Updatedgraphile-build@4.3.0
Updatedgraphile-build-pg@4.3.0