Skip to content

Commit 66b813c

Browse files
committed
Move some functions to their right places
1 parent 7f1468a commit 66b813c

File tree

3 files changed

+38
-39
lines changed

3 files changed

+38
-39
lines changed

.changeset/little-shoes-tease.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@neo4j/graph-schema-utils": patch
3+
---
4+
5+
Move some functions to their right places

packages/graph-schema-utils/src/formatters/json/extensions.ts

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ import {
3636
RelationshipTypeIndexJsonStruct,
3737
RelationshipTypeJsonStruct,
3838
RootSchemaJsonStruct,
39-
isLookupIndexJsonStruct,
40-
isNodeLabelConstraintJsonStruct,
41-
isNodeLabelIndexJsonStruct,
42-
isRelationshipTypeConstraintJsonStruct,
43-
isRelationshipTypeIndexJsonStruct,
4439
} from "./types.js";
4540

4641
export const VERSION = "0.0.1";
@@ -569,3 +564,36 @@ const relationshipObjectType = {
569564
$ref: `#${relationshipObjectType.$id}`,
570565
}),
571566
};
567+
568+
export const isNodeLabelConstraintJsonStruct = (
569+
constraint: ConstraintJsonStruct
570+
): constraint is NodeLabelConstraintJsonStruct => {
571+
return constraint.entityType === "node" && constraint.nodeLabel !== undefined;
572+
};
573+
574+
export const isRelationshipTypeConstraintJsonStruct = (
575+
constraint: ConstraintJsonStruct
576+
): constraint is RelationshipTypeConstraintJsonStruct => {
577+
return (
578+
constraint.entityType === "relationship" &&
579+
constraint.relationshipType !== undefined
580+
);
581+
};
582+
583+
export const isNodeLabelIndexJsonStruct = (
584+
index: IndexJsonStruct
585+
): index is NodeLabelIndexJsonStruct => {
586+
return index.nodeLabel !== undefined && index.indexType !== "lookup";
587+
};
588+
589+
export const isRelationshipTypeIndexJsonStruct = (
590+
index: IndexJsonStruct
591+
): index is RelationshipTypeIndexJsonStruct => {
592+
return index.relationshipType !== undefined && index.indexType !== "lookup";
593+
};
594+
595+
export const isLookupIndexJsonStruct = (
596+
index: IndexJsonStruct
597+
): index is LookupIndexJsonStruct => {
598+
return index.indexType === "lookup";
599+
};

packages/graph-schema-utils/src/formatters/json/types.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
EntityType,
44
IndexType,
55
PrimitivePropertyTypes,
6-
PropertyTypes,
76
} from "../../model/index.js";
87

98
export type RootSchemaJsonStruct = {
@@ -64,27 +63,12 @@ export type NodeLabelConstraintJsonStruct = ConstraintJsonStruct & {
6463
relationshipType: undefined;
6564
};
6665

67-
export const isNodeLabelConstraintJsonStruct = (
68-
constraint: ConstraintJsonStruct
69-
): constraint is NodeLabelConstraintJsonStruct => {
70-
return constraint.entityType === "node" && constraint.nodeLabel !== undefined;
71-
};
72-
7366
export type RelationshipTypeConstraintJsonStruct = ConstraintJsonStruct & {
7467
entityType: "relationship";
7568
nodeLabel: undefined;
7669
relationshipType: { $ref: string };
7770
};
7871

79-
export const isRelationshipTypeConstraintJsonStruct = (
80-
constraint: ConstraintJsonStruct
81-
): constraint is RelationshipTypeConstraintJsonStruct => {
82-
return (
83-
constraint.entityType === "relationship" &&
84-
constraint.relationshipType !== undefined
85-
);
86-
};
87-
8872
export type IndexJsonStruct = {
8973
$id: string;
9074
name: string;
@@ -118,24 +102,6 @@ export type LookupIndexJsonStruct = IndexJsonStruct & {
118102
properties: undefined;
119103
};
120104

121-
export const isNodeLabelIndexJsonStruct = (
122-
index: IndexJsonStruct
123-
): index is NodeLabelIndexJsonStruct => {
124-
return index.nodeLabel !== undefined && index.indexType !== "lookup";
125-
};
126-
127-
export const isRelationshipTypeIndexJsonStruct = (
128-
index: IndexJsonStruct
129-
): index is RelationshipTypeIndexJsonStruct => {
130-
return index.relationshipType !== undefined && index.indexType !== "lookup";
131-
};
132-
133-
export const isLookupIndexJsonStruct = (
134-
index: IndexJsonStruct
135-
): index is LookupIndexJsonStruct => {
136-
return index.indexType === "lookup";
137-
};
138-
139105
export type PropertyJsonStruct = {
140106
$id: string;
141107
token: string;

0 commit comments

Comments
 (0)