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.10 to 5.0.0-alpha.11

39

CHANGELOG.md
# graphile-build
## 5.0.0-alpha.11
### Patch Changes
- [#399](https://github.com/benjie/postgraphile-private/pull/399)
[`409581534`](https://github.com/benjie/postgraphile-private/commit/409581534f41ac2cf0ff21c77c2bcd8eaa8218fd)
Thanks [@benjie](https://github.com/benjie)! - Change many of the dependencies
to be instead (or also) peerDependencies, to avoid duplicate modules.
- [#399](https://github.com/benjie/postgraphile-private/pull/399)
[`976958e80`](https://github.com/benjie/postgraphile-private/commit/976958e80c791819cd80e96df8209dcff1918585)
Thanks [@benjie](https://github.com/benjie)! - Plugins can now use
build.grafast rather than adding grafast as a peerDependency.
- [#383](https://github.com/benjie/postgraphile-private/pull/383)
[`2c8586b36`](https://github.com/benjie/postgraphile-private/commit/2c8586b367b76af91d1785cc90455c70911fdec7)
Thanks [@benjie](https://github.com/benjie)! - Change
'objectType.extensions.grafast.Step' to
'objectType.extensions.grafast.assertStep', accept it via object spec,
deprecate registerObjectType form that accepts it (pass via object spec
instead), improve typings around it.
- [#378](https://github.com/benjie/postgraphile-private/pull/378)
[`47ff7e824`](https://github.com/benjie/postgraphile-private/commit/47ff7e824b2fc96c11f601c3814d0200208711ce)
Thanks [@benjie](https://github.com/benjie)! - Add more detail to an error
message
- Updated dependencies
[[`409581534`](https://github.com/benjie/postgraphile-private/commit/409581534f41ac2cf0ff21c77c2bcd8eaa8218fd),
[`b7533bd4d`](https://github.com/benjie/postgraphile-private/commit/b7533bd4dfc210cb8b113b8fa06f163a212aa5e4),
[`9feb769c2`](https://github.com/benjie/postgraphile-private/commit/9feb769c2df0c57971ed26a937be4a1bee7a7524),
[`7573bf374`](https://github.com/benjie/postgraphile-private/commit/7573bf374897228b613b19f37b4e076737db3279),
[`2c8586b36`](https://github.com/benjie/postgraphile-private/commit/2c8586b367b76af91d1785cc90455c70911fdec7),
[`c43802d74`](https://github.com/benjie/postgraphile-private/commit/c43802d7419f93d18964c654f16d0937a2e23ca0),
[`b118b8f6d`](https://github.com/benjie/postgraphile-private/commit/b118b8f6dc18196212cfb0a05486e1dd8d77ccf8),
[`9008c4f87`](https://github.com/benjie/postgraphile-private/commit/9008c4f87df53be4051c49f9836358dc2baa59df),
[`e8c81cd20`](https://github.com/benjie/postgraphile-private/commit/e8c81cd2046390ed5b6799aa7ff3d90b28a1861a)]:
- grafast@0.0.1-alpha.10
## 5.0.0-alpha.10

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

31

dist/global.d.ts

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

import type { stringTypeSpec, wrapDescription } from "./utils.js";
interface RegisterObjectType {
/**
* Register a type by name with the system; names must be unique. It's
* strongly advised that your names come from an inflector so that they
* can be overridden. When you register a type, you should also supply a
* scope so that other plugins may hook it; it can also be helpful to
* indicate where a conflict has occurred.
*/
<TStep extends ExecutableStep | null>(typeName: string, scope: GraphileBuild.ScopeObject, specGenerator: () => Omit<GraphileBuild.GrafastObjectTypeConfig<TStep, any>, "name">, origin: string | null | undefined): void;
/**
* @deprecated Please pass 'assertStep' as part of the object spec. This
* compatibility signature will not be supported for long!
*/
<TStep extends ExecutableStep | null>(typeName: string, scope: GraphileBuild.ScopeObject, assertStep: TStep extends ExecutableStep ? ((step: ExecutableStep) => asserts step is TStep) | {
new (...args: any[]): TStep;
} : null, specGenerator: () => Omit<GraphileBuild.GrafastObjectTypeConfig<TStep, any>, "name">, origin: string | null | undefined): void;
}
declare global {

@@ -96,2 +113,5 @@ namespace GraphileBuild {

interfaces?: GraphQLInterfaceType[] | ((context: ContextObjectInterfaces) => GraphQLInterfaceType[]);
assertStep?: TParentStep extends ExecutableStep ? ((step: ExecutableStep) => asserts step is TParentStep) | {
new (...args: any[]): TParentStep;
} : null;
}

@@ -142,3 +162,9 @@ /** Our take on GraphQLInputObjectTypeConfig that allows for plans */

}): boolean;
EXPORTABLE<T, TScope extends any[]>(factory: (...args: TScope) => T, args: [...TScope]): T;
/**
* Use `build.grafast` rather than importing `grafast` directly to try
* and avoid "duplicate" grafast module woes.
*/
grafast: typeof import("grafast");
/**
* Use `build.graphql` rather than importing `graphql` directly to try

@@ -184,5 +210,3 @@ * and avoid "duplicate" graphql module woes.

*/
registerObjectType<TStep extends ExecutableStep | null>(typeName: string, scope: ScopeObject, Step: TStep extends ExecutableStep ? ((step: ExecutableStep) => asserts step is TStep) | {
new (...args: any[]): TStep;
} : null, specGenerator: () => Omit<GrafastObjectTypeConfig<TStep, any>, "name">, origin: string | null | undefined): void;
registerObjectType: RegisterObjectType;
/** As registerObjectType, but for interfaces */

@@ -625,2 +649,3 @@ registerInterfaceType: (typeName: string, scope: ScopeInterface, specGenerator: () => Omit<GrafastInterfaceTypeConfig<any, any>, "name">, origin: string | null | undefined) => void;

export type ScopeForType<TType extends GraphQLNamedType | GraphQLSchema> = TType extends GraphQLSchema ? GraphileBuild.ScopeSchema : never;
export {};
//# sourceMappingURL=global.d.ts.map

@@ -7,2 +7,3 @@ "use strict";

require("./interfaces.js");
const grafast = tslib_1.__importStar(require("grafast"));
const graphile_config_1 = require("graphile-config");

@@ -128,2 +129,3 @@ const graphql_1 = require("graphql");

resolvedPreset,
grafast,
};

@@ -130,0 +132,0 @@ pluginContext.set(plugin, context);

@@ -47,2 +47,7 @@ import type { GrafastArgumentConfig, GrafastFieldConfig, GrafastFieldConfigArgumentMap, PromiseOrDirect } from "grafast";

process: AsyncHooks<GraphileConfig.GatherHooks>["process"];
/**
* A copy of `import * from "grafast"` to avoid having to add grafast as a
* dependency.
*/
grafast: typeof import("grafast");
}

@@ -49,0 +54,0 @@ declare global {

55

dist/makeNewBuild.js

@@ -6,2 +6,3 @@ "use strict";

const chalk_1 = tslib_1.__importDefault(require("chalk"));
const grafast = tslib_1.__importStar(require("grafast"));
const graphql_1 = require("graphql");

@@ -16,4 +17,4 @@ const graphql = tslib_1.__importStar(require("graphql"));

/*
import { readFileSync } from "fs";
import { URL } from "url";
import { readFileSync } from "node:fs";
import { URL } from "node:url";
const version: string = JSON.parse(

@@ -23,2 +24,4 @@ readFileSync(new URL("../package.json", import.meta.url), "utf8"),

*/
/** Have we warned the user they're using the 5-arg deprecated registerObjectType call? */
let registerObjectType5argsDeprecatedWarned = false;
/**

@@ -49,3 +52,3 @@ * Makes a new 'Build' object suitable to be passed through the 'build' hook.

// TODO: allow registering a previously constructed type.
function register(klass, typeName, scope, Step, specGenerator, origin) {
function register(klass, typeName, scope, specGenerator, origin) {
if (!this.status.isBuildPhaseComplete || this.status.isInitPhaseComplete) {

@@ -74,3 +77,2 @@ throw new Error("Types may only be registered in the 'init' phase");

origin,
Step,
};

@@ -91,2 +93,4 @@ }

},
EXPORTABLE: utils_js_1.EXPORTABLE,
grafast,
graphql,

@@ -133,19 +137,41 @@ extend(base, extra, hint, behaviorOnConflict = "throw") {

stringTypeSpec: utils_js_1.stringTypeSpec,
registerObjectType(typeName, scope, Step, specGenerator, origin) {
register.call(this, graphql_1.GraphQLObjectType, typeName, scope, Step, specGenerator, origin);
registerObjectType(typeName, scope, assertStepOrSpecGenerator, specGeneratorOrOrigin, possiblyOrigin) {
if (typeof specGeneratorOrOrigin === "function") {
// This is the `@deprecated` path; we'll be removing this
if (!registerObjectType5argsDeprecatedWarned) {
registerObjectType5argsDeprecatedWarned = true;
console.trace(`[DEPRECATED] There is a call to 'registerObject(typeName, scope, assertStep, specGenerator, origin)'; this signature has been deprecated. Please move 'assertStep' into the spec returned by 'stepGenerator' and remove the third argument to give: 'registerObject(typeName, scope, specGenerator, origin)'. This compatibility shim will not be supported for long.`);
}
const assertStep = assertStepOrSpecGenerator;
const specGenerator = specGeneratorOrOrigin;
const origin = possiblyOrigin;
const replacementSpecGenerator = (...args) => {
const spec = specGenerator(...args);
return {
assertStep,
...spec,
};
};
register.call(this, graphql_1.GraphQLObjectType, typeName, scope, replacementSpecGenerator, origin);
}
else {
const specGenerator = assertStepOrSpecGenerator;
const origin = specGeneratorOrOrigin;
register.call(this, graphql_1.GraphQLObjectType, typeName, scope, specGenerator, origin);
}
},
registerUnionType(typeName, scope, specGenerator, origin) {
register.call(this, graphql_1.GraphQLUnionType, typeName, scope, null, specGenerator, origin);
register.call(this, graphql_1.GraphQLUnionType, typeName, scope, specGenerator, origin);
},
registerInterfaceType(typeName, scope, specGenerator, origin) {
register.call(this, graphql_1.GraphQLInterfaceType, typeName, scope, null, specGenerator, origin);
register.call(this, graphql_1.GraphQLInterfaceType, typeName, scope, specGenerator, origin);
},
registerInputObjectType(typeName, scope, specGenerator, origin) {
register.call(this, graphql_1.GraphQLInputObjectType, typeName, scope, null, specGenerator, origin);
register.call(this, graphql_1.GraphQLInputObjectType, typeName, scope, specGenerator, origin);
},
registerScalarType(typeName, scope, specGenerator, origin) {
register.call(this, graphql_1.GraphQLScalarType, typeName, scope, null, specGenerator, origin);
register.call(this, graphql_1.GraphQLScalarType, typeName, scope, specGenerator, origin);
},
registerEnumType(typeName, scope, specGenerator, origin) {
register.call(this, graphql_1.GraphQLEnumType, typeName, scope, null, specGenerator, origin);
register.call(this, graphql_1.GraphQLEnumType, typeName, scope, specGenerator, origin);
},

@@ -182,3 +208,3 @@ assertTypeName(typeName) {

if (details != null) {
const { klass: Constructor, scope, origin, Step } = details;
const { klass: Constructor, scope, origin } = details;
return Object.assign(Object.create(null), {

@@ -188,3 +214,2 @@ Constructor,

origin,
Step,
});

@@ -209,3 +234,3 @@ }

if (details != null) {
const { klass, scope, specGenerator, Step } = details;
const { klass, scope, specGenerator } = details;
const spec = specGenerator();

@@ -217,3 +242,3 @@ // No need to have the user specify name, and they're forbidden from

const finishedBuild = build;
const type = builder.newWithHooks(finishedBuild, klass, spec, scope, Step);
const type = builder.newWithHooks(finishedBuild, klass, spec, scope);
allTypes[typeName] = type;

@@ -220,0 +245,0 @@ if (klass === graphql_1.GraphQLObjectType ||

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

import type { ExecutableStep } from "grafast";
import type { GraphQLNamedType } from "graphql";

@@ -11,5 +10,3 @@ import { GraphQLSchema } from "graphql";

new (spec: SpecForType<TType>): TType;
}, spec: SpecForType<TType>, scope: ScopeForType<TType>, Step?: ((step: ExecutableStep) => asserts step is ExecutableStep) | {
new (...args: any[]): ExecutableStep;
} | null) => TType;
}, spec: SpecForType<TType>, scope: ScopeForType<TType>) => TType;
/**

@@ -16,0 +13,0 @@ * Returns a 'newWithHooks' function suitable for creating GraphQL types with

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

function makeNewWithHooks({ builder }) {
const newWithHooks = function newWithHooks(build, Type, inSpec, inScope, Step) {
const newWithHooks = function newWithHooks(build, Type, inSpec, inScope) {
if (!inScope) {

@@ -148,3 +148,3 @@ // eslint-disable-next-line no-console

};
const Self = new graphql_1.GraphQLObjectType((0, grafast_1.objectSpec)(finalSpec, Step ?? null));
const Self = new graphql_1.GraphQLObjectType((0, grafast_1.objectSpec)(finalSpec));
return Self;

@@ -151,0 +151,0 @@ }

@@ -41,3 +41,4 @@ "use strict";

isConnectionEdgeType: true,
}, grafast_1.ExecutableStep, () => ({
}, () => ({
assertStep: grafast_1.assertEdgeCapableStep,
description: build.wrapDescription(`A \`${typeName}\` edge in the connection.`, "type"),

@@ -70,3 +71,3 @@ fields: ({ fieldWithHooks }) => {

isConnectionType: true,
}, grafast_1.ConnectionStep, () => {
}, () => {
const NodeType = build.getOutputTypeByName(typeName);

@@ -76,2 +77,3 @@ const EdgeType = build.getOutputTypeByName(edgeTypeName);

return {
assertStep: grafast_1.ConnectionStep,
description: build.wrapDescription(`A connection to a list of \`${typeName}\` values.`, "type"),

@@ -116,3 +118,4 @@ fields: ({ fieldWithHooks }) => ({

const { registerObjectType, inflection, graphql: { GraphQLNonNull, GraphQLBoolean }, } = build;
registerObjectType(inflection.builtin("PageInfo"), { isPageInfo: true }, grafast_1.ExecutableStep, () => ({
registerObjectType(inflection.builtin("PageInfo"), { isPageInfo: true }, () => ({
assertStep: grafast_1.assertPageInfoCapableStep,
description: build.wrapDescription("Information about pagination in a connection.", "type"),

@@ -119,0 +122,0 @@ fields: ({ fieldWithHooks }) => ({

@@ -30,7 +30,6 @@ "use strict";

isRootMutation: true,
}, grafast_1.__ValueStep, () => {
return {
description: "The root mutation type which contains root level fields which mutate data.",
};
}, `graphile-build built-in (root mutation type)`);
}, () => ({
assertStep: grafast_1.__ValueStep,
description: "The root mutation type which contains root level fields which mutate data.",
}), `graphile-build built-in (root mutation type)`);
return _;

@@ -37,0 +36,0 @@ },

@@ -31,7 +31,6 @@ "use strict";

isRootQuery: true,
}, grafast_1.__ValueStep, () => {
return {
description: "The root query type which gives access points into the data universe.",
};
}, `graphile-build built-in (root query type)`);
}, () => ({
assertStep: grafast_1.__ValueStep,
description: "The root query type which gives access points into the data universe.",
}), `graphile-build built-in (root query type)`);
return _;

@@ -38,0 +37,0 @@ },

@@ -30,7 +30,6 @@ "use strict";

isRootSubscription: true,
}, grafast_1.__ValueStep, () => {
return {
description: `The root subscription type: contains realtime events you can subscribe to with the \`subscription\` operation.`,
};
}, `graphile-build built-in (root subscription type)`);
}, () => ({
assertStep: grafast_1.__ValueStep,
description: `The root subscription type: contains realtime events you can subscribe to with the \`subscription\` operation.`,
}), `graphile-build built-in (root subscription type)`);
return _;

@@ -37,0 +36,0 @@ },

@@ -9,2 +9,3 @@ "use strict";

const graphql_1 = require("graphql");
const util_1 = require("util");
const behavior_js_1 = require("./behavior.js");

@@ -75,3 +76,5 @@ const makeNewBuild_js_1 = tslib_1.__importDefault(require("./makeNewBuild.js"));

if (!input) {
throw new Error("applyHooks was called with falsy input");
throw new Error(`applyHooks(${JSON.stringify(hookName)}, ...) was called with falsy input ${(0, util_1.inspect)(input, {
colors: true,
})}`);
}

@@ -78,0 +81,0 @@ this.depth++;

{
"name": "graphile-build",
"version": "5.0.0-alpha.10",
"version": "5.0.0-alpha.11",
"description": "Build a GraphQL schema from plugins",

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

"debug": "^4.3.3",
"grafast": "^0.0.1-alpha.9",
"graphile-config": "^0.0.1-alpha.4",

@@ -56,2 +55,4 @@ "lodash": "^4.17.21",

"peerDependencies": {
"grafast": "^0.0.1-alpha.10",
"graphile-config": "^0.0.1-alpha.4",
"graphql": "^16.1.0-experimental-stream-defer.6"

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

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

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

@@ -41,10 +41,8 @@ # graphile-build

<table><tr>
<td align="center"><a href="https://surge.io/"><img src="https://graphile.org/images/sponsors/surge.png" width="90" height="90" alt="Surge" /><br />Surge</a> *</td>
<td align="center"><a href="https://www.the-guild.dev/"><img src="https://graphile.org/images/sponsors/theguild.png" width="90" height="90" alt="The Guild" /><br />The Guild</a> *</td>
<td align="center"><a href="https://dovetailapp.com/"><img src="https://graphile.org/images/sponsors/dovetail.png" width="90" height="90" alt="Dovetail" /><br />Dovetail</a> *</td>
<td align="center"><a href="https://qwick.com/"><img src="https://graphile.org/images/sponsors/qwick.png" width="90" height="90" alt="Qwick" /><br />Qwick</a> *</td>
<td align="center"><a href="https://www.netflix.com/"><img src="https://graphile.org/images/sponsors/Netflix.png" width="90" height="90" alt="Netflix" /><br />Netflix</a> *</td>
</tr><tr>
<td align="center"><a href="https://www.netflix.com/"><img src="https://graphile.org/images/sponsors/Netflix.png" width="90" height="90" alt="Netflix" /><br />Netflix</a> *</td>
<td align="center"><a href=""><img src="https://graphile.org/images/sponsors/chadf.png" width="90" height="90" alt="Chad Furman" /><br />Chad Furman</a> *</td>
<td align="center"><a href="https://www.enzuzo.com/"><img src="https://graphile.org/images/sponsors/enzuzo.png" width="90" height="90" alt="Enzuzo" /><br />Enzuzo</a> *</td>
<td align="center"><a href="https://stellate.co/"><img src="https://graphile.org/images/sponsors/Stellate.png" width="90" height="90" alt="Stellate" /><br />Stellate</a> *</td>

@@ -51,0 +49,0 @@ </tr></table>

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

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