|
1 | | -import { PropertyIdSymbol, TypeIdsSymbol } from '@graphprotocol/hypergraph/constants'; |
2 | | -import { isRelation } from '@graphprotocol/hypergraph/utils/isRelation'; |
| 1 | +import { Constants, Utils } from '@graphprotocol/hypergraph'; |
3 | 2 | import * as Option from 'effect/Option'; |
4 | 3 | import type * as Schema from 'effect/Schema'; |
5 | 4 | import * as SchemaAST from 'effect/SchemaAST'; |
@@ -34,13 +33,13 @@ export const convertRelations = <S extends Schema.Schema.AnyNoContext>( |
34 | 33 | const rawEntity: Record<string, string | boolean | number | unknown[] | Date> = {}; |
35 | 34 |
|
36 | 35 | for (const prop of ast.propertySignatures) { |
37 | | - const result = SchemaAST.getAnnotation<string>(PropertyIdSymbol)(prop.type); |
| 36 | + const result = SchemaAST.getAnnotation<string>(Constants.PropertyIdSymbol)(prop.type); |
38 | 37 |
|
39 | | - if (isRelation(prop.type) && Option.isSome(result)) { |
| 38 | + if (Utils.isRelation(prop.type) && Option.isSome(result)) { |
40 | 39 | rawEntity[String(prop.name)] = []; |
41 | 40 |
|
42 | 41 | const relationTransformation = prop.type.rest?.[0]?.type; |
43 | | - const typeIds: string[] = SchemaAST.getAnnotation<string[]>(TypeIdsSymbol)(relationTransformation).pipe( |
| 42 | + const typeIds: string[] = SchemaAST.getAnnotation<string[]>(Constants.TypeIdsSymbol)(relationTransformation).pipe( |
44 | 43 | Option.getOrElse(() => []), |
45 | 44 | ); |
46 | 45 | if (typeIds.length === 0) { |
@@ -69,7 +68,7 @@ export const convertRelations = <S extends Schema.Schema.AnyNoContext>( |
69 | 68 | }; |
70 | 69 |
|
71 | 70 | for (const nestedProp of relationTransformation.propertySignatures) { |
72 | | - const nestedResult = SchemaAST.getAnnotation<string>(PropertyIdSymbol)(nestedProp.type); |
| 71 | + const nestedResult = SchemaAST.getAnnotation<string>(Constants.PropertyIdSymbol)(nestedProp.type); |
73 | 72 | if (Option.isSome(nestedResult)) { |
74 | 73 | const value = relationEntry.toEntity.valuesList?.find((a) => a.propertyId === nestedResult.value); |
75 | 74 | if (!value) { |
|
0 commit comments