graphile-config 0.0.1-alpha.7 → 0.0.1-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,11 +1,176 @@
1
1
  # graphile-config
2
2
 
3
+ ## 0.0.1-beta.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2188](https://github.com/graphile/crystal/pull/2188)
8
+ [`cc0941731`](https://github.com/graphile/crystal/commit/cc0941731a1679bc04ce7b7fd4254009bb5f1f62)
9
+ Thanks [@benjie](https://github.com/benjie)! - Overhaul the way in which
10
+ `graphile-config` presets work such that including a preset at two different
11
+ layers shouldn't result in unexpected behavior.
12
+
13
+ - [#2155](https://github.com/graphile/crystal/pull/2155)
14
+ [`8b472cd51`](https://github.com/graphile/crystal/commit/8b472cd51cd66d8227f9f2722d09c0a774792b0f)
15
+ Thanks [@benjie](https://github.com/benjie)! - `disablePlugins` now supports
16
+ TypeScript auto-completion of known plugin names. Other names are still
17
+ accepted without error, so this is just a minor DX improvement rather than
18
+ type safety.
19
+
20
+ - [#2160](https://github.com/graphile/crystal/pull/2160)
21
+ [`9cd9bb522`](https://github.com/graphile/crystal/commit/9cd9bb5222a9f0398ee4b8bfa4f741b6de2a2192)
22
+ Thanks [@benjie](https://github.com/benjie)! - Add support for lists of hook
23
+ objects, so that the same hook can be applied multiple times in the same
24
+ plugin but with different priorities.
25
+
26
+ ## 0.0.1-beta.9
27
+
28
+ ### Patch Changes
29
+
30
+ - [#2071](https://github.com/graphile/crystal/pull/2071)
31
+ [`582bd768f`](https://github.com/graphile/crystal/commit/582bd768fec403ce3284f293b85b9fd86e4d3f40)
32
+ Thanks [@benjie](https://github.com/benjie)! - `GrafastExecutionArgs` now
33
+ accepts `resolvedPreset` and `requestContext` directly; passing these through
34
+ additional arguments is now deprecated and support will be removed in a future
35
+ revision. This affects:
36
+
37
+ - `grafast()`
38
+ - `execute()`
39
+ - `subscribe()`
40
+ - `hookArgs()`
41
+
42
+ `graphile-config` has gained a middleware system which is more powerful than
43
+ it's AsyncHooks system. Old hooks can be emulated through the middleware
44
+ system safely since middleware is a superset of hooks' capabilities.
45
+ `applyHooks` has been renamed to `orderedApply` (because it applies to more
46
+ than just hooks), calling `applyHooks` will still work but is deprecated.
47
+
48
+ 🚨 `grafast` no longer automatically reads your `graphile.config.ts` or
49
+ similar; you must do that yourself and pass the `resolvedPreset` to grafast
50
+ via the `args`. This is to aid in bundling of grafast since it should not need
51
+ to read from filesystem or dynamically load modules.
52
+
53
+ `grafast` no longer outputs performance warning when you set
54
+ `GRAPHILE_ENV=development`.
55
+
56
+ 🚨 `plugin.grafast.hooks.args` is now `plugin.grafast.middleware.prepareArgs`,
57
+ and the signature has changed - you must be sure to call the `next()` function
58
+ and ctx/resolvedPreset can be extracted directly from `args`:
59
+
60
+ ```diff
61
+ const plugin = {
62
+ grafast: {
63
+ - hooks: {
64
+ + middleware: {
65
+ - args({ args, ctx, resolvedPreset }) {
66
+ + prepareArgs(next, { args }) {
67
+ + const { requestContext: ctx, resolvedPreset } = args;
68
+ // ...
69
+ + return next();
70
+ }
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ Many more middleware have been added; use TypeScript's autocomplete to see
77
+ what's available until we have proper documentation for them.
78
+
79
+ `plugin.grafserv.hooks.*` are still supported but deprecated; instead use
80
+ middleware `plugin.grafserv.middleware.*` (note that call signatures have
81
+ changed slightly, similar to the diff above):
82
+
83
+ - `hooks.init` -> `middleware.setPreset`
84
+ - `hooks.processGraphQLRequestBody` -> `middleware.processGraphQLRequestBody`
85
+ - `hooks.ruruHTMLParts` -> `middleware.ruruHTMLParts`
86
+
87
+ A few TypeScript types related to Hooks have been renamed, but their old names
88
+ are still available, just deprecated. They will be removed in a future update:
89
+
90
+ - `HookObject` -> `FunctionalityObject`
91
+ - `PluginHook` -> `CallbackOrDescriptor`
92
+ - `PluginHookObject` -> `CallbackDescriptor`
93
+ - `PluginHookCallback` -> `UnwrapCallback`
94
+
95
+ ## 0.0.1-beta.8
96
+
97
+ ### Patch Changes
98
+
99
+ - [#2048](https://github.com/graphile/crystal/pull/2048)
100
+ [`db8ceed0f`](https://github.com/graphile/crystal/commit/db8ceed0f17923eb78ff09c9f3f28800a5c7e3b6)
101
+ Thanks [@benjie](https://github.com/benjie)! - Help detect more invalid
102
+ presets and plugins (bad imports) by forbidding keys starting with a capital
103
+ or the key `default`.
104
+
105
+ ## 0.0.1-beta.7
106
+
107
+ ### Patch Changes
108
+
109
+ - [#1930](https://github.com/graphile/crystal/pull/1930)
110
+ [`5de3e86eb`](https://github.com/graphile/crystal/commit/5de3e86eba1ddfe5e07732d0325c63e5d72d4b5b)
111
+ Thanks [@benjie](https://github.com/benjie)! - Prevent using
112
+ appendPlugins/prependPlugins/skipPlugins in presets.
113
+
114
+ ## 0.0.1-beta.6
115
+
116
+ ### Patch Changes
117
+
118
+ - [#1892](https://github.com/graphile/crystal/pull/1892)
119
+ [`0df5511ac`](https://github.com/graphile/crystal/commit/0df5511ac8b79ea34f8d12ebf8feeb421f8fe971)
120
+ Thanks [@benjie](https://github.com/benjie)! - Fix plugin ordering bug that
121
+ ignored before/after when there was no provider; this now means
122
+ PgSmartTagsPlugin is correctly loaded before PgFakeConstraintPlugin, fixing
123
+ the `postgraphile.tags.json5` file.
124
+
125
+ ## 0.0.1-beta.5
126
+
127
+ ### Patch Changes
128
+
129
+ - [#1877](https://github.com/graphile/crystal/pull/1877)
130
+ [`8a0cdb95f`](https://github.com/graphile/crystal/commit/8a0cdb95f200b28b0ea1ab5caa12b23dce5f374f)
131
+ Thanks [@benjie](https://github.com/benjie)! - Move 'declare global' out of
132
+ 'interfaces.ts' and into 'index.ts' or equivalent. Should make TypeScript more
133
+ aware of these types.
134
+
135
+ ## 0.0.1-beta.4
136
+
137
+ ### Patch Changes
138
+
139
+ - [`7aef73319`](https://github.com/graphile/crystal/commit/7aef73319a8a147c700727be62427e1eefdefbf8)
140
+ Thanks [@benjie](https://github.com/benjie)! - TypeScript tweak to use
141
+ readonly array in one place.
142
+
143
+ ## 0.0.1-beta.3
144
+
145
+ ### Patch Changes
146
+
147
+ - [#514](https://github.com/graphile/crystal-pre-merge/pull/514)
148
+ [`c9848f693`](https://github.com/graphile/crystal-pre-merge/commit/c9848f6936a5abd7740c0638bfb458fb5551f03b)
149
+ Thanks [@benjie](https://github.com/benjie)! - Update package.json repository
150
+ information
151
+
152
+ ## 0.0.1-beta.2
153
+
154
+ ### Patch Changes
155
+
156
+ - [#496](https://github.com/benjie/crystal/pull/496)
157
+ [`c9bfd9892`](https://github.com/benjie/crystal/commit/c9bfd989247f9433fb5b18c5175c9d8d64cd21a1)
158
+ Thanks [@benjie](https://github.com/benjie)! - Update dependencies (sometimes
159
+ through major versions).
160
+
161
+ ## 0.0.1-beta.1
162
+
163
+ ### Patch Changes
164
+
165
+ - [`cbd987385`](https://github.com/benjie/crystal/commit/cbd987385f99bd1248bc093ac507cc2f641ba3e8)
166
+ Thanks [@benjie](https://github.com/benjie)! - Bump all packages to beta
167
+
3
168
  ## 0.0.1-alpha.7
4
169
 
5
170
  ### Patch Changes
6
171
 
7
- - [#438](https://github.com/benjie/postgraphile-private/pull/438)
8
- [`a22830b2f`](https://github.com/benjie/postgraphile-private/commit/a22830b2f293b50a244ac18e1601d7579b450c7d)
172
+ - [#438](https://github.com/benjie/crystal/pull/438)
173
+ [`a22830b2f`](https://github.com/benjie/crystal/commit/a22830b2f293b50a244ac18e1601d7579b450c7d)
9
174
  Thanks [@benjie](https://github.com/benjie)! - Plugin name now automatically
10
175
  used in `provides` for every hook, allowing ordering hooks before/after their
11
176
  equivalents in other plugins.
@@ -14,18 +179,18 @@
14
179
 
15
180
  ### Patch Changes
16
181
 
17
- - [#408](https://github.com/benjie/postgraphile-private/pull/408)
18
- [`675b7abb9`](https://github.com/benjie/postgraphile-private/commit/675b7abb93e11d955930b9026fb0b65a56ecc999)
182
+ - [#408](https://github.com/benjie/crystal/pull/408)
183
+ [`675b7abb9`](https://github.com/benjie/crystal/commit/675b7abb93e11d955930b9026fb0b65a56ecc999)
19
184
  Thanks [@benjie](https://github.com/benjie)! - `inspect()` fallback function
20
185
  updated
21
186
 
22
- - [#408](https://github.com/benjie/postgraphile-private/pull/408)
23
- [`c5050dd28`](https://github.com/benjie/postgraphile-private/commit/c5050dd286bd6d9fa4a5d9cfbf87ba609cb148dd)
187
+ - [#408](https://github.com/benjie/crystal/pull/408)
188
+ [`c5050dd28`](https://github.com/benjie/crystal/commit/c5050dd286bd6d9fa4a5d9cfbf87ba609cb148dd)
24
189
  Thanks [@benjie](https://github.com/benjie)! - Warn if plugins could not be
25
190
  disabled (due to not being specified).
26
191
 
27
- - [#408](https://github.com/benjie/postgraphile-private/pull/408)
28
- [`0d1782869`](https://github.com/benjie/postgraphile-private/commit/0d1782869adc76f5bbcecfdcbb85a258c468ca37)
192
+ - [#408](https://github.com/benjie/crystal/pull/408)
193
+ [`0d1782869`](https://github.com/benjie/crystal/commit/0d1782869adc76f5bbcecfdcbb85a258c468ca37)
29
194
  Thanks [@benjie](https://github.com/benjie)! - Only eat ENOENT errors when
30
195
  checking for file existance, other errors should still throw.
31
196
 
@@ -33,8 +198,8 @@
33
198
 
34
199
  ### Patch Changes
35
200
 
36
- - [#402](https://github.com/benjie/postgraphile-private/pull/402)
37
- [`644938276`](https://github.com/benjie/postgraphile-private/commit/644938276ebd48c5486ba9736a525fcc66d7d714)
201
+ - [#402](https://github.com/benjie/crystal/pull/402)
202
+ [`644938276`](https://github.com/benjie/crystal/commit/644938276ebd48c5486ba9736a525fcc66d7d714)
38
203
  Thanks [@benjie](https://github.com/benjie)! - Use `file://` URLs in import()
39
204
  to fix compatibility with Windows (e.g. when loading `graphile.config.mjs`)
40
205
 
@@ -42,8 +207,8 @@
42
207
 
43
208
  ### Patch Changes
44
209
 
45
- - [#349](https://github.com/benjie/postgraphile-private/pull/349)
46
- [`198ac74d5`](https://github.com/benjie/postgraphile-private/commit/198ac74d52fe1e47d602fe2b7c52f216d5216b25)
210
+ - [#349](https://github.com/benjie/crystal/pull/349)
211
+ [`198ac74d5`](https://github.com/benjie/crystal/commit/198ac74d52fe1e47d602fe2b7c52f216d5216b25)
47
212
  Thanks [@benjie](https://github.com/benjie)! - Add 'sortedPlugins' export to
48
213
  graphile-config.
49
214
 
@@ -51,8 +216,8 @@
51
216
 
52
217
  ### Patch Changes
53
218
 
54
- - [#344](https://github.com/benjie/postgraphile-private/pull/344)
55
- [`adc7ae5e0`](https://github.com/benjie/postgraphile-private/commit/adc7ae5e002961c8b8286500527752f21139ab9e)
219
+ - [#344](https://github.com/benjie/crystal/pull/344)
220
+ [`adc7ae5e0`](https://github.com/benjie/crystal/commit/adc7ae5e002961c8b8286500527752f21139ab9e)
56
221
  Thanks [@benjie](https://github.com/benjie)! - Detect presets that look like
57
222
  plugins and vice versa and throw error.
58
223
 
@@ -60,7 +225,7 @@
60
225
 
61
226
  ### Patch Changes
62
227
 
63
- - [`7f857950a`](https://github.com/benjie/postgraphile-private/commit/7f857950a7e4ec763c936eb6bd1fb77824041d71)
228
+ - [`7f857950a`](https://github.com/benjie/crystal/commit/7f857950a7e4ec763c936eb6bd1fb77824041d71)
64
229
  Thanks [@benjie](https://github.com/benjie)! - Upgrade to the latest
65
230
  TypeScript/tslib
66
231
 
@@ -68,7 +233,7 @@
68
233
 
69
234
  ### Patch Changes
70
235
 
71
- - [`759ad403d`](https://github.com/benjie/postgraphile-private/commit/759ad403d71363312c5225c165873ae84b8a098c)
236
+ - [`759ad403d`](https://github.com/benjie/crystal/commit/759ad403d71363312c5225c165873ae84b8a098c)
72
237
  Thanks [@benjie](https://github.com/benjie)! - Alpha release - see
73
238
  https://postgraphile.org/news/2023-04-26-version-5-alpha
74
239
 
@@ -76,8 +241,8 @@
76
241
 
77
242
  ### Patch Changes
78
243
 
79
- - [#297](https://github.com/benjie/postgraphile-private/pull/297)
80
- [`b4eaf89f4`](https://github.com/benjie/postgraphile-private/commit/b4eaf89f401ca207de08770361d07903f6bb9cb0)
244
+ - [#297](https://github.com/benjie/crystal/pull/297)
245
+ [`b4eaf89f4`](https://github.com/benjie/crystal/commit/b4eaf89f401ca207de08770361d07903f6bb9cb0)
81
246
  Thanks [@benjie](https://github.com/benjie)! - AsyncHooks can now execute
82
247
  synchronously if all registered hooks are synchronous. May impact ordering of
83
248
  fields/types in GraphQL schema.
@@ -86,16 +251,16 @@
86
251
 
87
252
  ### Patch Changes
88
253
 
89
- - [#260](https://github.com/benjie/postgraphile-private/pull/260)
90
- [`d5312e6b9`](https://github.com/benjie/postgraphile-private/commit/d5312e6b968fbeb46d074b82a41b4bdbc166598c)
254
+ - [#260](https://github.com/benjie/crystal/pull/260)
255
+ [`d5312e6b9`](https://github.com/benjie/crystal/commit/d5312e6b968fbeb46d074b82a41b4bdbc166598c)
91
256
  Thanks [@benjie](https://github.com/benjie)! - TypeScript v5 is now required
92
257
 
93
258
  ## 0.0.1-0.6
94
259
 
95
260
  ### Patch Changes
96
261
 
97
- - [#233](https://github.com/benjie/postgraphile-private/pull/233)
98
- [`11e7c12c5`](https://github.com/benjie/postgraphile-private/commit/11e7c12c5a3545ee24b5e39392fbec190aa1cf85)
262
+ - [#233](https://github.com/benjie/crystal/pull/233)
263
+ [`11e7c12c5`](https://github.com/benjie/crystal/commit/11e7c12c5a3545ee24b5e39392fbec190aa1cf85)
99
264
  Thanks [@benjie](https://github.com/benjie)! - Solve mutation issue in plugin
100
265
  ordering code which lead to heisenbugs.
101
266
 
@@ -109,8 +274,8 @@
109
274
 
110
275
  ### Patch Changes
111
276
 
112
- - [#184](https://github.com/benjie/postgraphile-private/pull/184)
113
- [`842f6ccbb`](https://github.com/benjie/postgraphile-private/commit/842f6ccbb3c9bd0c101c4f4df31c5ed1aea9b2ab)
277
+ - [#184](https://github.com/benjie/crystal/pull/184)
278
+ [`842f6ccbb`](https://github.com/benjie/crystal/commit/842f6ccbb3c9bd0c101c4f4df31c5ed1aea9b2ab)
114
279
  Thanks [@benjie](https://github.com/benjie)! - Handle array-to-object issue in
115
280
  graphile-config when multiple presets set an array key.
116
281
 
@@ -118,14 +283,14 @@
118
283
 
119
284
  ### Patch Changes
120
285
 
121
- - [#176](https://github.com/benjie/postgraphile-private/pull/176)
122
- [`19e2961de`](https://github.com/benjie/postgraphile-private/commit/19e2961de67dc0b9601799bba256e4c4a23cc0cb)
286
+ - [#176](https://github.com/benjie/crystal/pull/176)
287
+ [`19e2961de`](https://github.com/benjie/crystal/commit/19e2961de67dc0b9601799bba256e4c4a23cc0cb)
123
288
  Thanks [@benjie](https://github.com/benjie)! - Better graphile.config.\*
124
289
  compatibility with ESM-emulation, so 'export default preset;' should work in
125
290
  TypeScript even if outputting to CommonJS.
126
291
 
127
- - [#176](https://github.com/benjie/postgraphile-private/pull/176)
128
- [`11d6be65e`](https://github.com/benjie/postgraphile-private/commit/11d6be65e0da489f8ab3e3a8b8db145f8b2147ad)
292
+ - [#176](https://github.com/benjie/crystal/pull/176)
293
+ [`11d6be65e`](https://github.com/benjie/crystal/commit/11d6be65e0da489f8ab3e3a8b8db145f8b2147ad)
129
294
  Thanks [@benjie](https://github.com/benjie)! - Fix issue with plugin
130
295
  versioning. Add more TSDoc comments. New getTerminalWidth() helper.
131
296
 
@@ -146,6 +311,6 @@
146
311
 
147
312
  ### Patch Changes
148
313
 
149
- - [#125](https://github.com/benjie/postgraphile-private/pull/125)
150
- [`91f2256b3`](https://github.com/benjie/postgraphile-private/commit/91f2256b3fd699bec19fc86f1ca79df057e58639)
314
+ - [#125](https://github.com/benjie/crystal/pull/125)
315
+ [`91f2256b3`](https://github.com/benjie/crystal/commit/91f2256b3fd699bec19fc86f1ca79df057e58639)
151
316
  Thanks [@benjie](https://github.com/benjie)! - Initial changesets release
package/README.md CHANGED
@@ -115,9 +115,9 @@ preset to enable compatibility with the various ESM emulations.
115
115
 
116
116
  ## Crowd-funded open-source software
117
117
 
118
- To help us develop this software sustainably under the MIT license, we ask all
119
- individuals and businesses that use it to help support its ongoing maintenance
120
- and development via sponsorship.
118
+ To help us develop this software sustainably, we ask all individuals and
119
+ businesses that use it to help support its ongoing maintenance and development
120
+ via sponsorship.
121
121
 
122
122
  ### [Click here to find out more about sponsors and sponsorship.](https://www.graphile.org/sponsor/)
123
123
 
@@ -126,12 +126,10 @@ And please give some love to our featured sponsors 🤩:
126
126
  <table><tr>
127
127
  <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>
128
128
  <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>
129
- <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>
130
- <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>
131
- </tr><tr>
132
- <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>
133
129
  <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>
134
- <td align="center"><a href="https://www.accenture.com/"><img src="https://graphile.org/images/sponsors/accenture.svg" width="90" height="90" alt="Accenture" /><br />Accenture</a> *</td>
130
+ <td align="center"><a href="https://gosteelhead.com/"><img src="https://graphile.org/images/sponsors/steelhead.svg" width="90" height="90" alt="Steelhead" /><br />Steelhead</a> *</td>
131
+ </tr><tr>
132
+ <td align="center"><a href=""><img src="https://graphile.org/images/sponsors/latchbio.jpg" width="90" height="90" alt="LatchBio" /><br />LatchBio</a> *</td>
135
133
  </tr></table>
136
134
 
137
135
  <em>\* Sponsors the entire Graphile suite</em>
@@ -0,0 +1,3 @@
1
+ import type { CallbackDescriptor, CallbackOrDescriptor, FunctionalityObject } from "./interfaces.js";
2
+ export declare function orderedApply<TFunctionality extends FunctionalityObject<TFunctionality>>(plugins: readonly GraphileConfig.Plugin[] | undefined, functionalityRetriever: (plugin: GraphileConfig.Plugin) => Partial<TFunctionality> | undefined, applyCallback: <TFunctionalityName extends keyof TFunctionality>(functionalityName: TFunctionalityName, hookFn: TFunctionality[TFunctionalityName] extends CallbackOrDescriptor<infer U> ? U : TFunctionality[TFunctionalityName] extends ReadonlyArray<CallbackDescriptor<infer U>> ? U : never, plugin: GraphileConfig.Plugin) => void): void;
3
+ //# sourceMappingURL=functionality.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functionality.d.ts","sourceRoot":"","sources":["../src/functionality.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EAEpB,MAAM,iBAAiB,CAAC;AAkBzB,wBAAgB,YAAY,CAC1B,cAAc,SAAS,mBAAmB,CAAC,cAAc,CAAC,EAE1D,OAAO,EAAE,SAAS,cAAc,CAAC,MAAM,EAAE,GAAG,SAAS,EACrD,sBAAsB,EAAE,CACtB,MAAM,EAAE,cAAc,CAAC,MAAM,KAC1B,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,EACxC,aAAa,EAAE,CAAC,kBAAkB,SAAS,MAAM,cAAc,EAC7D,iBAAiB,EAAE,kBAAkB,EACrC,MAAM,EAAE,cAAc,CAAC,kBAAkB,CAAC,SAAS,oBAAoB,CACrE,MAAM,CAAC,CACR,GACG,CAAC,GACD,cAAc,CAAC,kBAAkB,CAAC,SAAS,aAAa,CACtD,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAC5B,GACD,CAAC,GACD,KAAK,EACT,MAAM,EAAE,cAAc,CAAC,MAAM,KAC1B,IAAI,GACR,IAAI,CAgFN"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.orderedApply = void 0;
4
+ const sort_js_1 = require("./sort.js");
5
+ // TypeScript nonsense
6
+ const isCallbackDescriptor = (v) => typeof v !== "function";
7
+ const isCallback = (v) => typeof v === "function";
8
+ function isArray(arg) {
9
+ return Array.isArray(arg);
10
+ }
11
+ function orderedApply(plugins, functionalityRetriever, applyCallback) {
12
+ // Normalize all the hooks and gather them into collections
13
+ const allFunctionalities = Object.create(null);
14
+ let uid = 0;
15
+ if (plugins) {
16
+ for (const plugin of plugins) {
17
+ const hooks = functionalityRetriever(plugin);
18
+ if (!hooks) {
19
+ continue;
20
+ }
21
+ const keys = Object.keys(hooks);
22
+ for (const key of keys) {
23
+ const value = hooks[key];
24
+ if (!value) {
25
+ continue;
26
+ }
27
+ const hookList = isArray(value) ? value : [value];
28
+ for (const hookSpecRaw of hookList) {
29
+ const callback = (isCallback(hookSpecRaw) ? hookSpecRaw : hookSpecRaw.callback);
30
+ const { provides, before, after } = isCallbackDescriptor(hookSpecRaw)
31
+ ? hookSpecRaw
32
+ : {};
33
+ if (!allFunctionalities[key]) {
34
+ allFunctionalities[key] = [];
35
+ }
36
+ // We need to give each functionality a unique ID
37
+ const id = String(uid++);
38
+ allFunctionalities[key].push({
39
+ id,
40
+ plugin,
41
+ callback,
42
+ provides: [...(provides || []), id, plugin.name],
43
+ before: before || [],
44
+ after: after || [],
45
+ });
46
+ }
47
+ }
48
+ }
49
+ }
50
+ // Sort the collections according to provides, before and after.
51
+ for (const functionalityName in allFunctionalities) {
52
+ const functionalities = allFunctionalities[functionalityName];
53
+ if (!functionalities) {
54
+ continue;
55
+ }
56
+ const final = (0, sort_js_1.sortWithBeforeAfterProvides)(functionalities, "id");
57
+ // Finally we can register the functionalities
58
+ for (const functionality of final) {
59
+ applyCallback(functionalityName, functionality.callback, functionality.plugin);
60
+ }
61
+ }
62
+ }
63
+ exports.orderedApply = orderedApply;
64
+ //# sourceMappingURL=functionality.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functionality.js","sourceRoot":"","sources":["../src/functionality.ts"],"names":[],"mappings":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C,WAAW,CAAC;wBACnE,CAAC,CAAC,WAAW;wBACb,CAAC,CAAE,EAA8D,CAAC;oBACpE,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE;wBAC5B,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;qBAC9B;oBACD,iDAAiD;oBACjD,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;oBACzB,kBAAkB,CAAC,GAAG,CAAE,CAAC,IAAI,CAAC;wBAC5B,EAAE;wBACF,MAAM;wBACN,QAAQ;wBACR,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC;wBAChD,MAAM,EAAE,MAAM,IAAI,EAAE;wBACpB,KAAK,EAAE,KAAK,IAAI,EAAE;qBACnB,CAAC,CAAC;iBACJ;aACF;SACF;KACF;IAED,gEAAgE;IAChE,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,EAAE;QAClD,MAAM,eAAe,GAAG,kBAAkB,CAAC,iBAAiB,CAE/C,CAAC;QACd,IAAI,CAAC,eAAe,EAAE;YACpB,SAAS;SACV;QAED,MAAM,KAAK,GAAG,IAAA,qCAA2B,EAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QAEjE,8CAA8C;QAC9C,KAAK,MAAM,aAAa,IAAI,KAAK,EAAE;YACjC,aAAa,CACX,iBAAiB,EACjB,aAAa,CAAC,QAAQ,EACtB,aAAa,CAAC,MAAM,CACrB,CAAC;SACH;KACF;AACH,CAAC;AApGD,oCAoGC"}
package/dist/hooks.d.ts CHANGED
@@ -1,15 +1,24 @@
1
- import type { PluginHook } from "./interfaces.js";
2
- export type HookObject<T> = Record<keyof T, PluginHook<(...args: any[]) => any>>;
3
- export declare class AsyncHooks<THooks extends HookObject<THooks>> {
1
+ import { orderedApply } from "./functionality.js";
2
+ import type { CallbackDescriptor, CallbackOrDescriptor, FunctionalityObject, PromiseOrDirect, UnwrapCallback } from "./interfaces.js";
3
+ export declare class AsyncHooks<THooks extends FunctionalityObject<THooks>> {
4
4
  callbacks: {
5
- [key in keyof THooks]?: Array<THooks[keyof THooks] extends PluginHook<infer U> ? U : never>;
5
+ [key in keyof THooks]?: Array<THooks[keyof THooks] extends CallbackOrDescriptor<infer U> ? U : never>;
6
6
  };
7
- hook<THookName extends keyof THooks>(event: THookName, fn: THooks[THookName] extends PluginHook<infer U> ? U : never): void;
7
+ hook<THookName extends keyof THooks>(event: THookName, fn: THooks[THookName] extends CallbackOrDescriptor<infer U> ? U : never): void;
8
8
  /**
9
9
  * Hooks can _mutate_ the argument, they cannot return a replacement. This
10
10
  * allows us to completely side-step the problem of recursive calls.
11
11
  */
12
- process<THookName extends keyof THooks>(event: THookName, ...args: Parameters<THooks[THookName] extends PluginHook<infer U> ? U : never>): void | Promise<void>;
12
+ process<THookName extends keyof THooks>(hookName: THookName, ...args: Parameters<THooks[THookName] extends CallbackOrDescriptor<infer U> ? U : never>): void | Promise<void>;
13
13
  }
14
- export declare function applyHooks<THooks extends HookObject<THooks>>(plugins: GraphileConfig.Plugin[] | undefined, hooksRetriever: (plugin: GraphileConfig.Plugin) => Partial<THooks> | undefined, applyHookCallback: <THookName extends keyof THooks>(hookName: THookName, hookFn: THooks[THookName] extends PluginHook<infer U> ? U : never, plugin: GraphileConfig.Plugin) => void): void;
14
+ /** @deprecated Use FunctionalityObject */
15
+ export type HookObject<T> = FunctionalityObject<T>;
16
+ /** @deprecated Use `orderedApply` */
17
+ export declare const applyHooks: typeof orderedApply;
18
+ /** @deprecated Use CallbackDescriptor */
19
+ export type PluginHookObject<T extends (...args: any[]) => any> = CallbackDescriptor<T>;
20
+ /** @deprecated Use CallbackOrDescriptor */
21
+ export type PluginHook<T extends (...args: any[]) => PromiseOrDirect<UnwrapCallback<any> | void>> = CallbackOrDescriptor<T> | readonly CallbackDescriptor<T>[];
22
+ /** @deprecated Use UnwrapCallback */
23
+ export type PluginHookCallback<T extends CallbackOrDescriptor<(...args: any[]) => any>> = UnwrapCallback<T>;
15
24
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,iBAAiB,CAAC;AAKpE,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,MAAM,CAChC,MAAM,CAAC,EACP,UAAU,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CACpC,CAAC;AAEF,qBAAa,UAAU,CAAC,MAAM,SAAS,UAAU,CAAC,MAAM,CAAC;IACvD,SAAS,EAAE;SACR,GAAG,IAAI,MAAM,MAAM,CAAC,CAAC,EAAE,KAAK,CAC3B,MAAM,CAAC,MAAM,MAAM,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAC7D;KACF,CAAuB;IAExB,IAAI,CAAC,SAAS,SAAS,MAAM,MAAM,EACjC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,CAAC,SAAS,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,GAC5D,IAAI;IAKP;;;OAGG;IACH,OAAO,CAAC,SAAS,SAAS,MAAM,MAAM,EACpC,KAAK,EAAE,SAAS,EAChB,GAAG,IAAI,EAAE,UAAU,CACjB,MAAM,CAAC,SAAS,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAC1D,GACA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CA2BxB;AAED,wBAAgB,UAAU,CAAC,MAAM,SAAS,UAAU,CAAC,MAAM,CAAC,EAC1D,OAAO,EAAE,cAAc,CAAC,MAAM,EAAE,GAAG,SAAS,EAC5C,cAAc,EAAE,CACd,MAAM,EAAE,cAAc,CAAC,MAAM,KAC1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AAM,MAAM,UAAU,CAAC,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAAC;AACnD,qCAAqC;AACrC,eAAO,MAAM,UAAU,qBAAe,CAAC;AACvC,yCAAyC;AACzC,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IAC5D,kBAAkB,CAAC,CAAC,CAAC,CAAC;AACxB,2CAA2C;AAC3C,MAAM,MAAM,UAAU,CACpB,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IACvE,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/D,qCAAqC;AACrC,MAAM,MAAM,kBAAkB,CAC5B,CAAC,SAAS,oBAAoB,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,IACrD,cAAc,CAAC,CAAC,CAAC,CAAC"}
package/dist/hooks.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applyHooks = exports.AsyncHooks = void 0;
4
- const sort_js_1 = require("./sort.js");
4
+ const functionality_js_1 = require("./functionality.js");
5
5
  const isDev = process.env.GRAPHILE_ENV === "development";
6
6
  class AsyncHooks {
7
7
  constructor() {
@@ -15,8 +15,8 @@ class AsyncHooks {
15
15
  * Hooks can _mutate_ the argument, they cannot return a replacement. This
16
16
  * allows us to completely side-step the problem of recursive calls.
17
17
  */
18
- process(event, ...args) {
19
- const callbacks = this.callbacks[event];
18
+ process(hookName, ...args) {
19
+ const callbacks = this.callbacks[hookName];
20
20
  if (!callbacks) {
21
21
  return;
22
22
  }
@@ -31,7 +31,7 @@ class AsyncHooks {
31
31
  const result = callback.apply(null, args);
32
32
  if (result != null) {
33
33
  if (isDev && typeof result.then !== "function") {
34
- throw new Error(`Hook '${event}' returned invalid value of type ${typeof result} - must be 'undefined' or a Promise/PromiseLike.`);
34
+ throw new Error(`Hook '${hookName}' returned invalid value of type ${typeof result} - must be 'undefined' or a Promise/PromiseLike.`);
35
35
  }
36
36
  chain = result;
37
37
  }
@@ -41,57 +41,6 @@ class AsyncHooks {
41
41
  }
42
42
  }
43
43
  exports.AsyncHooks = AsyncHooks;
44
- function applyHooks(plugins, hooksRetriever, applyHookCallback) {
45
- // Normalize all the hooks and gather them into collections
46
- const allHooks = Object.create(null);
47
- let uid = 0;
48
- if (plugins) {
49
- for (const plugin of plugins) {
50
- const hooks = hooksRetriever(plugin);
51
- if (!hooks) {
52
- continue;
53
- }
54
- const keys = Object.keys(hooks);
55
- for (const key of keys) {
56
- const hookSpecRaw = hooks[key];
57
- if (!hookSpecRaw) {
58
- continue;
59
- }
60
- // TypeScript nonsense
61
- const isPluginHookObject = (v) => typeof v !== "function";
62
- const isPluginHookFunction = (v) => typeof v === "function";
63
- const callback = (isPluginHookFunction(hookSpecRaw) ? hookSpecRaw : hookSpecRaw.callback);
64
- const { provides, before, after } = isPluginHookObject(hookSpecRaw)
65
- ? hookSpecRaw
66
- : {};
67
- if (!allHooks[key]) {
68
- allHooks[key] = [];
69
- }
70
- // We need to give each hook a unique ID
71
- const id = String(uid++);
72
- allHooks[key].push({
73
- id,
74
- plugin,
75
- callback,
76
- provides: [...(provides || []), id, plugin.name],
77
- before: before || [],
78
- after: after || [],
79
- });
80
- }
81
- }
82
- }
83
- // Sort the collections according to provides, before and after.
84
- for (const hookName in allHooks) {
85
- const hooks = allHooks[hookName];
86
- if (!hooks) {
87
- continue;
88
- }
89
- const final = (0, sort_js_1.sortWithBeforeAfterProvides)(hooks, "id");
90
- // Finally we can register the hooks
91
- for (const hook of final) {
92
- applyHookCallback(hookName, hook.callback, hook.plugin);
93
- }
94
- }
95
- }
96
- exports.applyHooks = applyHooks;
44
+ /** @deprecated Use `orderedApply` */
45
+ exports.applyHooks = functionality_js_1.orderedApply;
97
46
  //# sourceMappingURL=hooks.js.map
package/dist/hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":";;;AACA,uCAAwD;AAExD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,aAAa,CAAC;AAOzD,MAAa,UAAU;IAAvB;QACE,cAAS,GAIL,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IA8C1B,CAAC;IA5CC,IAAI,CACF,KAAgB,EAChB,EAA6D;QAE7D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACpD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,OAAO,CACL,KAAgB,EAChB,GAAG,IAEF;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACxC,IAAI,CAAC,SAAS,EAAE;YACd,OAAO;SACR;QACD,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;QAC3B,IAAI,KAAK,GAAG,SAAS,CAAC;QACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAC1B,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,KAAK,KAAK,SAAS,EAAE;gBACvB,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;aACtD;iBAAM;gBACL,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC1C,IAA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AC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,55 @@
1
1
  import "./interfaces.js";
2
2
  export { GraphileConfig };
3
- export { applyHooks, AsyncHooks, HookObject } from "./hooks.js";
4
- export type { PluginHook, PluginHookObject } from "./interfaces.js";
3
+ export { orderedApply } from "./functionality.js";
4
+ export { applyHooks, AsyncHooks, HookObject, PluginHook, PluginHookObject, } from "./hooks.js";
5
+ export type { CallbackDescriptor, CallbackOrDescriptor, FunctionalityObject, } from "./interfaces.js";
6
+ export type { MiddlewareNext } from "./middleware.js";
7
+ export { Middleware } from "./middleware.js";
5
8
  export { isResolvedPreset, resolvePresets } from "./resolvePresets.js";
6
9
  export declare function sortedPlugins(plugins: GraphileConfig.Plugin[] | undefined): GraphileConfig.Plugin[];
10
+ declare global {
11
+ namespace GraphileConfig {
12
+ /**
13
+ * Expand this through declaration merging to get TypeScript
14
+ * auto-completion of plugin names in the relevant places.
15
+ */
16
+ interface Plugins {
17
+ [key: string & {}]: true;
18
+ }
19
+ /**
20
+ * Expand this through declaration merging to get TypeScript
21
+ * auto-completion of things that plugins can provide.
22
+ */
23
+ interface Provides {
24
+ [key: string & {}]: true;
25
+ }
26
+ interface Plugin {
27
+ name: keyof GraphileConfig.Plugins;
28
+ version: string;
29
+ experimental?: boolean;
30
+ description?: string;
31
+ provides?: (keyof GraphileConfig.Plugins | keyof GraphileConfig.Provides)[];
32
+ after?: (keyof GraphileConfig.Plugins | keyof GraphileConfig.Provides)[];
33
+ before?: (keyof GraphileConfig.Plugins | keyof GraphileConfig.Provides)[];
34
+ }
35
+ /**
36
+ * A Graphile Config Preset that can be combined with other presets to
37
+ * ultimately build a resolved preset: a combination of plugins and
38
+ * configuration options to be used by the various Graphile tools.
39
+ */
40
+ interface Preset {
41
+ extends?: ReadonlyArray<Preset>;
42
+ plugins?: Plugin[];
43
+ disablePlugins?: ReadonlyArray<keyof GraphileConfig.Plugins>;
44
+ appendPlugins?: never;
45
+ prependPlugins?: never;
46
+ skipPlugins?: never;
47
+ }
48
+ interface ResolvedPreset extends Preset {
49
+ extends?: ReadonlyArray<never>;
50
+ plugins?: Plugin[];
51
+ disablePlugins?: ReadonlyArray<keyof GraphileConfig.Plugins>;
52
+ }
53
+ }
54
+ }
7
55
  //# sourceMappingURL=index.d.ts.map