graphile-build
Advanced tools
Comparing version 5.0.0-beta.20 to 5.0.0-beta.21
# graphile-build | ||
## 5.0.0-beta.21 | ||
### Patch Changes | ||
- [#2071](https://github.com/graphile/crystal/pull/2071) | ||
[`582bd768f`](https://github.com/graphile/crystal/commit/582bd768fec403ce3284f293b85b9fd86e4d3f40) | ||
Thanks [@benjie](https://github.com/benjie)! - `GrafastExecutionArgs` now | ||
accepts `resolvedPreset` and `requestContext` directly; passing these through | ||
additional arguments is now deprecated and support will be removed in a future | ||
revision. This affects: | ||
- `grafast()` | ||
- `execute()` | ||
- `subscribe()` | ||
- `hookArgs()` | ||
`graphile-config` has gained a middleware system which is more powerful than | ||
it's AsyncHooks system. Old hooks can be emulated through the middleware | ||
system safely since middleware is a superset of hooks' capabilities. | ||
`applyHooks` has been renamed to `orderedApply` (because it applies to more | ||
than just hooks), calling `applyHooks` will still work but is deprecated. | ||
🚨 `grafast` no longer automatically reads your `graphile.config.ts` or | ||
similar; you must do that yourself and pass the `resolvedPreset` to grafast | ||
via the `args`. This is to aid in bundling of grafast since it should not need | ||
to read from filesystem or dynamically load modules. | ||
`grafast` no longer outputs performance warning when you set | ||
`GRAPHILE_ENV=development`. | ||
🚨 `plugin.grafast.hooks.args` is now `plugin.grafast.middleware.prepareArgs`, | ||
and the signature has changed - you must be sure to call the `next()` function | ||
and ctx/resolvedPreset can be extracted directly from `args`: | ||
```diff | ||
const plugin = { | ||
grafast: { | ||
- hooks: { | ||
+ middleware: { | ||
- args({ args, ctx, resolvedPreset }) { | ||
+ prepareArgs(next, { args }) { | ||
+ const { requestContext: ctx, resolvedPreset } = args; | ||
// ... | ||
+ return next(); | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
Many more middleware have been added; use TypeScript's autocomplete to see | ||
what's available until we have proper documentation for them. | ||
`plugin.grafserv.hooks.*` are still supported but deprecated; instead use | ||
middleware `plugin.grafserv.middleware.*` (note that call signatures have | ||
changed slightly, similar to the diff above): | ||
- `hooks.init` -> `middleware.setPreset` | ||
- `hooks.processGraphQLRequestBody` -> `middleware.processGraphQLRequestBody` | ||
- `hooks.ruruHTMLParts` -> `middleware.ruruHTMLParts` | ||
A few TypeScript types related to Hooks have been renamed, but their old names | ||
are still available, just deprecated. They will be removed in a future update: | ||
- `HookObject` -> `FunctionalityObject` | ||
- `PluginHook` -> `CallbackOrDescriptor` | ||
- `PluginHookObject` -> `CallbackDescriptor` | ||
- `PluginHookCallback` -> `UnwrapCallback` | ||
- Updated dependencies | ||
[[`582bd768f`](https://github.com/graphile/crystal/commit/582bd768fec403ce3284f293b85b9fd86e4d3f40)]: | ||
- graphile-config@0.0.1-beta.9 | ||
- grafast@0.1.1-beta.11 | ||
## 5.0.0-beta.20 | ||
@@ -4,0 +78,0 @@ |
@@ -68,3 +68,3 @@ "use strict"; | ||
]), build); | ||
(0, graphile_config_1.applyHooks)(resolvedPreset.plugins, getEntityBehaviorHooks, (hookName, hookFn, plugin) => { | ||
(0, graphile_config_1.orderedApply)(resolvedPreset.plugins, getEntityBehaviorHooks, (hookName, hookFn, plugin) => { | ||
const entityType = hookName; | ||
@@ -71,0 +71,0 @@ if (!this.behaviorEntities[entityType]) { |
@@ -72,3 +72,3 @@ "use strict"; | ||
// Overwrite the inflectors | ||
(0, graphile_config_1.applyHooks)(plugins, (plugin) => plugin.inflection?.replace, (inflectorName, replacementFunction, plugin) => { | ||
(0, graphile_config_1.orderedApply)(plugins, (plugin) => plugin.inflection?.replace, (inflectorName, replacementFunction, plugin) => { | ||
const previous = inflectors[inflectorName]; | ||
@@ -150,3 +150,3 @@ const ignore = plugin.inflection?.ignoreReplaceIfNotExists ?? []; | ||
// Register the hooks | ||
(0, graphile_config_1.applyHooks)(gatherPlugins, (p) => p.gather.hooks, (name, fn, plugin) => { | ||
(0, graphile_config_1.orderedApply)(gatherPlugins, (p) => p.gather.hooks, (name, fn, plugin) => { | ||
const context = pluginContext.get(plugin); | ||
@@ -153,0 +153,0 @@ // hooks.hook(name, (...args) => fn(context, ...args)); |
@@ -33,3 +33,3 @@ "use strict"; | ||
this.newWithHooks = (0, index_js_1.makeNewWithHooks)({ builder: this }).newWithHooks; | ||
(0, graphile_config_1.applyHooks)(resolvedPreset.plugins, getSchemaHooks, (hookName, hookFn, plugin) => { | ||
(0, graphile_config_1.orderedApply)(resolvedPreset.plugins, getSchemaHooks, (hookName, hookFn, plugin) => { | ||
this._setPluginName(plugin.name); | ||
@@ -36,0 +36,0 @@ this.hook(hookName, hookFn); |
@@ -1,2 +0,2 @@ | ||
export declare const version = "5.0.0-beta.20"; | ||
export declare const version = "5.0.0-beta.21"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
// This file is autogenerated by /scripts/postversion.mjs | ||
exports.version = "5.0.0-beta.20"; | ||
exports.version = "5.0.0-beta.21"; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "graphile-build", | ||
"version": "5.0.0-beta.20", | ||
"version": "5.0.0-beta.21", | ||
"description": "Build a GraphQL schema from plugins", | ||
@@ -44,3 +44,3 @@ "type": "commonjs", | ||
"debug": "^4.3.4", | ||
"graphile-config": "^0.0.1-beta.8", | ||
"graphile-config": "^0.0.1-beta.9", | ||
"graphql": "^16.1.0-experimental-stream-defer.6", | ||
@@ -57,4 +57,4 @@ "lodash": "^4.17.21", | ||
"peerDependencies": { | ||
"grafast": "^0.1.1-beta.10", | ||
"graphile-config": "^0.0.1-beta.8", | ||
"grafast": "^0.1.1-beta.11", | ||
"graphile-config": "^0.0.1-beta.9", | ||
"graphql": "^16.1.0-experimental-stream-defer.6" | ||
@@ -69,3 +69,3 @@ }, | ||
"@types/jest": "^29.5.4", | ||
"graphile-export": "^0.0.2-beta.15", | ||
"graphile-export": "^0.0.2-beta.16", | ||
"graphql": "16.1.0-experimental-stream-defer.6", | ||
@@ -72,0 +72,0 @@ "jest": "^29.6.4", |
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
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
468181