Socket
Socket
Sign inDemoInstall

graphile-build

Package Overview
Dependencies
Maintainers
1
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphile-build - npm Package Compare versions

Comparing version 5.0.0-alpha.12 to 5.0.0-alpha.13

39

CHANGELOG.md
# graphile-build
## 5.0.0-alpha.13
### Patch Changes
- [#407](https://github.com/benjie/postgraphile-private/pull/407)
[`9281a2d88`](https://github.com/benjie/postgraphile-private/commit/9281a2d889ab1e72a3f6f9777779f31a6588d478)
Thanks [@benjie](https://github.com/benjie)! - Exported `version` no longer
uses `require('../package.json')` hack, instead the version number is written
to a source file at versioning time. Packages now export `version`.
- [#406](https://github.com/benjie/postgraphile-private/pull/406)
[`9f5a784c6`](https://github.com/benjie/postgraphile-private/commit/9f5a784c601b67dfb2cbf7bd836d7aa060fba63c)
Thanks [@benjie](https://github.com/benjie)! - Introduce TypeScript CIF
gatherConfig() to help typing the `gather` phase for plugins.
- [#408](https://github.com/benjie/postgraphile-private/pull/408)
[`2849cc3fb`](https://github.com/benjie/postgraphile-private/commit/2849cc3fb8e4302b57cdf21f8c9a5fea33b797f8)
Thanks [@benjie](https://github.com/benjie)! - Better handle the situation
where a node fetcher could not be found.
- [#408](https://github.com/benjie/postgraphile-private/pull/408)
[`8ca9425ed`](https://github.com/benjie/postgraphile-private/commit/8ca9425edec68fbac0e727bd3d2754bf4843cc74)
Thanks [@benjie](https://github.com/benjie)! - Detect when your preset doesn't
have any plugins, or omits the QueryPlugin, and raise an error or warning
indicating to the user that there's likely an issue here.
- [#408](https://github.com/benjie/postgraphile-private/pull/408)
[`dda361d11`](https://github.com/benjie/postgraphile-private/commit/dda361d11c4d2625c5770df32843f3ec1407c922)
Thanks [@benjie](https://github.com/benjie)! - Improve error messages for
getInputTypeByName and getOutputTypeByName.
- Updated dependencies
[[`9281a2d88`](https://github.com/benjie/postgraphile-private/commit/9281a2d889ab1e72a3f6f9777779f31a6588d478),
[`675b7abb9`](https://github.com/benjie/postgraphile-private/commit/675b7abb93e11d955930b9026fb0b65a56ecc999),
[`c5050dd28`](https://github.com/benjie/postgraphile-private/commit/c5050dd286bd6d9fa4a5d9cfbf87ba609cb148dd),
[`0d1782869`](https://github.com/benjie/postgraphile-private/commit/0d1782869adc76f5bbcecfdcbb85a258c468ca37)]:
- grafast@0.0.1-alpha.12
- graphile-config@0.0.1-alpha.6
## 5.0.0-alpha.12

@@ -4,0 +43,0 @@

11

dist/global.d.ts

@@ -129,2 +129,7 @@ import type { BaseGraphQLArguments, ExecutableStep, GrafastArgumentConfig, GrafastFieldConfig, GrafastFieldConfigArgumentMap, GrafastInputFieldConfig, GrafastInputFieldConfigMap, OutputPlanForType } from "grafast";

}
interface BuildVersions {
grafast: string;
graphql: string;
"graphile-build": string;
}
/**

@@ -144,7 +149,3 @@ * The absolute bare bones `Build` object that graphile-build makes before

*/
versions: {
graphql: string;
"graphile-build": string;
[packageName: string]: string;
};
versions: BuildVersions;
/**

@@ -151,0 +152,0 @@ * Input from the "data gathering" phase that plugins can use to

@@ -6,3 +6,3 @@ import "./global.js";

import SchemaBuilder from "./SchemaBuilder.js";
export { camelCase, constantCase, constantCaseAll, EXPORTABLE, formatInsideUnderscores, pluralize, singularize, upperCamelCase, upperFirst, } from "./utils.js";
export { camelCase, constantCase, constantCaseAll, EXPORTABLE, formatInsideUnderscores, gatherConfig, pluralize, singularize, upperCamelCase, upperFirst, } from "./utils.js";
import type { NewWithHooksFunction } from "./newWithHooks/index.js";

@@ -69,2 +69,3 @@ export { GraphileBuild, GraphileConfig };

export declare function watchSchema(preset: GraphileConfig.Preset, callback: (fatalError: Error | null, params?: SchemaResult) => void): Promise<() => void>;
export { version } from "./version.js";
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.watchSchema = exports.makeSchema = exports.defaultPreset = exports.TrimEmptyDescriptionsPlugin = exports.SwallowErrorsPlugin = exports.SubscriptionPlugin = exports.StreamDeferPlugin = exports.RegisterQueryNodePlugin = exports.QueryQueryPlugin = exports.QueryPlugin = exports.PageInfoStartEndCursorPlugin = exports.NodePlugin = exports.NodeIdCodecPipeStringPlugin = exports.NodeIdCodecBase64JSONPlugin = exports.NodeAccessorPlugin = exports.MutationPlugin = exports.MutationPayloadQueryPlugin = exports.CursorTypePlugin = exports.CommonTypesPlugin = exports.ClientMutationIdDescriptionPlugin = exports.BuiltinScalarConnectionsPlugin = exports.AddNodeInterfaceToSuitableTypesPlugin = exports.buildSchema = exports.getBuilder = exports.watchGather = exports.gather = exports.buildInflection = exports.SchemaBuilder = exports.upperFirst = exports.upperCamelCase = exports.singularize = exports.pluralize = exports.formatInsideUnderscores = exports.EXPORTABLE = exports.constantCaseAll = exports.constantCase = exports.camelCase = void 0;
exports.version = exports.watchSchema = exports.makeSchema = exports.defaultPreset = exports.TrimEmptyDescriptionsPlugin = exports.SwallowErrorsPlugin = exports.SubscriptionPlugin = exports.StreamDeferPlugin = exports.RegisterQueryNodePlugin = exports.QueryQueryPlugin = exports.QueryPlugin = exports.PageInfoStartEndCursorPlugin = exports.NodePlugin = exports.NodeIdCodecPipeStringPlugin = exports.NodeIdCodecBase64JSONPlugin = exports.NodeAccessorPlugin = exports.MutationPlugin = exports.MutationPayloadQueryPlugin = exports.CursorTypePlugin = exports.CommonTypesPlugin = exports.ClientMutationIdDescriptionPlugin = exports.BuiltinScalarConnectionsPlugin = exports.AddNodeInterfaceToSuitableTypesPlugin = exports.buildSchema = exports.getBuilder = exports.watchGather = exports.gather = exports.buildInflection = exports.SchemaBuilder = exports.upperFirst = exports.upperCamelCase = exports.singularize = exports.pluralize = exports.gatherConfig = exports.formatInsideUnderscores = exports.EXPORTABLE = exports.constantCaseAll = exports.constantCase = exports.camelCase = void 0;
const tslib_1 = require("tslib");

@@ -40,2 +40,3 @@ require("./global.js");

Object.defineProperty(exports, "formatInsideUnderscores", { enumerable: true, get: function () { return utils_js_1.formatInsideUnderscores; } });
Object.defineProperty(exports, "gatherConfig", { enumerable: true, get: function () { return utils_js_1.gatherConfig; } });
Object.defineProperty(exports, "pluralize", { enumerable: true, get: function () { return utils_js_1.pluralize; } });

@@ -108,3 +109,3 @@ Object.defineProperty(exports, "singularize", { enumerable: true, get: function () { return utils_js_1.singularize; } });

if (spec.namespace in globalState) {
// TODO: track who registers which namespace, output more helpful error.
// ERRORS: track who registers which namespace, output more helpful error.
throw new Error(`Namespace '${spec.namespace}' was already registered, it cannot be registered by two plugins - namespaces must be unique.`);

@@ -118,3 +119,3 @@ }

if (typeof cache.then === "function") {
// TODO: can we just make `initialCache` allow promises?
// ENHANCE: can we just make `initialCache` allow promises?
throw new Error(`\`initialCache\` may not return a promise directly; instead set one of the keys on the object it returns to a promise and await that in \`initialState\` (which is allowed to be async)`);

@@ -203,3 +204,3 @@ }

catch {
// TODO: this indicates a bug in user code; how to handle?
// ERRORS: this indicates a bug in user code; how to handle?
/*nom nom nom*/

@@ -217,3 +218,3 @@ }

catch {
// TODO: this indicates a bug in user code; how to handle?
// ERRORS: this indicates a bug in user code; how to handle?
/*nom nom nom*/

@@ -297,2 +298,8 @@ }

const resolvedPreset = (0, graphile_config_1.resolvePresets)([preset]);
if (!resolvedPreset.plugins || resolvedPreset.plugins.length === 0) {
throw new Error(`You're attempting to build a GraphQL schema, but no plugins are specified in your preset. Please check the 'extends' key in your preset - you may have forgotten to add the relevant presets, or the presets may not have been imported correctly.`);
}
if (!resolvedPreset.plugins.includes(index_js_1.QueryPlugin)) {
console.warn(`[WARNING] You're attempting to build a GraphQL schema, but the QueryPlugin is missing from your configuration. Unless you have done this very deliberately, this is probably a mistake - please check the 'extends' key in your preset - you may have forgotten to add the relevant presets, or the presets may not have been imported correctly.`);
}
const builder = new SchemaBuilder_js_1.default(resolvedPreset, inflection);

@@ -303,3 +310,3 @@ return builder;

async function writeFileIfDiffers(path, contents) {
// TODO: support other environments than Node
// COMPAT: support other environments than Node
const { readFile, writeFile } = await import("node:fs/promises");

@@ -480,2 +487,4 @@ let oldContents = null;

exports.watchSchema = watchSchema;
var version_js_1 = require("./version.js");
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_js_1.version; } });
//# sourceMappingURL=index.js.map

@@ -130,3 +130,3 @@ import type { GrafastArgumentConfig, GrafastFieldConfig, GrafastFieldConfigArgumentMap, PromiseOrDirect } from "grafast";

helpers?: {
[key in keyof GatherHelpers[TNamespace]]: GatherHelpers[TNamespace][key] extends (...args: infer UArgs) => infer UReturnType ? (info: GatherPluginContext<TState, TCache>, ...args: UArgs) => UReturnType : never;
[key in keyof GatherHelpers[TNamespace]]: (info: GatherPluginContext<TState, TCache>, ...args: Parameters<GatherHelpers[TNamespace][key]>) => ReturnType<GatherHelpers[TNamespace][key]>;
};

@@ -133,0 +133,0 @@ hooks?: {

@@ -10,14 +10,5 @@ "use strict";

const semver = tslib_1.__importStar(require("semver"));
const util_1 = require("util");
const extend_js_1 = tslib_1.__importStar(require("./extend.js"));
const utils_js_1 = require("./utils.js");
// TODO: the versioning!
const version = "TODO";
/*
import { readFileSync } from "node:fs";
import { URL } from "node:url";
const version: string = JSON.parse(
readFileSync(new URL("../package.json", import.meta.url), "utf8"),
).version;
*/
const version_js_1 = require("./version.js");
/** Have we warned the user they're using the 5-arg deprecated registerObjectType call? */

@@ -79,4 +70,5 @@ let registerObjectType5argsDeprecatedWarned = false;

versions: {
grafast: grafast.version,
graphql: graphql.version,
"graphile-build": version,
"graphile-build": version_js_1.version,
},

@@ -271,5 +263,10 @@ input,

const type = this.getTypeByName(typeName);
if (!type || !(0, graphql_1.isInputType)(type)) {
throw new Error(`Expected an input type named '${typeName}', instead found ${String(type)}`);
if (!type) {
throw new Error(`Expected an input type named '${typeName}', but ${this.getTypeMetaByName(typeName)
? `that type was not successfully constructed; typically this is because it ended up with no fields.`
: `a type with that name has not been registered.`}`);
}
if (!(0, graphql_1.isInputType)(type)) {
throw new Error(`Expected '${typeName}' to be an input type, but it isn't (${String(type)})`);
}
return type;

@@ -282,5 +279,10 @@ },

const type = this.getTypeByName(typeName);
if (!type || !(0, graphql_1.isOutputType)(type)) {
throw new Error(`Expected an output type named '${typeName}', instead found ${(0, util_1.inspect)(type)}`);
if (!type) {
throw new Error(`Expected an output type named '${typeName}', but ${this.getTypeMetaByName(typeName)
? `that type was not successfully constructed; typically this is because it ended up with no fields.`
: `a type with that name has not been registered.`}`);
}
if (!(0, graphql_1.isOutputType)(type)) {
throw new Error(`Expected '${typeName}' to be an output type, but it isn't (${String(type)})`);
}
return type;

@@ -287,0 +289,0 @@ },

@@ -13,3 +13,3 @@ "use strict";

hooks: {
// TODO: add "specifiedBy" configuration
// ENHANCE: add "specifiedBy" configuration to custom scalars
init(_, build) {

@@ -16,0 +16,0 @@ const { options: { jsonScalarAsString }, inflection, stringTypeSpec, graphql: { Kind, GraphQLError }, } = build;

@@ -102,3 +102,3 @@ "use strict";

plan: (0, utils_js_1.EXPORTABLE)(() => function plan($connection) {
// TODO: why is this a TypeScript issue without the 'any'?
// TYPES: why is this a TypeScript issue without the 'any'?
return $connection.pageInfo();

@@ -105,0 +105,0 @@ }, []),

@@ -11,3 +11,3 @@ import "graphile-config";

specForHandler(handler: NodeIdHandler, codec: NodeIdCodec): (nodeId: string) => any;
nodeFetcherByTypeName(typeName: string): NodeFetcher;
nodeFetcherByTypeName(typeName: string): NodeFetcher | null;
}

@@ -14,0 +14,0 @@ interface Inflection {

@@ -50,2 +50,4 @@ "use strict";

const handler = finalBuild.getNodeIdHandler(typeName);
if (!handler)
return null;
const codec = finalBuild.getNodeIdCodec(handler.codecName);

@@ -82,2 +84,5 @@ const fetcher = (0, utils_js_1.EXPORTABLE)((codec, handler, lambda, specForHandler) => {

const fetcher = build.nodeFetcherByTypeName(typeName);
if (!fetcher) {
return memo;
}
return build.extend(memo, {

@@ -84,0 +89,0 @@ [build.inflection.nodeById(typeName)]: {

@@ -61,3 +61,3 @@ "use strict";

if (!this.hooks[hookName]) {
// TODO: fuzzy-find a similar hook
// ERRORS: fuzzy-find a similar hook
throw new Error(`Sorry, '${hookName}' is not a supported hook`);

@@ -64,0 +64,0 @@ }

@@ -15,3 +15,3 @@ "use strict";

// BE VERY CAREFUL NOT TO THROW!
// TODO: Improve this
// LOGGING: Improve this
if (debugWarn.enabled) {

@@ -18,0 +18,0 @@ debugWarn("Recoverable error occurred: %s", e);

@@ -48,2 +48,15 @@ import type { GraphQLNamedType, GraphQLScalarTypeConfig } from "graphql";

export declare const stringTypeSpec: (description: string, coerce?: ((input: string) => string) | undefined) => Omit<GraphQLScalarTypeConfig<any, any>, "name">;
/**
* This is a TypeScript constrained identity function to save having to specify
* all the generics manually.
*/
export declare function gatherConfig<const TNamespace extends keyof GraphileConfig.GatherHelpers, const TState extends {
[key: string]: any;
} = {
[key: string]: any;
}, const TCache extends {
[key: string]: any;
} = {
[key: string]: any;
}>(config: GraphileConfig.PluginGatherConfig<TNamespace, TState, TCache>): GraphileConfig.PluginGatherConfig<TNamespace, TState, TCache>;
//# sourceMappingURL=utils.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringTypeSpec = exports.wrapDescription = exports.stringScalarSpec = exports.isValidObjectType = exports.singularize = exports.pluralize = exports.upperCamelCase = exports.constantCase = exports.camelCase = exports.upperFirst = exports.formatInsideUnderscores = exports.constantCaseAll = exports.bindAll = exports.EXPORTABLE = void 0;
exports.gatherConfig = exports.stringTypeSpec = exports.wrapDescription = exports.stringScalarSpec = exports.isValidObjectType = exports.singularize = exports.pluralize = exports.upperCamelCase = exports.constantCase = exports.camelCase = exports.upperFirst = exports.formatInsideUnderscores = exports.constantCaseAll = exports.bindAll = exports.EXPORTABLE = void 0;
const tslib_1 = require("tslib");
const grafast_1 = require("grafast");
const graphql_1 = require("graphql");
// TODO: remove 'lodash' dependency
// ENHANCE: remove 'lodash' dependency
const camelCase_js_1 = tslib_1.__importDefault(require("lodash/camelCase.js"));

@@ -164,3 +164,3 @@ const upperFirst_js_1 = tslib_1.__importDefault(require("lodash/upperFirst.js"));

if (ast.kind !== Kind.STRING) {
// TODO: add name to this error
// ERRORS: add name to this error
throw new GraphQLError("Can only parse string values");

@@ -183,2 +183,10 @@ }

exports.stringTypeSpec = stringTypeSpec;
/**
* This is a TypeScript constrained identity function to save having to specify
* all the generics manually.
*/
function gatherConfig(config) {
return config;
}
exports.gatherConfig = gatherConfig;
//# sourceMappingURL=utils.js.map

@@ -1,2 +0,2 @@

export declare const version: any;
export declare const version = "5.0.0-alpha.13";
//# sourceMappingURL=version.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = void 0;
// TODO: remove this hack!
exports.version = require("../package.json").version;
// This file is autogenerated by /scripts/postversion.mjs
exports.version = "5.0.0-alpha.13";
//# sourceMappingURL=version.js.map
{
"name": "graphile-build",
"version": "5.0.0-alpha.12",
"version": "5.0.0-alpha.13",
"description": "Build a GraphQL schema from plugins",

@@ -44,3 +44,3 @@ "type": "commonjs",

"debug": "^4.3.3",
"graphile-config": "^0.0.1-alpha.5",
"graphile-config": "^0.0.1-alpha.6",
"lodash": "^4.17.21",

@@ -55,4 +55,4 @@ "pluralize": "^7.0.0",

"peerDependencies": {
"grafast": "^0.0.1-alpha.11",
"graphile-config": "^0.0.1-alpha.5",
"grafast": "^0.0.1-alpha.12",
"graphile-config": "^0.0.1-alpha.6",
"graphql": "^16.1.0-experimental-stream-defer.6"

@@ -67,3 +67,3 @@ },

"@types/jest": "^27.5.1",
"graphile-export": "^0.0.2-alpha.5",
"graphile-export": "^0.0.2-alpha.6",
"graphql": "16.1.0-experimental-stream-defer.6",

@@ -70,0 +70,0 @@ "jest": "^28.1.3",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc