postgraphile-core
Advanced tools
Comparing version 4.4.4 to 4.4.5
@@ -1,3 +0,2 @@ | ||
The MIT License (MIT) | ||
===================== | ||
# The MIT License (MIT) | ||
@@ -26,2 +25,1 @@ Copyright © `2018` Benjie Gillam | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
@@ -45,3 +45,3 @@ import { Plugin, Options, SchemaListener, Build, Context, SchemaBuilder, Inflection } from "graphile-build"; | ||
enableTags?: boolean; | ||
readCache?: string; | ||
readCache?: string | object; | ||
writeCache?: string; | ||
@@ -74,2 +74,3 @@ setWriteCacheCallback?: (fn: () => Promise<void>) => void; | ||
export declare const PostGraphileClassicIdsInflectionPlugin: Plugin; | ||
export declare const getPostGraphileBuilder: (pgConfig: PgConfig, schemas: string | string[], options?: PostGraphileCoreOptions) => Promise<SchemaBuilder>; | ||
export declare const createPostGraphileSchema: (pgConfig: PgConfig, schemas: string | string[], options?: PostGraphileCoreOptions) => Promise<GraphQLSchema>; | ||
@@ -76,0 +77,0 @@ export declare const watchPostGraphileSchema: (pgConfig: PgConfig, schemas: string | string[], options: PostGraphileCoreOptions | undefined, onNewSchema: SchemaListener) => Promise<() => Promise<void>>; |
@@ -32,3 +32,3 @@ "use strict"; | ||
exports.postGraphileInflection = graphile_build_pg_1.inflections.newInflector(exports.postGraphileBaseOverrides); | ||
exports.postGraphileClassicIdsInflection = graphile_build_pg_1.inflections.newInflector(Object.assign({}, exports.postGraphileBaseOverrides, exports.postGraphileClassicIdsOverrides)); | ||
exports.postGraphileClassicIdsInflection = graphile_build_pg_1.inflections.newInflector(Object.assign(Object.assign({}, exports.postGraphileBaseOverrides), exports.postGraphileClassicIdsOverrides)); | ||
/* | ||
@@ -73,3 +73,3 @@ * ABOVE HERE IS DEPRECATED. | ||
}; | ||
const getPostGraphileBuilder = async (pgConfig, schemas, options = {}) => { | ||
exports.getPostGraphileBuilder = async (pgConfig, schemas, options = {}) => { | ||
// @ts-ignore | ||
@@ -111,18 +111,26 @@ if (options.inflector) { | ||
if (readCache) { | ||
const cacheString = await new Promise((resolve, reject) => { | ||
fs.readFile(readCache, "utf8", (err, data) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(data); | ||
} | ||
if (typeof readCache === "string") { | ||
const cacheString = await new Promise((resolve, reject) => { | ||
fs.readFile(readCache, "utf8", (err, data) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(data); | ||
} | ||
}); | ||
}); | ||
}); | ||
try { | ||
memoizeCache = JSON.parse(cacheString); | ||
try { | ||
memoizeCache = JSON.parse(cacheString); | ||
} | ||
catch (e) { | ||
throw new Error(`Failed to parse cache file '${readCache}', perhaps it is corrupted? ${e}`); | ||
} | ||
} | ||
catch (e) { | ||
throw new Error(`Failed to parse cache file '${readCache}', perhaps it is corrupted? ${e}`); | ||
else if (typeof readCache === "object" && !Array.isArray(readCache)) { | ||
memoizeCache = readCache; | ||
} | ||
else { | ||
throw new Error(`'readCache' not understood; expected string or object, but received '${Array.isArray(readCache) ? "array" : typeof readCache}'`); | ||
} | ||
} | ||
@@ -195,3 +203,3 @@ if (readCache || writeCache) { | ||
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 || | ||
return graphile_build_1.getBuilder(finalPluginList, Object.assign(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, pgJwtSignOptions: jwtSignOptions, pgDisableDefaultMutations: disableDefaultMutations, pgViewUniqueKey: viewUniqueKey, pgEnableTags: enableTags, pgLegacyRelations: legacyRelations, pgLegacyJsonUuid: legacyJsonUuid, persistentMemoizeWithKey, pgForbidSetofFunctionsToReturnNull: !setofFunctionsContainNulls, pgSimpleCollections: simpleCollections, pgIncludeExtensionResources: includeExtensionResources, pgIgnoreRBAC: ignoreRBAC, pgLegacyFunctionsOnly: legacyFunctionsOnly, pgIgnoreIndexes: ignoreIndexes, pgHideIndexWarnings: hideIndexWarnings, pgOwnerConnectionString: ownerConnectionString, | ||
@@ -207,9 +215,9 @@ /* | ||
subscriptions, | ||
live }, graphileBuildOptions, graphqlBuildOptions)); | ||
live }, graphileBuildOptions), graphqlBuildOptions)); | ||
}; | ||
function abort(e) { | ||
/* tslint:disable no-console */ | ||
// eslint-disable-next-line no-console | ||
console.error("Error occured whilst writing cache"); | ||
// eslint-disable-next-line no-console | ||
console.error(e); | ||
/* tslint:enable no-console */ | ||
process.exit(1); | ||
@@ -219,3 +227,3 @@ } | ||
let writeCache; | ||
const builder = await getPostGraphileBuilder(pgConfig, schemas, Object.assign({}, options, { setWriteCacheCallback(fn) { | ||
const builder = await exports.getPostGraphileBuilder(pgConfig, schemas, Object.assign(Object.assign({}, options), { setWriteCacheCallback(fn) { | ||
writeCache = fn; | ||
@@ -240,3 +248,3 @@ } })); | ||
let writeCache; | ||
const builder = await getPostGraphileBuilder(pgConfig, schemas, Object.assign({}, options, { setWriteCacheCallback(fn) { | ||
const builder = await exports.getPostGraphileBuilder(pgConfig, schemas, Object.assign(Object.assign({}, options), { setWriteCacheCallback(fn) { | ||
writeCache = fn; | ||
@@ -243,0 +251,0 @@ } })); |
{ | ||
"name": "postgraphile-core", | ||
"version": "4.4.4", | ||
"version": "4.4.5", | ||
"description": "", | ||
@@ -9,3 +9,2 @@ "main": "node8plus/index.js", | ||
"prepack": "mkdir -p node8plus && tsc", | ||
"tslint": "prettier --list-different 'src/**/*' && tslint --config ../../tslint.json --project tsconfig.json", | ||
"watch": "mkdir -p node8plus && tsc --watch" | ||
@@ -24,5 +23,4 @@ }, | ||
"dependencies": { | ||
"@types/graphql": "^14.2.0", | ||
"graphile-build": "4.4.4", | ||
"graphile-build-pg": "4.4.4" | ||
"graphile-build": "4.4.5", | ||
"graphile-build-pg": "4.4.5" | ||
}, | ||
@@ -33,11 +31,9 @@ "devDependencies": { | ||
"debug": "^4.1.1", | ||
"eslint_d": "^7.3.0", | ||
"eslint_d": "^8.0.0", | ||
"jest": "^24.8.0", | ||
"jest-silent-reporter": "^0.1.2", | ||
"jsonwebtoken": "^8.5.1", | ||
"pg-connection-string": "^0.1.3", | ||
"pg-connection-string": "^2.1.0", | ||
"prettier": "^1.17.0", | ||
"ts-node": "^8.1.0", | ||
"tslint": "^5.16.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^3.4.5" | ||
@@ -62,3 +58,3 @@ }, | ||
}, | ||
"gitHead": "95ce83990654dd90430de2e374859abf53f7b214" | ||
"gitHead": "b0e19c73f1f78c62c4be1a2974a4f2404c538aa5" | ||
} |
Sorry, the diff of this file is not supported yet
34380
4
11
356
+ Added@graphile/lru@4.4.5(transitive)
+ Addedgraphile-build@4.4.5(transitive)
+ Addedgraphile-build-pg@4.4.5(transitive)
+ Addedgraphql-parse-resolve-info@4.4.5(transitive)
+ Addedpg-sql2@4.4.5(transitive)
- Removed@types/graphql@^14.2.0
- Removed@graphile/lru@4.4.1-alpha.2(transitive)
- Removed@types/graphql@14.5.0(transitive)
- Removedgraphile-build@4.4.4(transitive)
- Removedgraphile-build-pg@4.4.4(transitive)
- Removedgraphql-parse-resolve-info@4.4.3(transitive)
- Removedpg-sql2@4.4.3(transitive)
Updatedgraphile-build@4.4.5
Updatedgraphile-build-pg@4.4.5