Skip to content

Commit 145be0c

Browse files
authored
Merge branch '4.0.0' into update-cypher-builder
2 parents 5b5f08c + 2045bf5 commit 145be0c

35 files changed

+227
-275
lines changed

packages/graphql-toolbox/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
"@dnd-kit/core": "6.0.8",
5050
"@dnd-kit/modifiers": "6.0.1",
5151
"@dnd-kit/sortable": "7.0.2",
52-
"@graphiql/react": "0.18.0",
53-
"@neo4j-ndl/base": "1.8.5",
54-
"@neo4j-ndl/react": "1.8.9",
52+
"@graphiql/react": "0.19.0",
53+
"@neo4j-ndl/base": "1.8.8",
54+
"@neo4j-ndl/react": "1.8.13",
5555
"@neo4j/graphql": "3.23.1",
5656
"@neo4j/introspector": "1.0.3",
5757
"classnames": "2.3.2",
@@ -77,7 +77,7 @@
7777
"@types/lodash.debounce": "4.0.7",
7878
"@types/markdown-it": "12.2.3",
7979
"@types/prettier": "2.7.3",
80-
"@types/react-dom": "18.2.6",
80+
"@types/react-dom": "18.2.7",
8181
"@types/webpack": "5.28.1",
8282
"autoprefixer": "10.4.14",
8383
"compression-webpack-plugin": "10.0.0",

packages/graphql-toolbox/src/modules/SchemaView/SchemaView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export const SchemaView = ({ onSchemaChange }: Props) => {
193193

194194
const onSubmit = () => {
195195
if (!editorView) return;
196-
const value = editorView?.state.doc.toString();
196+
const value = Array.from(editorView?.state.doc).toString();
197197
if (value) {
198198
buildSchema(value).catch(() => null);
199199
}

packages/graphql-toolbox/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export {};
6565
declare global {
6666
interface Window {
6767
neo4jDesktopApi: {
68-
getContext: () => Promise<Record<string, unknown> | unknown>;
68+
getContext: () => Promise<unknown>;
6969
};
7070
Canny: any;
7171
CannyIsLoaded: boolean;

packages/graphql/src/classes/Node.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -73,27 +73,11 @@ export interface NodeConstructor extends GraphElementConstructor {
7373
globalIdFieldIsInt?: boolean;
7474
}
7575

76-
type MutableField =
77-
| PrimitiveField
78-
| CustomScalarField
79-
| CustomEnumField
80-
| UnionField
81-
| ObjectField
82-
| TemporalField
83-
| PointField
84-
| CypherField;
85-
86-
type AuthableField =
87-
| PrimitiveField
88-
| CustomScalarField
89-
| CustomEnumField
90-
| UnionField
91-
| ObjectField
92-
| TemporalField
93-
| PointField
94-
| CypherField;
95-
96-
type ConstrainableField = PrimitiveField | CustomScalarField | CustomEnumField | TemporalField | PointField;
76+
type MutableField = PrimitiveField | CustomScalarField | CustomEnumField | UnionField | TemporalField | CypherField;
77+
78+
type AuthableField = PrimitiveField | CustomScalarField | CustomEnumField | UnionField | TemporalField | CypherField;
79+
80+
type ConstrainableField = PrimitiveField | CustomScalarField | CustomEnumField | TemporalField;
9781

9882
export type RootTypeFieldNames = {
9983
create: string;

packages/graphql/src/classes/Subgraph.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { translateResolveReference } from "../translate/translate-resolve-refere
3434
import type { Context, Node } from "../types";
3535
import { execute } from "../utils";
3636
import getNeo4jResolveTree from "../utils/get-neo4j-resolve-tree";
37+
import { isInArray } from "../utils/is-in-array";
3738

3839
// TODO fetch the directive names from the spec
3940
const federationDirectiveNames = [
@@ -48,22 +49,14 @@ const federationDirectiveNames = [
4849
"tag",
4950
"composeDirective",
5051
"interfaceObject",
51-
];
52+
] as const;
5253

5354
type FederationDirectiveName = (typeof federationDirectiveNames)[number];
5455

55-
type FullyQualifiedFederationDirectiveName = `federation__${FederationDirectiveName}`;
56-
5756
type ReferenceResolver = (reference, context: Context, info: GraphQLResolveInfo) => Promise<unknown>;
5857

59-
const isFederationDirectiveName = (name: string): name is FederationDirectiveName =>
60-
federationDirectiveNames.includes(name);
61-
6258
export class Subgraph {
63-
private importArgument: Map<
64-
FederationDirectiveName,
65-
FederationDirectiveName | FullyQualifiedFederationDirectiveName | string
66-
>;
59+
private importArgument: Map<FederationDirectiveName, string>;
6760
private typeDefs: TypeSource;
6861
private linkExtension: SchemaExtensionNode;
6962

@@ -96,7 +89,6 @@ export class Subgraph {
9689
}
9790

9891
public getFullyQualifiedDirectiveName(name: FederationDirectiveName): string {
99-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10092
return this.importArgument.get(name)!;
10193
}
10294

@@ -225,7 +217,7 @@ export class Subgraph {
225217
if (value.kind === Kind.STRING) {
226218
const trimmedName = this.trimDirectiveName(value.value);
227219

228-
if (!isFederationDirectiveName(trimmedName)) {
220+
if (!isInArray(federationDirectiveNames, trimmedName)) {
229221
throw new Error(`Encountered unknown Apollo Federation directive ${value.value}`);
230222
}
231223

@@ -239,7 +231,7 @@ export class Subgraph {
239231
if (name?.value.kind === Kind.STRING) {
240232
const trimmedName = this.trimDirectiveName(name.value.value);
241233

242-
if (!isFederationDirectiveName(trimmedName)) {
234+
if (!isInArray(federationDirectiveNames, trimmedName)) {
243235
throw new Error(`Encountered unknown Apollo Federation directive ${name.value.value}`);
244236
}
245237

packages/graphql/src/classes/utils/asserts-indexes-and-constraints.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ async function getMissingConstraints({
250250
const property = field.dbPropertyNameUnescaped || field.fieldName;
251251
if (node.getAllLabels().every((label) => !existingConstraints[label]?.includes(property))) {
252252
missingConstraints.push({
253-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
254253
constraintName: field.unique!.constraintName,
255254
label: node.getMainLabel(),
256255
property,

packages/graphql/src/graphql/scalars/Duration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export const parseDuration = (
7171
hours: hourUnit = 0,
7272
minutes: minuteUnit = 0,
7373
seconds: secondUnit = 0,
74-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
7574
} = match.groups!;
7675

7776
const years = +yearUnit;

packages/graphql/src/schema/aggregations/aggregation-types-mapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class AggregationTypesMapper {
8282

8383
const aggregationSelectionTypeMatrix: Array<{
8484
name: string;
85-
fields?: Record<string, any | string>;
85+
fields?: Record<string, any>;
8686
directives?: string[];
8787
}> = [
8888
{

packages/graphql/src/schema/get-custom-resolvers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* limitations under the License.
1818
*/
1919

20-
import type { DocumentNode, ObjectTypeDefinitionNode } from "graphql";
20+
import { Kind, type DocumentNode, type ObjectTypeDefinitionNode } from "graphql";
2121
import { isRootType } from "../utils/is-root-type";
2222

2323
interface CustomResolvers {
@@ -30,7 +30,7 @@ interface CustomResolvers {
3030

3131
function getCustomResolvers(document: DocumentNode): CustomResolvers {
3232
const customResolvers = (document.definitions || []).reduce((res: CustomResolvers, definition) => {
33-
if (definition.kind !== "ObjectTypeDefinition") {
33+
if (definition.kind !== Kind.OBJECT_TYPE_DEFINITION) {
3434
return res;
3535
}
3636

packages/graphql/src/schema/get-cypher-meta.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* limitations under the License.
1818
*/
1919

20-
import type { DirectiveNode, FieldDefinitionNode } from "graphql";
20+
import { Kind, type DirectiveNode, type FieldDefinitionNode } from "graphql";
2121

2222
type CypherMeta = {
2323
statement: string;
@@ -46,7 +46,7 @@ function parseStatementFlag(directive: DirectiveNode): string {
4646
if (!stmtArg) {
4747
throw new Error("@cypher statement required");
4848
}
49-
if (stmtArg.value.kind !== "StringValue") {
49+
if (stmtArg.value.kind !== Kind.STRING) {
5050
throw new Error("@cypher statement is not a string");
5151
}
5252

@@ -58,7 +58,7 @@ function parseColumnNameFlag(directive: DirectiveNode): string {
5858
if (!stmtArg) {
5959
throw new Error("@cypher columnName required");
6060
}
61-
if (stmtArg.value.kind !== "StringValue") {
61+
if (stmtArg.value.kind !== Kind.STRING) {
6262
throw new Error("@cypher columnName is not a string");
6363
}
6464

0 commit comments

Comments
 (0)