graphile-config
Advanced tools
Comparing version
# graphile-config | ||
## 0.0.1-beta.6 | ||
### Patch Changes | ||
- [#1892](https://github.com/graphile/crystal/pull/1892) | ||
[`0df5511ac`](https://github.com/graphile/crystal/commit/0df5511ac8b79ea34f8d12ebf8feeb421f8fe971) | ||
Thanks [@benjie](https://github.com/benjie)! - Fix plugin ordering bug that | ||
ignored before/after when there was no provider; this now means | ||
PgSmartTagsPlugin is correctly loaded before PgFakeConstraintPlugin, fixing | ||
the `postgraphile.tags.json5` file. | ||
## 0.0.1-beta.5 | ||
@@ -4,0 +15,0 @@ |
@@ -14,5 +14,30 @@ "use strict"; | ||
}); | ||
// Figure out all the possible provides values: | ||
const validProvides = new Set(); | ||
for (const { provides } of list) { | ||
for (const provide of provides) { | ||
validProvides.add(provide); | ||
} | ||
} | ||
// And create fake providers for any values that don't already have one, to | ||
// ensure correct ordering | ||
for (const { after, before } of list) { | ||
for (const val of [...after, ...before]) { | ||
if (!validProvides.has(val)) { | ||
list.push({ | ||
thing: Symbol(val), | ||
before: [], | ||
after: [], | ||
provides: [val], | ||
}); | ||
validProvides.add(val); | ||
} | ||
} | ||
} | ||
// "before" and "after" are very similar, lets simplify them into one | ||
// concept by converting all the "befores" into "afters" on their targets. | ||
for (const { thing, before } of list) { | ||
if (typeof thing === "symbol") { | ||
continue; | ||
} | ||
const { [idKey]: id } = thing; | ||
@@ -29,13 +54,2 @@ if (before.length) { | ||
} | ||
// Now lets figure out all the possible provides values: | ||
const validProvides = new Set(); | ||
for (const { provides } of list) { | ||
for (const provide of provides) { | ||
validProvides.add(provide); | ||
} | ||
} | ||
// And ignore any "afters" with no providers: | ||
for (const { after } of list) { | ||
after.splice(0, after.length, ...after.filter((afterValue) => validProvides.has(afterValue))); | ||
} | ||
const final = []; | ||
@@ -63,3 +77,5 @@ const remaining = [...list]; | ||
remaining.splice(i, 1); | ||
final.push(thing); | ||
if (typeof thing !== "symbol") { | ||
final.push(thing); | ||
} | ||
i--; | ||
@@ -70,8 +86,10 @@ } | ||
throw new Error(`Infinite loop in dependencies detected; remaining items:\n ${remaining | ||
.map((r) => `${r.thing[idKey]} (after: ${r.after}; provides: ${r.provides})`) | ||
.map((r) => `${typeof r.thing === "symbol" | ||
? `FakeProvider<${r.thing.description}>` | ||
: r.thing[idKey]} (after: ${r.after}; provides: ${r.provides})`) | ||
.join("\n ")}`); | ||
} | ||
} | ||
if (final.length !== list.length) { | ||
throw new Error(`Expected the same number of list entries after sorting (${final.length} != ${list.length})`); | ||
if (final.length !== rawList.length) { | ||
throw new Error(`Expected the same number of list entries after sorting (${final.length} != ${rawList.length})`); | ||
} | ||
@@ -78,0 +96,0 @@ return final; |
{ | ||
"name": "graphile-config", | ||
"version": "0.0.1-beta.5", | ||
"version": "0.0.1-beta.6", | ||
"description": "Standard plugin interface and helpers to be used across the Graphile stack.", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
63567
2.25%622
2.98%