Skip to content

Commit

Permalink
Upgrade everything; explain plan converted to JSON (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie authored Sep 1, 2023
2 parents 1146c04 + c9bfd98 commit 3f47a41
Show file tree
Hide file tree
Showing 416 changed files with 27,503 additions and 27,337 deletions.
6 changes: 6 additions & 0 deletions .changeset/olive-cycles-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"postgraphile": patch
---

PostGraphile no longer exports `GraphileBuild` nor `GraphileConfig` - these are
global namespaces.
27 changes: 27 additions & 0 deletions .changeset/pink-toys-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
"@graphile/simplify-inflection": patch
"jest-serializer-graphql-schema": patch
"eslint-plugin-graphile-export": patch
"graphile-build-pg": patch
"graphile-build": patch
"graphile-utils": patch
"jest-serializer-simple": patch
"@grafserv/persisted": patch
"postgraphile": patch
"ruru-components": patch
"pg-introspection": patch
"@dataplan/json": patch
"graphile-config": patch
"graphile-export": patch
"@dataplan/pg": patch
"grafserv": patch
"pgl": patch
"grafast": patch
"tamedevil": patch
"graphile": patch
"pg-sql2": patch
"ruru": patch
"@graphile/lru": patch
---

Update dependencies (sometimes through major versions).
6 changes: 6 additions & 0 deletions .changeset/rich-socks-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ruru-components": patch
"ruru": patch
---

Ruru now runs on React 18
8 changes: 8 additions & 0 deletions .changeset/sour-penguins-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"grafast": patch
---

`mermaid-js` explain type no longer supported, instead use `plan` which produces
a JSON object. You can use the new
`import { planToMermaid } from 'grafast/mermaid'` to convert this object back
into a mermaid definition.
6 changes: 6 additions & 0 deletions .changeset/twelve-experts-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ruru-components": patch
"ruru": patch
---

Modules converted to ESM to fix compatibility with GraphiQL.
3 changes: 1 addition & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ module.exports = {

// note you must disable the base rule as it can report incorrect errors
"no-duplicate-imports": "off",
"import/no-duplicates": "off",
"@typescript-eslint/no-duplicate-imports": ["error"],
"import/no-duplicates": "error",
},
overrides: [
// Rules for core plugins
Expand Down
8 changes: 4 additions & 4 deletions grafast/bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@
"grafast": "workspace:^",
"graphile-config": "workspace:^",
"graphql": "^16.1.0-experimental-stream-defer.6",
"tslib": "^2.5.0"
"tslib": "^2.6.2"
},
"engines": {
"node": ">=16.10"
},
"devDependencies": {
"@types/glob": "^8.1.0",
"glob": "^10.2.2",
"nodemon": "^2.0.15",
"glob": "^10.3.4",
"nodemon": "^3.0.1",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
"typescript": "^5.2.2"
},
"files": [
"dist",
Expand Down
11 changes: 6 additions & 5 deletions grafast/bench/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import * as fsp from "node:fs/promises";
import * as path from "node:path";
import { pathToFileURL } from "node:url";

import { glob } from "glob";
import { isSchema } from "grafast/graphql";
import { resolvePresets } from "graphile-config";
import type { ArgsFromOptions, Argv } from "graphile-config/cli";
import { loadConfig } from "graphile-config/load";
import * as fsp from "node:fs/promises";
import * as path from "node:path";
import { pathToFileURL } from "node:url";

import type { GrafastBenchConfig } from ".";
import { bench } from ".";
import type { GrafastBenchConfig } from "./index.js";
import { bench } from "./index.js";

export function options(yargs: Argv) {
return yargs
Expand Down
5 changes: 3 additions & 2 deletions grafast/bench/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { EventEmitter } from "node:stream";

import { execute, isAsyncIterable } from "grafast";
import type {
ExecutionPatchResult,
ExecutionResult,
GraphQLSchema,
} from "grafast/graphql";
import { parse, validate } from "grafast/graphql";
import { EventEmitter } from "node:stream";

import type { BenchOperation, GrafastBenchSetupResult } from "./interfaces.js";
export { GrafastBenchConfig } from "./interfaces.js";
Expand Down Expand Up @@ -37,7 +38,7 @@ export async function bench(
},
) {
const {
setup = () => ({} as any),
setup = () => ({}) as any,
teardown = () => {},
contextFactory = () => ({}),
} = options;
Expand Down
8 changes: 4 additions & 4 deletions grafast/dataplan-json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"homepage": "https://github.com/graphile/heart/tree/main/grafast/dataplan-json",
"dependencies": {
"chalk": "^4.1.2",
"tslib": "^2.5.0"
"tslib": "^2.6.2"
},
"engines": {
"node": ">=14.17"
Expand All @@ -39,9 +39,9 @@
"dist"
],
"devDependencies": {
"@types/jest": "^27.5.1",
"jest": "^28.1.3",
"@types/jest": "^29.5.4",
"jest": "^29.6.4",
"jest-serializer-simple": "workspace:^",
"typescript": "^5.0.4"
"typescript": "^5.2.2"
}
}
7 changes: 4 additions & 3 deletions grafast/dataplan-pg/__tests__/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
stripAnsi,
} from "grafast";
import type { AsyncExecutionResult, ExecutionResult } from "grafast/graphql";
import { planToMermaid } from "grafast/mermaid";
import { resolve } from "path";
import { Pool } from "pg";
import prettier from "prettier";
Expand Down Expand Up @@ -69,8 +70,8 @@ async function main() {
const ops = (extensions?.explain as any)?.operations;
if (ops) {
for (const op of ops) {
if (op.type === "mermaid-js") {
console.log(op.diagram);
if (op.type === "plan") {
console.log(planToMermaid(op.plan));
} else {
console.log(`UNKNOWN: ${op.type}`);
}
Expand Down Expand Up @@ -135,7 +136,7 @@ async function main() {
rootValue: null,
},
{
// explain: ["mermaid-js"],
// explain: ["plan"],
},
);

Expand Down
10 changes: 6 additions & 4 deletions grafast/dataplan-pg/__tests__/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
validate,
validateSchema,
} from "grafast/graphql";
import { planToMermaid } from "grafast/mermaid";
import { isAsyncIterable } from "iterall";
import JSON5 from "json5";
import { relative } from "path";
Expand Down Expand Up @@ -190,7 +191,7 @@ export async function runTestQuery(
const subscribe = grafastSubscribe;
const preset: GraphileConfig.ResolvedPreset = {
grafast: {
explain: ["mermaid-js"],
explain: ["plan"],
},
};
const result =
Expand Down Expand Up @@ -528,9 +529,10 @@ export const assertSnapshotsMatch = async (
// Consistently end in a newline
await snapshot(formattedQueries + "\n", sqlFileName);
} else if (only === "mermaid") {
const graphString = extensions?.explain?.operations?.find(
(op) => op.type === "mermaid-js",
)?.diagram;
const planOp = extensions?.explain?.operations?.find(
(op) => op.type === "plan",
);
const graphString = planToMermaid(planOp.plan);
const mermaidFileName = basePath + (ext || "") + ".mermaid";
if (!graphString) {
throw new Error("No plan was emitted for this test!");
Expand Down
Loading

0 comments on commit 3f47a41

Please sign in to comment.