graphile-config 0.0.1-beta.1 → 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 +158 -0
- package/README.md +6 -8
- package/dist/functionality.d.ts +3 -0
- package/dist/functionality.d.ts.map +1 -0
- package/dist/functionality.js +64 -0
- package/dist/functionality.js.map +1 -0
- package/dist/hooks.d.ts +16 -7
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +6 -57
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +50 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +9 -34
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/loadConfig.d.ts.map +1 -1
- package/dist/loadConfig.js +1 -1
- package/dist/loadConfig.js.map +1 -1
- package/dist/middleware.d.ts +18 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +71 -0
- package/dist/middleware.js.map +1 -0
- package/dist/resolvePresets.d.ts +1 -1
- package/dist/resolvePresets.d.ts.map +1 -1
- package/dist/resolvePresets.js +100 -45
- package/dist/resolvePresets.js.map +1 -1
- package/dist/sort.d.ts.map +1 -1
- package/dist/sort.js +33 -15
- package/dist/sort.js.map +1 -1
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +10 -0
- package/dist/utils.js.map +1 -0
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,163 @@
|
|
|
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
|
+
|
|
3
161
|
## 0.0.1-beta.1
|
|
4
162
|
|
|
5
163
|
### Patch Changes
|
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
|
|
119
|
-
|
|
120
|
-
|
|
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://
|
|
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":";;;AAOA,uCAAwD;AAExD,sBAAsB;AACtB,MAAM,oBAAoB,GAAG,CAC3B,CAA0B,EACE,EAAE,CAAC,OAAO,CAAC,KAAK,UAAU,CAAC;AACzD,MAAM,UAAU,GAAG,CACjB,CAA0B,EAClB,EAAE,CAAC,OAAO,CAAC,KAAK,UAAU,CAAC;AACrC,SAAS,OAAO,CACd,GAE8C;IAE9C,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,SAAgB,YAAY,CAG1B,OAAqD,EACrD,sBAEwC,EACxC,aAYS;IAUT,2DAA2D;IAC3D,MAAM,kBAAkB,GAEpB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACx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AC;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
|
|
2
|
-
|
|
3
|
-
export declare class AsyncHooks<THooks extends
|
|
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
|
|
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
|
|
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>(
|
|
12
|
+
process<THookName extends keyof THooks>(hookName: THookName, ...args: Parameters<THooks[THookName] extends CallbackOrDescriptor<infer U> ? U : never>): void | Promise<void>;
|
|
13
13
|
}
|
|
14
|
-
|
|
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
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACf,MAAM,iBAAiB,CAAC;AAIzB,qBAAa,UAAU,CAAC,MAAM,SAAS,mBAAmB,CAAC,MAAM,CAAC;IAChE,SAAS,EAAE;SACR,GAAG,IAAI,MAAM,MAAM,CAAC,CAAC,EAAE,KAAK,CAC3B,MAAM,CAAC,MAAM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/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
|
|
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(
|
|
19
|
-
const callbacks = this.callbacks[
|
|
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 '${
|
|
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
|
-
|
|
45
|
-
|
|
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":";;;
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":";;;AAAA,yDAAkD;AASlD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,aAAa,CAAC;AAEzD,MAAa,UAAU;IAAvB;QACE,cAAS,GAIL,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IA8C1B,CAAC;IA5CC,IAAI,CACF,KAAgB,EAChB,EAAuE;QAEvE,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,QAAmB,EACnB,GAAG,IAEF;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC3C,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,IAAI,MAAM,IAAI,IAAI,EAAE;oBAClB,IAAI,KAAK,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;wBAC9C,MAAM,IAAI,KAAK,CACb,SACE,QACF,oCAAoC,OAAO,MAAM,kDAAkD,CACpG,CAAC;qBACH;oBACD,KAAK,GAAG,MAAM,CAAC;iBAChB;aACF;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAnDD,gCAmDC;AAMD,qCAAqC;AACxB,QAAA,UAAU,GAAG,+BAAY,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,55 @@
|
|
|
1
1
|
import "./interfaces.js";
|
|
2
2
|
export { GraphileConfig };
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAIzB,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAIzB,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,O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EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;YAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;YACnB,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;YAI7D,aAAa,CAAC,EAAE,KAAK,CAAC;YACtB,cAAc,CAAC,EAAE,KAAK,CAAC;YACvB,WAAW,CAAC,EAAE,KAAK,CAAC;SAGrB;QAED,UAAU,cAAe,SAAQ,MAAM;YAErC,OAAO,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;YAC/B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;YACnB,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;SAC9D;KACF;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sortedPlugins = exports.resolvePresets = exports.isResolvedPreset = exports.AsyncHooks = exports.applyHooks = void 0;
|
|
3
|
+
exports.sortedPlugins = exports.resolvePresets = exports.isResolvedPreset = exports.Middleware = exports.AsyncHooks = exports.applyHooks = exports.orderedApply = void 0;
|
|
4
4
|
require("./interfaces.js");
|
|
5
5
|
const sort_js_1 = require("./sort.js");
|
|
6
|
+
var functionality_js_1 = require("./functionality.js");
|
|
7
|
+
Object.defineProperty(exports, "orderedApply", { enumerable: true, get: function () { return functionality_js_1.orderedApply; } });
|
|
6
8
|
var hooks_js_1 = require("./hooks.js");
|
|
7
9
|
Object.defineProperty(exports, "applyHooks", { enumerable: true, get: function () { return hooks_js_1.applyHooks; } });
|
|
8
10
|
Object.defineProperty(exports, "AsyncHooks", { enumerable: true, get: function () { return hooks_js_1.AsyncHooks; } });
|
|
11
|
+
var middleware_js_1 = require("./middleware.js");
|
|
12
|
+
Object.defineProperty(exports, "Middleware", { enumerable: true, get: function () { return middleware_js_1.Middleware; } });
|
|
9
13
|
var resolvePresets_js_1 = require("./resolvePresets.js");
|
|
10
14
|
Object.defineProperty(exports, "isResolvedPreset", { enumerable: true, get: function () { return resolvePresets_js_1.isResolvedPreset; } });
|
|
11
15
|
Object.defineProperty(exports, "resolvePresets", { enumerable: true, get: function () { return resolvePresets_js_1.resolvePresets; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2BAAyB;AAEzB,uCAAwD;AAIxD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2BAAyB;AAEzB,uCAAwD;AAIxD,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AACrB,uCAMoB;AALlB,sGAAA,UAAU,OAAA;AACV,sGAAA,UAAU,OAAA;AAWZ,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,yDAAuE;AAA9D,qHAAA,gBAAgB,OAAA;AAAE,mHAAA,cAAc,OAAA;AAEzC,SAAgB,aAAa,CAC3B,OAA4C;IAE5C,IAAI,OAAO,EAAE;QACX,OAAO,IAAA,qCAA2B,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACrD;SAAM;QACL,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AARD,sCAQC"}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,37 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
experimental?: boolean;
|
|
7
|
-
description?: string;
|
|
8
|
-
provides?: string[];
|
|
9
|
-
after?: string[];
|
|
10
|
-
before?: string[];
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A Graphile Config Preset that can be combined with other presets to
|
|
14
|
-
* ultimately build a resolved preset: a combination of plugins and
|
|
15
|
-
* configuration options to be used by the various Graphile tools.
|
|
16
|
-
*/
|
|
17
|
-
interface Preset {
|
|
18
|
-
extends?: ReadonlyArray<Preset>;
|
|
19
|
-
plugins?: Plugin[];
|
|
20
|
-
disablePlugins?: ReadonlyArray<string>;
|
|
21
|
-
}
|
|
22
|
-
interface ResolvedPreset extends Preset {
|
|
23
|
-
extends?: ReadonlyArray<never>;
|
|
24
|
-
plugins?: Plugin[];
|
|
25
|
-
disablePlugins?: ReadonlyArray<string>;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export type PluginHookObject<T extends (...args: any[]) => any> = {
|
|
30
|
-
provides?: string[];
|
|
31
|
-
before?: string[];
|
|
32
|
-
after?: string[];
|
|
1
|
+
export type AnyCallback = (...args: any[]) => any;
|
|
2
|
+
export type CallbackDescriptor<T extends AnyCallback> = {
|
|
3
|
+
provides?: (keyof GraphileConfig.Plugins | keyof GraphileConfig.Provides)[];
|
|
4
|
+
before?: (keyof GraphileConfig.Plugins | keyof GraphileConfig.Provides)[];
|
|
5
|
+
after?: (keyof GraphileConfig.Plugins | keyof GraphileConfig.Provides)[];
|
|
33
6
|
callback: T;
|
|
34
7
|
};
|
|
35
|
-
export type
|
|
36
|
-
export type
|
|
8
|
+
export type PromiseOrDirect<T> = T | PromiseLike<T>;
|
|
9
|
+
export type CallbackOrDescriptor<T extends AnyCallback> = T | CallbackDescriptor<T>;
|
|
10
|
+
export type UnwrapCallback<T extends CallbackOrDescriptor<AnyCallback> | ReadonlyArray<CallbackDescriptor<AnyCallback>>> = T extends CallbackOrDescriptor<infer U> ? U : T extends ReadonlyArray<CallbackDescriptor<infer U>> ? U : never;
|
|
11
|
+
export type FunctionalityObject<T> = Record<keyof T, CallbackOrDescriptor<AnyCallback> | ReadonlyArray<CallbackDescriptor<AnyCallback>>>;
|
|
37
12
|
//# sourceMappingURL=interfaces.d.ts.map
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"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ACjD,CAAC"}
|
package/dist/loadConfig.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadConfig.d.ts","sourceRoot":"","sources":["../src/loadConfig.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"loadConfig.d.ts","sourceRoot":"","sources":["../src/loadConfig.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AA6DzB,wBAAsB,UAAU,CAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CAAC,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,CA2CvC"}
|
package/dist/loadConfig.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadConfig = void 0;
|
|
4
4
|
require("./interfaces.js");
|
|
5
|
-
const interpret_1 = require("interpret");
|
|
6
5
|
const promises_1 = require("node:fs/promises");
|
|
7
6
|
const node_path_1 = require("node:path");
|
|
8
7
|
const node_url_1 = require("node:url");
|
|
8
|
+
const interpret_1 = require("interpret");
|
|
9
9
|
const extensions = Object.keys(interpret_1.jsVariants);
|
|
10
10
|
async function exists(filePath) {
|
|
11
11
|
try {
|
package/dist/loadConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadConfig.js","sourceRoot":"","sources":["../src/loadConfig.ts"],"names":[],"mappings":";;;AAAA,2BAAyB;
|
|
1
|
+
{"version":3,"file":"loadConfig.js","sourceRoot":"","sources":["../src/loadConfig.ts"],"names":[],"mappings":";;;AAAA,2BAAyB;AAEzB,+CAA0C;AAC1C,yCAAoC;AACpC,uCAAyC;AAGzC,yCAAuC;AAEvC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,sBAAU,CAAC,CAAC;AAE3C,KAAK,UAAU,MAAM,CAAC,QAAgB;IACpC,IAAI;QACF,MAAM,IAAA,iBA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;qBACjE;yBAAM;wBACL,MAAM,CAAC,CAAC;qBACT;iBACF;aACF;SACF;KACF;IAED,kBAAkB;IAClB,OAAO,IAAI,CAAC;AACd,CAAC;AA7CD,gCA6CC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CallbackOrDescriptor, FunctionalityObject } from "./interfaces.js";
|
|
2
|
+
export interface MiddlewareNext<TRawResult, TAwaitedResult = Awaited<TRawResult>> {
|
|
3
|
+
(): TRawResult;
|
|
4
|
+
callback(callback: (error: object | null, result: TAwaitedResult) => TRawResult): TRawResult;
|
|
5
|
+
}
|
|
6
|
+
type ActivityFn<TActivities extends FunctionalityObject<TActivities>, TActivityName extends keyof TActivities> = TActivities[TActivityName] extends CallbackOrDescriptor<infer UFn> ? UFn : never;
|
|
7
|
+
type ActivityParameter<TActivities extends FunctionalityObject<TActivities>, TActivityName extends keyof TActivities> = TActivities[TActivityName] extends CallbackOrDescriptor<(arg: infer UArg) => any> ? UArg : never;
|
|
8
|
+
type RealActivityFn<TActivities extends FunctionalityObject<TActivities>, TActivityName extends keyof TActivities> = TActivities[TActivityName] extends CallbackOrDescriptor<(arg: infer UArg) => infer UResult> ? (next: MiddlewareNext<UResult>, arg: UArg) => UResult : never;
|
|
9
|
+
export declare class Middleware<TActivities extends FunctionalityObject<TActivities>> {
|
|
10
|
+
middleware: {
|
|
11
|
+
[key in keyof TActivities]?: Array<RealActivityFn<TActivities, key>>;
|
|
12
|
+
};
|
|
13
|
+
register<TActivityName extends keyof TActivities>(event: TActivityName, fn: RealActivityFn<TActivities, TActivityName>): void;
|
|
14
|
+
run<TActivityName extends keyof TActivities>(activityName: TActivityName, arg: ActivityParameter<TActivities, TActivityName>, activity: (arg: ActivityParameter<TActivities, TActivityName>) => ReturnType<ActivityFn<TActivities, TActivityName>>): ReturnType<ActivityFn<TActivities, TActivityName>>;
|
|
15
|
+
runSync<TActivityName extends keyof TActivities>(activityName: TActivityName, arg: ActivityParameter<TActivities, TActivityName>, activity: (arg: ActivityParameter<TActivities, TActivityName>) => ReturnType<ActivityFn<TActivities, TActivityName>>): ReturnType<ActivityFn<TActivities, TActivityName>>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EAEpB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,cAAc,CAC7B,UAAU,EACV,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAEpC,IAAI,UAAU,CAAC;IACf,QAAQ,CACN,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,cAAc,KAAK,UAAU,GACrE,UAAU,CAAC;CACf;AAED,KAAK,UAAU,CACb,WAAW,SAAS,mBAAmB,CAAC,WAAW,CAAC,EACpD,aAAa,SAAS,MAAM,WAAW,IACrC,WAAW,CAAC,aAAa,CAAC,SAAS,oBAAoB,CAAC,MAAM,GAAG,CAAC,GAClE,GAAG,GACH,KAAK,CAAC;AACV,KAAK,iBAAiB,CACpB,WAAW,SAAS,mBAAmB,CAAC,WAAW,CAAC,EACpD,aAAa,SAAS,MAAM,WAAW,IACrC,WAAW,CAAC,aAAa,CAAC,SAAS,oBAAoB,CACzD,CAAC,GAAG,EAAE,MAAM,IAAI,KAAK,GAAG,CACzB,GACG,IAAI,GACJ,KAAK,CAAC;AAEV,KAAK,cAAc,CACjB,WAAW,SAAS,mBAAmB,CAAC,WAAW,CAAC,EACpD,aAAa,SAAS,MAAM,WAAW,IACrC,WAAW,CAAC,aAAa,CAAC,SAAS,oBAAoB,CACzD,CAAC,GAAG,EAAE,MAAM,IAAI,KAAK,MAAM,OAAO,CACnC,GACG,CAAC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,KAAK,OAAO,GACrD,KAAK,CAAC;AAEV,qBAAa,UAAU,CAAC,WAAW,SAAS,mBAAmB,CAAC,WAAW,CAAC;IAC1E,UAAU,EAAE;SACT,GAAG,IAAI,MAAM,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;KACrE,CAAuB;IAExB,QAAQ,CAAC,aAAa,SAAS,MAAM,WAAW,EAC9C,KAAK,EAAE,aAAa,EACpB,EAAE,EAAE,cAAc,CAAC,WAAW,EAAE,aAAa,CAAC,GAC7C,IAAI;IASP,GAAG,CAAC,aAAa,SAAS,MAAM,WAAW,EACzC,YAAY,EAAE,aAAa,EAC3B,GAAG,EAAE,iBAAiB,CAAC,WAAW,EAAE,aAAa,CAAC,EAClD,QAAQ,EAAE,CACR,GAAG,EAAE,iBAAiB,CAAC,WAAW,EAAE,aAAa,CAAC,KAC/C,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,GACtD,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAgBrD,OAAO,CAAC,aAAa,SAAS,MAAM,WAAW,EAC7C,YAAY,EAAE,aAAa,EAC3B,GAAG,EAAE,iBAAiB,CAAC,WAAW,EAAE,aAAa,CAAC,EAClD,QAAQ,EAAE,CACR,GAAG,EAAE,iBAAiB,CAAC,WAAW,EAAE,aAAa,CAAC,KAC/C,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,GACtD,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;CAgBtD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Middleware = void 0;
|
|
4
|
+
const utils_js_1 = require("./utils.js");
|
|
5
|
+
class Middleware {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.middleware = Object.create(null);
|
|
8
|
+
}
|
|
9
|
+
register(event, fn) {
|
|
10
|
+
const list = this.middleware[event];
|
|
11
|
+
if (list !== undefined) {
|
|
12
|
+
list.push(fn);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
this.middleware[event] = [fn];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
run(activityName, arg, activity) {
|
|
19
|
+
const middleware = this.middleware[activityName];
|
|
20
|
+
if (middleware === undefined) {
|
|
21
|
+
return activity(arg);
|
|
22
|
+
}
|
|
23
|
+
const m = middleware.length - 1;
|
|
24
|
+
return executeMiddleware(activityName, true, middleware, activity, arg, 0, m);
|
|
25
|
+
}
|
|
26
|
+
runSync(activityName, arg, activity) {
|
|
27
|
+
const middleware = this.middleware[activityName];
|
|
28
|
+
if (middleware === undefined) {
|
|
29
|
+
return activity(arg);
|
|
30
|
+
}
|
|
31
|
+
const m = middleware.length - 1;
|
|
32
|
+
return executeMiddleware(activityName, false, middleware, activity, arg, 0, m);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.Middleware = Middleware;
|
|
36
|
+
function executeMiddleware(activityName, allowAsync, middlewareList, activity, arg, idx, maxIdx) {
|
|
37
|
+
const next = makeNext(idx === maxIdx
|
|
38
|
+
? () => activity(arg)
|
|
39
|
+
: () => executeMiddleware(activityName, allowAsync, middlewareList, activity, arg, idx + 1, maxIdx));
|
|
40
|
+
const middleware = middlewareList[idx];
|
|
41
|
+
const result = middleware(next, arg);
|
|
42
|
+
if (!allowAsync && (0, utils_js_1.isPromiseLike)(result)) {
|
|
43
|
+
throw new Error(`'${String(activityName)}' is a synchronous activity, all middleware must be synchronous but the middleware at index ${idx} returned a promise.`);
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
function makeNext(fn) {
|
|
48
|
+
let called = false;
|
|
49
|
+
const next = fn;
|
|
50
|
+
next.callback = (callback) => {
|
|
51
|
+
if (called) {
|
|
52
|
+
throw new Error(`next() was already called; don't call it twice!`);
|
|
53
|
+
}
|
|
54
|
+
called = true;
|
|
55
|
+
let result;
|
|
56
|
+
try {
|
|
57
|
+
result = fn();
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
return callback(error, undefined);
|
|
61
|
+
}
|
|
62
|
+
if ((0, utils_js_1.isPromiseLike)(result)) {
|
|
63
|
+
return result.then((result) => callback(null, result), callback);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return callback(null, result);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return next;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":";;;AAKA,yCAA2C;AAoC3C,MAAa,UAAU;IAAvB;QACE,eAAU,GAEN,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IA0D1B,CAAC;IAxDC,QAAQ,CACN,KAAoB,EACpB,EAA8C;QAE9C,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACf;aAAM;YACL,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SAC/B;IACH,CAAC;IAED,GAAG,CACD,YAA2B,EAC3B,GAAkD,EAClD,QAEuD;QAEvD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QACjD,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;SACtB;QACD,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;QAChC,OAAO,iBAAiB,CACtB,YAAY,EACZ,IAAI,EACJ,UA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,CAAC;IACnB,MAAM,IAAI,GAAG,EAAgD,CAAC;IAC9D,IAAI,CAAC,QAAQ,GAAG,CAAC,QAAQ,EAAE,EAAE;QAC3B,IAAI,MAAM,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACpE;QACD,MAAM,GAAG,IAAI,CAAC;QACd,IAAI,MAAuC,CAAC;QAC5C,IAAI;YACF,MAAM,GAAG,EAAE,EAAqC,CAAC;SAClD;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,QAAQ,CAAC,KAAK,EAAE,SAAgB,CAAC,CAAC;SAC1C;QACD,IAAI,IAAA,wBAAa,EAAC,MAAM,CAAC,EAAE;YACzB,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,MAAM,EAAE,EAAE,CACT,QAAQ,CAAC,IAAI,EAAE,MAAM,CAEU,EACjC,QAAe,CACF,CAAC;SACjB;aAAM;YACL,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;SAC/B;IACH,CAAC,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/resolvePresets.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export declare function isResolvedPreset(preset: GraphileConfig.Preset): preset
|
|
|
4
4
|
* Given a list of presets, resolves the presets and returns the resulting
|
|
5
5
|
* ResolvedPreset (which does not have any `extends`).
|
|
6
6
|
*/
|
|
7
|
-
export declare function resolvePresets(presets: ReadonlyArray<GraphileConfig.Preset
|
|
7
|
+
export declare function resolvePresets(presets: ReadonlyArray<GraphileConfig.Preset>): GraphileConfig.ResolvedPreset;
|
|
8
8
|
//# sourceMappingURL=resolvePresets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePresets.d.ts","sourceRoot":"","sources":["../src/resolvePresets.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"resolvePresets.d.ts","sourceRoot":"","sources":["../src/resolvePresets.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAuCzB,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,CAAC,MAAM,GAC5B,MAAM,IAAI,cAAc,CAAC,cAAc,CAWzC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,iCA0B3E"}
|
package/dist/resolvePresets.js
CHANGED
|
@@ -3,14 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.resolvePresets = exports.isResolvedPreset = void 0;
|
|
4
4
|
require("./interfaces.js");
|
|
5
5
|
const sort_js_1 = require("./sort.js");
|
|
6
|
-
const
|
|
6
|
+
const PROBABLY_A_PLUGIN_NOT_A_PRESET_KEYS = [
|
|
7
7
|
"name",
|
|
8
8
|
"experimental",
|
|
9
9
|
"provides",
|
|
10
10
|
"before",
|
|
11
11
|
"after",
|
|
12
|
+
// To avoid confusion with PostGraphile V4:
|
|
13
|
+
"appendPlugins",
|
|
14
|
+
"prependPlugins",
|
|
15
|
+
"skipPlugins",
|
|
16
|
+
];
|
|
17
|
+
const PROBABLY_A_PRESET_NOT_A_PLUGIN_KEYS = [
|
|
18
|
+
"plugins",
|
|
19
|
+
"disablePlugins",
|
|
20
|
+
"extends",
|
|
12
21
|
];
|
|
13
|
-
const PLUGIN_FORBIDDEN_KEYS = ["plugins", "disablePlugins", "extends"];
|
|
14
22
|
let inspect;
|
|
15
23
|
try {
|
|
16
24
|
inspect = require("util").inspect;
|
|
@@ -29,14 +37,19 @@ catch {
|
|
|
29
37
|
};
|
|
30
38
|
}
|
|
31
39
|
function isResolvedPreset(preset) {
|
|
32
|
-
return (preset.plugins &&
|
|
40
|
+
return ((preset.plugins &&
|
|
41
|
+
preset.extends?.length === 0 &&
|
|
42
|
+
(!preset.disablePlugins ||
|
|
43
|
+
!preset.plugins ||
|
|
44
|
+
!preset.plugins.some((p) => preset.disablePlugins.includes(p.name)))) ||
|
|
45
|
+
false);
|
|
33
46
|
}
|
|
34
47
|
exports.isResolvedPreset = isResolvedPreset;
|
|
35
48
|
/**
|
|
36
49
|
* Given a list of presets, resolves the presets and returns the resulting
|
|
37
50
|
* ResolvedPreset (which does not have any `extends`).
|
|
38
51
|
*/
|
|
39
|
-
function resolvePresets(presets
|
|
52
|
+
function resolvePresets(presets) {
|
|
40
53
|
if (presets.length === 1) {
|
|
41
54
|
// Maybe it's already resolved?
|
|
42
55
|
const preset = presets[0];
|
|
@@ -44,24 +57,33 @@ function resolvePresets(presets, withAssertions = true) {
|
|
|
44
57
|
return preset;
|
|
45
58
|
}
|
|
46
59
|
}
|
|
60
|
+
const seenPluginNames = new Set();
|
|
61
|
+
const resolvedPreset = resolvePresetsInternal(presets, seenPluginNames, 0);
|
|
62
|
+
const disabledButNotSeen = resolvedPreset.disablePlugins?.filter((n) => !seenPluginNames.has(n));
|
|
63
|
+
if (disabledButNotSeen?.length) {
|
|
64
|
+
console.warn(`One or more of the plugin(s) entered in your preset's 'disablePlugins' list was never seen - perhaps you have misspelled them?\n${disabledButNotSeen
|
|
65
|
+
.map((p) => ` - ${p}`)
|
|
66
|
+
.join("\n")}\nThe list of know plugins is:\n ${[...seenPluginNames].join(", ") ?? "-"}`);
|
|
67
|
+
}
|
|
68
|
+
return resolvedPreset;
|
|
69
|
+
}
|
|
70
|
+
exports.resolvePresets = resolvePresets;
|
|
71
|
+
function resolvePresetsInternal(presets, seenPluginNames, depth) {
|
|
47
72
|
const finalPreset = blankResolvedPreset();
|
|
48
73
|
for (const preset of presets) {
|
|
49
|
-
|
|
50
|
-
|
|
74
|
+
if (isResolvedPreset(preset) && preset.disablePlugins) {
|
|
75
|
+
for (const p of preset.disablePlugins) {
|
|
76
|
+
seenPluginNames.add(p);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const resolvedPreset = resolvePresetInternal(preset, seenPluginNames, depth + 1);
|
|
80
|
+
mergePreset(finalPreset, resolvedPreset, seenPluginNames, depth);
|
|
51
81
|
}
|
|
52
82
|
if (finalPreset.plugins) {
|
|
53
83
|
finalPreset.plugins = (0, sort_js_1.sortWithBeforeAfterProvides)(finalPreset.plugins, "name");
|
|
54
84
|
}
|
|
55
|
-
if (withAssertions) {
|
|
56
|
-
if (finalPreset.disablePlugins && finalPreset.disablePlugins.length > 0) {
|
|
57
|
-
console.warn(`One or more of the plugin(s) entered in your preset's 'disablePlugins' list was not found:\n${finalPreset.disablePlugins
|
|
58
|
-
.map((p) => ` - ${p}`)
|
|
59
|
-
.join("\n")}\nThe list of know plugins is:\n ${finalPreset.plugins?.map((p) => p.name).join(", ") ?? "-"}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
85
|
return finalPreset;
|
|
63
86
|
}
|
|
64
|
-
exports.resolvePresets = resolvePresets;
|
|
65
87
|
function isGraphileConfigPreset(foo) {
|
|
66
88
|
if (typeof foo !== "object" || foo === null)
|
|
67
89
|
return false;
|
|
@@ -90,48 +112,65 @@ function assertPlugin(plugin) {
|
|
|
90
112
|
if (plugin.version != null && typeof plugin.version !== "string") {
|
|
91
113
|
throw new Error(`Expected plugin '${plugin.name}' to have a string 'version'; found ${inspect(plugin.version)}`);
|
|
92
114
|
}
|
|
93
|
-
|
|
115
|
+
const keys = Object.keys(plugin);
|
|
116
|
+
const forbiddenKeys = keys.filter(isForbiddenPluginKey);
|
|
117
|
+
if (forbiddenKeys.length) {
|
|
118
|
+
throw new Error(`Expected a GraphileConfig plugin, but found an object with forbidden keys ` +
|
|
119
|
+
`(e.g. keys starting with a capital letter, or a 'default' key). This typically indicates an ` +
|
|
120
|
+
`issue with ESM compatibility or import method, for example ` +
|
|
121
|
+
`doing \`import MyPlugin from 'my-plugin'\` instead of ` +
|
|
122
|
+
`\`import { MyPlugin } from 'my-plugin'\` or vice versa. ` +
|
|
123
|
+
`Forbidden keys: '${forbiddenKeys.join("', '")}', full value: '${inspect(plugin)}'`);
|
|
124
|
+
}
|
|
125
|
+
for (const forbiddenKey of PROBABLY_A_PRESET_NOT_A_PLUGIN_KEYS) {
|
|
94
126
|
if (plugin[forbiddenKey]) {
|
|
95
127
|
throw new Error(`Plugin '${plugin.name}' has '${forbiddenKey}' property which suggests it is a preset rather than a plugin. If it is indeed a preset you should add it to your preset via 'extends' rather than 'plugins'.`);
|
|
96
128
|
}
|
|
97
129
|
}
|
|
98
130
|
}
|
|
131
|
+
function isForbiddenPresetKey(key) {
|
|
132
|
+
return /^[A-Z_]/.test(key) || key === "default";
|
|
133
|
+
}
|
|
134
|
+
function isForbiddenPluginKey(key) {
|
|
135
|
+
return /^[A-Z_]/.test(key) || key === "default";
|
|
136
|
+
}
|
|
99
137
|
/**
|
|
100
138
|
* Turns a preset into a resolved preset (i.e. resolves all its `extends`).
|
|
101
139
|
*
|
|
102
140
|
* @internal
|
|
103
141
|
*/
|
|
104
|
-
function
|
|
142
|
+
function resolvePresetInternal(preset, seenPluginNames, depth) {
|
|
105
143
|
if (!isGraphileConfigPreset(preset)) {
|
|
106
144
|
throw new Error(`Expected a GraphileConfig preset (a plain JS object), but found '${inspect(preset)}'`);
|
|
107
145
|
}
|
|
146
|
+
const keys = Object.keys(preset);
|
|
147
|
+
const forbiddenKeys = keys.filter(isForbiddenPresetKey);
|
|
148
|
+
if (forbiddenKeys.length) {
|
|
149
|
+
throw new Error(`Expected a GraphileConfig preset, but found an object with forbidden keys ` +
|
|
150
|
+
`(e.g. keys starting with a capital letter, or a 'default' key). This typically indicates an ` +
|
|
151
|
+
`issue with ESM compatibility or import method, for example ` +
|
|
152
|
+
`doing \`import MyPreset from 'my-preset'\` instead of ` +
|
|
153
|
+
`\`import { MyPreset } from 'my-preset'\` or vice versa. ` +
|
|
154
|
+
`Forbidden keys: '${forbiddenKeys.join("', '")}', full value: '${inspect(preset)}'`);
|
|
155
|
+
}
|
|
108
156
|
try {
|
|
109
|
-
for (const forbiddenKey of
|
|
157
|
+
for (const forbiddenKey of PROBABLY_A_PLUGIN_NOT_A_PRESET_KEYS) {
|
|
110
158
|
if (preset[forbiddenKey]) {
|
|
111
159
|
throw new Error(`Preset has '${forbiddenKey}' property which suggests it is a plugin rather than a preset. If it is indeed a plugin you should add it to your preset via 'plugins' rather than 'extends'.`);
|
|
112
160
|
}
|
|
113
161
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
assertPlugin(plugin);
|
|
123
|
-
if (remaining.has(plugin.name)) {
|
|
124
|
-
remaining.delete(plugin.name);
|
|
125
|
-
plugins.delete(plugin);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
basePreset.plugins = [...plugins];
|
|
129
|
-
basePreset.disablePlugins = [...remaining];
|
|
130
|
-
}
|
|
162
|
+
}
|
|
163
|
+
catch (e) {
|
|
164
|
+
throw new Error(`Error occurred when resolving preset:\n ${String(e).replace(/\n/g, "\n ")}\nPreset: ${inspect(preset)}`);
|
|
165
|
+
}
|
|
166
|
+
const { extends: presets = [], ...rest } = preset;
|
|
167
|
+
const basePreset = resolvePresetsInternal(presets, seenPluginNames, depth + 1);
|
|
168
|
+
try {
|
|
169
|
+
mergePreset(basePreset, rest, seenPluginNames, depth);
|
|
131
170
|
return basePreset;
|
|
132
171
|
}
|
|
133
172
|
catch (e) {
|
|
134
|
-
throw new Error(`Error occurred when resolving preset
|
|
173
|
+
throw new Error(`Error occurred when resolving preset:\n ${String(e).replace(/\n/g, "\n ")}\nPreset: ${inspect(preset)}`);
|
|
135
174
|
}
|
|
136
175
|
}
|
|
137
176
|
/**
|
|
@@ -142,23 +181,39 @@ function resolvePreset(preset) {
|
|
|
142
181
|
*
|
|
143
182
|
* @internal
|
|
144
183
|
*/
|
|
145
|
-
function mergePreset(targetPreset, sourcePreset) {
|
|
184
|
+
function mergePreset(targetPreset, sourcePreset, seenPluginNames, _depth) {
|
|
185
|
+
const sourcePluginNames = [];
|
|
186
|
+
if (sourcePreset.plugins) {
|
|
187
|
+
for (const plugin of sourcePreset.plugins) {
|
|
188
|
+
assertPlugin(plugin);
|
|
189
|
+
seenPluginNames.add(plugin.name);
|
|
190
|
+
sourcePluginNames.push(plugin.name);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
146
193
|
if (targetPreset.extends != null && targetPreset.extends.length !== 0) {
|
|
147
194
|
throw new Error("First argument to mergePreset must be a resolved preset");
|
|
148
195
|
}
|
|
196
|
+
const addedAndDisabled = sourcePreset.disablePlugins
|
|
197
|
+
? sourcePluginNames.filter((addedPluginName) => sourcePreset.disablePlugins.includes(addedPluginName))
|
|
198
|
+
: [];
|
|
199
|
+
if (addedAndDisabled.length > 0) {
|
|
200
|
+
throw new Error(`A preset may not both add a plugin and disable that same plugin ('${addedAndDisabled.join("', '")}')`);
|
|
201
|
+
}
|
|
202
|
+
const disablePlugins = [
|
|
203
|
+
...new Set([
|
|
204
|
+
// Remove the previously disabled plugins where we've explicitly re-added the plugin
|
|
205
|
+
...(targetPreset.disablePlugins?.filter((pluginName) => !sourcePluginNames.includes(pluginName)) ?? []),
|
|
206
|
+
// Explicitly add our new disablePlugins
|
|
207
|
+
...(sourcePreset.disablePlugins ?? []),
|
|
208
|
+
]),
|
|
209
|
+
];
|
|
210
|
+
targetPreset.disablePlugins = disablePlugins;
|
|
149
211
|
const plugins = new Set([
|
|
150
212
|
...(targetPreset.plugins || []),
|
|
151
213
|
...(sourcePreset.plugins || []),
|
|
152
214
|
]);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
targetPreset.disablePlugins = [
|
|
156
|
-
...new Set([
|
|
157
|
-
...(targetPreset.disablePlugins ?? []),
|
|
158
|
-
...(sourcePreset.disablePlugins ?? []),
|
|
159
|
-
]),
|
|
160
|
-
];
|
|
161
|
-
}
|
|
215
|
+
// Copy the unique plugins that are not disabled
|
|
216
|
+
targetPreset.plugins = [...plugins].filter((p) => !disablePlugins.includes(p.name));
|
|
162
217
|
const targetScopes = Object.keys(targetPreset).filter(isScopeKeyForPreset);
|
|
163
218
|
const sourceScopes = Object.keys(sourcePreset).filter(isScopeKeyForPreset);
|
|
164
219
|
const scopes = [...new Set([...targetScopes, ...sourceScopes])];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePresets.js","sourceRoot":"","sources":["../src/resolvePresets.ts"],"names":[],"mappings":";;;AAAA,2BAAyB;AAEzB,uCAAwD;AAExD,MAAM,
|
|
1
|
+
{"version":3,"file":"resolvePresets.js","sourceRoot":"","sources":["../src/resolvePresets.ts"],"names":[],"mappings":";;;AAAA,2BAAyB;AAEzB,uCAAwD;AAExD,MAAM,mCAAmC,GAAG;IAC1C,MAAM;IACN,cAAc;IACd,UAAU;IACV,QAAQ;IACR,OAAO;IACP,2CAA2C;IAC3C,eAAe;IACf,gBAAgB;IAChB,aAAa;CACd,CAAC;AACF,MAAM,mCAAmC,GAAG;IAC1C,SAAS;IACT,gBAAgB;IAChB,SAAS;CACV,CAAC;AAEF,IAAI,OAA4D,CAAC;AAEjE,IAAI;IACF,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;IAClC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;QACjC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;KAC3C;CACF;AAAC,MAAM;IACN,OAAO,GAAG,CAAC,GAAG,EAAE,EAAE;QAChB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;YACvB,CAAC,GAAG;YACJ,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,IAAI;YACnC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,SAAS;YAC/C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;YACrB,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;CACH;AAED,SAAgB,gBAAgB,CAC9B,MAA6B;IAE7B,OAAO,CACL,CAAC,MAAM,CA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,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"AAAA,wBAAgB,2BAA2B,CACzC,MAAM,SAAS,MAAM,EACrB,SAAS,SAAS;IAChB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,GAAG;KACD,EAAE,IAAI,MAAM,GAAG,MAAM;CACvB,EACD,OAAO,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,CA+HlD"}
|
package/dist/sort.js
CHANGED
|
@@ -11,9 +11,34 @@ function sortWithBeforeAfterProvides(rawList, idKey) {
|
|
|
11
11
|
}
|
|
12
12
|
return { thing, before, after, provides };
|
|
13
13
|
});
|
|
14
|
+
// Figure out all the possible provides values:
|
|
15
|
+
const validProvides = new Set();
|
|
16
|
+
for (const { provides } of list) {
|
|
17
|
+
for (const provide of provides) {
|
|
18
|
+
validProvides.add(provide);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// And create fake providers for any values that don't already have one, to
|
|
22
|
+
// ensure correct ordering
|
|
23
|
+
for (const { after, before } of list) {
|
|
24
|
+
for (const val of [...after, ...before]) {
|
|
25
|
+
if (!validProvides.has(val)) {
|
|
26
|
+
list.push({
|
|
27
|
+
thing: Symbol(val),
|
|
28
|
+
before: [],
|
|
29
|
+
after: [],
|
|
30
|
+
provides: [val],
|
|
31
|
+
});
|
|
32
|
+
validProvides.add(val);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
14
36
|
// "before" and "after" are very similar, lets simplify them into one
|
|
15
37
|
// concept by converting all the "befores" into "afters" on their targets.
|
|
16
38
|
for (const { thing, before } of list) {
|
|
39
|
+
if (typeof thing === "symbol") {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
17
42
|
const { [idKey]: id } = thing;
|
|
18
43
|
if (before.length) {
|
|
19
44
|
const previousBefore = before.splice(0, before.length);
|
|
@@ -25,17 +50,6 @@ function sortWithBeforeAfterProvides(rawList, idKey) {
|
|
|
25
50
|
}
|
|
26
51
|
}
|
|
27
52
|
}
|
|
28
|
-
// Now lets figure out all the possible provides values:
|
|
29
|
-
const validProvides = new Set();
|
|
30
|
-
for (const { provides } of list) {
|
|
31
|
-
for (const provide of provides) {
|
|
32
|
-
validProvides.add(provide);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// And ignore any "afters" with no providers:
|
|
36
|
-
for (const { after } of list) {
|
|
37
|
-
after.splice(0, after.length, ...after.filter((afterValue) => validProvides.has(afterValue)));
|
|
38
|
-
}
|
|
39
53
|
const final = [];
|
|
40
54
|
const remaining = [...list];
|
|
41
55
|
// Now we can iteratively add items following the rule that there must be
|
|
@@ -58,18 +72,22 @@ function sortWithBeforeAfterProvides(rawList, idKey) {
|
|
|
58
72
|
if (!dependsOnRemaining) {
|
|
59
73
|
changes++;
|
|
60
74
|
remaining.splice(i, 1);
|
|
61
|
-
|
|
75
|
+
if (typeof thing !== "symbol") {
|
|
76
|
+
final.push(thing);
|
|
77
|
+
}
|
|
62
78
|
i--;
|
|
63
79
|
}
|
|
64
80
|
}
|
|
65
81
|
if (changes === 0) {
|
|
66
82
|
throw new Error(`Infinite loop in dependencies detected; remaining items:\n ${remaining
|
|
67
|
-
.map((r) => `${r.thing
|
|
83
|
+
.map((r) => `${typeof r.thing === "symbol"
|
|
84
|
+
? `FakeProvider<${r.thing.description}>`
|
|
85
|
+
: r.thing[idKey]} (after: ${r.after}; provides: ${r.provides})`)
|
|
68
86
|
.join("\n ")}`);
|
|
69
87
|
}
|
|
70
88
|
}
|
|
71
|
-
if (final.length !==
|
|
72
|
-
throw new Error(`Expected the same number of list entries after sorting (${final.length} != ${
|
|
89
|
+
if (final.length !== rawList.length) {
|
|
90
|
+
throw new Error(`Expected the same number of list entries after sorting (${final.length} != ${rawList.length})`);
|
|
73
91
|
}
|
|
74
92
|
return final;
|
|
75
93
|
}
|
package/dist/sort.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.js","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":";;;AAAA,SAAgB,2BAA2B,CASzC,OAAoB,EAAE,KAAa;IACnC,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"sort.js","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":";;;AAAA,SAAgB,2BAA2B,CASzC,OAAoB,EAAE,KAAa;IACnC,MAAM,IAAI,GAKL,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACzB,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;QAE7C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE;YACpC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;SAC7B;QAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,+CAA+C;IAC/C,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IACxC,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,EAAE;QAC/B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SAC5B;KACF;IAED,2EAA2E;IAC3E,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,WAAW,GAAG;gBACxC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CACnB,YAAY,CAAC,CAAC,KAAK,eAAe,CAAC,CAAC,QAAQ,GAAG,CAClD;iBACA,IAAI,CAAC,MAAM,CAAC,EAAE,CAClB,CAAC;SACH;KACF;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE;QACnC,MAAM,IAAI,KAAK,CACb,2DAA2D,KAAK,CAAC,MAAM,OAAO,OAAO,CAAC,MAAM,GAAG,CAChG,CAAC;KACH;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAxID,kEAwIC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GACxB,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,CAMzB"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPromiseLike = void 0;
|
|
4
|
+
function isPromiseLike(value) {
|
|
5
|
+
return (typeof value === "object" &&
|
|
6
|
+
value !== null &&
|
|
7
|
+
typeof value.then === "function");
|
|
8
|
+
}
|
|
9
|
+
exports.isPromiseLike = isPromiseLike;
|
|
10
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,CAC3B,KAAyB;IAEzB,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAQ,KAAa,CAAC,IAAI,KAAK,UAAU,CAC1C,CAAC;AACJ,CAAC;AARD,sCAQC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-config",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.10",
|
|
4
4
|
"description": "Standard plugin interface and helpers to be used across the Graphile stack.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "git+https://github.com/graphile/
|
|
28
|
+
"url": "git+https://github.com/graphile/crystal.git"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [
|
|
31
31
|
"graphile",
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
"author": "Benjie Gillam <code@benjiegillam.com>",
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"bugs": {
|
|
38
|
-
"url": "https://github.com/graphile/
|
|
38
|
+
"url": "https://github.com/graphile/crystal/issues"
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://graphile.org/graphile-build/",
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@types/interpret": "^1.1.1",
|
|
43
|
-
"@types/node": "^
|
|
44
|
-
"@types/semver": "^7.
|
|
43
|
+
"@types/node": "^20.5.7",
|
|
44
|
+
"@types/semver": "^7.5.1",
|
|
45
45
|
"chalk": "^4.1.2",
|
|
46
|
-
"debug": "^4.3.
|
|
47
|
-
"interpret": "^
|
|
48
|
-
"semver": "^7.
|
|
49
|
-
"tslib": "^2.
|
|
50
|
-
"yargs": "^17.
|
|
46
|
+
"debug": "^4.3.4",
|
|
47
|
+
"interpret": "^3.1.1",
|
|
48
|
+
"semver": "^7.5.4",
|
|
49
|
+
"tslib": "^2.6.2",
|
|
50
|
+
"yargs": "^17.7.2"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": ">=16"
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"dist"
|
|
57
57
|
],
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/debug": "^4.1.
|
|
60
|
-
"@types/mocha": "^
|
|
61
|
-
"chai": "^4.3.
|
|
62
|
-
"mocha": "^10.
|
|
59
|
+
"@types/debug": "^4.1.8",
|
|
60
|
+
"@types/mocha": "^10.0.1",
|
|
61
|
+
"chai": "^4.3.8",
|
|
62
|
+
"mocha": "^10.2.0",
|
|
63
63
|
"ts-node": "^10.9.1",
|
|
64
|
-
"typescript": "^5.
|
|
64
|
+
"typescript": "^5.2.2"
|
|
65
65
|
}
|
|
66
66
|
}
|