11import { type CreatePropertyParams , Graph , Id as Grc20Id , type Op } from '@graphprotocol/grc-20' ;
22import { Data , Array as EffectArray , Schema as EffectSchema , Option , pipe } from 'effect' ;
3-
3+ import { GeoIdSchema } from '../utils/geo-id.js' ;
44import { namesAreUnique , toCamelCase , toPascalCase } from './Utils.js' ;
55
66/**
@@ -46,20 +46,20 @@ export type MappingEntry = {
4646 *
4747 * const mapping: Mapping = {
4848 * Account: {
49- * typeIds: [Id('a5fd07b1-120f-46c6-b46f-387ef98396a6 ')],
49+ * typeIds: [Id('a5fd07b1120f46c6b46f387ef98396a6 ')],
5050 * properties: {
51- * username: Id('994edcff-6996-4a77-9797-a13e5e3efad8 '),
52- * createdAt: Id('64bfba51-a69b-4746-be4b-213214a879fe ')
51+ * username: Id('994edcff69964a779797a13e5e3efad8 '),
52+ * createdAt: Id('64bfba51a69b4746be4b213214a879fe ')
5353 * }
5454 * },
5555 * Event: {
56- * typeIds: [Id('0349187b-526f-435f-b2bb-9e9caf23127a ')],
56+ * typeIds: [Id('0349187b526f435fb2bb9e9caf23127a ')],
5757 * properties: {
58- * name: Id('3808e060-fb4a-4d08-8069-35b8c8a1902b '),
59- * description: Id('1f0d9007-8da2-4b28-ab9f-3bc0709f4837 '),
58+ * name: Id('3808e060fb4a4d08806935b8c8a1902b '),
59+ * description: Id('1f0d90078da24b28ab9f3bc0709f4837 '),
6060 * },
6161 * relations: {
62- * speaker: Id('a5fd07b1-120f-46c6-b46f-387ef98396a6 ')
62+ * speaker: Id('a5fd07b1120f46c6b46f387ef98396a6 ')
6363 * }
6464 * }
6565 * }
@@ -132,7 +132,7 @@ export function getDataType(val: string): SchemaDataType {
132132
133133const BaseSchemaTypeProperty = EffectSchema . Struct ( {
134134 name : EffectSchema . NonEmptyTrimmedString ,
135- knowledgeGraphId : EffectSchema . NullOr ( EffectSchema . UUID ) ,
135+ knowledgeGraphId : EffectSchema . NullOr ( GeoIdSchema ) ,
136136 /**
137137 * @since 0.4.0
138138 */
@@ -181,7 +181,7 @@ export function propertyIsRelation(
181181 */
182182export const SchemaType = EffectSchema . Struct ( {
183183 name : EffectSchema . NonEmptyTrimmedString ,
184- knowledgeGraphId : EffectSchema . NullOr ( EffectSchema . UUID ) ,
184+ knowledgeGraphId : EffectSchema . NullOr ( GeoIdSchema ) ,
185185 properties : EffectSchema . Array ( EffectSchema . Union ( SchemaTypePropertyPrimitive , SchemaTypePropertyRelation ) ) . pipe (
186186 EffectSchema . minItems ( 1 ) ,
187187 EffectSchema . filter ( namesAreUnique , {
@@ -233,12 +233,12 @@ export const Schema = EffectSchema.Struct({
233233 types : [
234234 {
235235 name : 'Account' ,
236- knowledgeGraphId : 'a5fd07b1-120f-46c6-b46f-387ef98396a6 ' ,
236+ knowledgeGraphId : 'a5fd07b1120f46c6b46f387ef98396a6 ' ,
237237 properties : [
238238 {
239239 name : 'name' ,
240240 optional : true ,
241- knowledgeGraphId : 'a126ca53-0c8e-48d5-b888-82c734c38935 ' ,
241+ knowledgeGraphId : 'a126ca530c8e48d5b88882c734c38935 ' ,
242242 dataType : 'String' ,
243243 } ,
244244 ] ,
@@ -530,12 +530,12 @@ function processType(type: SchemaType, typeIdMap: TypeIdMapping): ProcessedType
530530 * types: [
531531 * {
532532 * name: "Account",
533- * knowledgeGraphId: "a5fd07b1-120f-46c6-b46f-387ef98396a6 ",
533+ * knowledgeGraphId: "a5fd07b1120f46c6b46f387ef98396a6 ",
534534 * properties: [
535535 * {
536536 * name: "username",
537537 * dataType: "String",
538- * knowledgeGraphId: "994edcff-6996-4a77-9797-a13e5e3efad8 "
538+ * knowledgeGraphId: "994edcff69964a779797a13e5e3efad8 "
539539 * },
540540 * {
541541 * name: "createdAt",
@@ -551,7 +551,7 @@ function processType(type: SchemaType, typeIdMap: TypeIdMapping): ProcessedType
551551 * {
552552 * name: "name",
553553 * dataType: "String",
554- * knowledgeGraphId: "3808e060-fb4a-4d08-8069-35b8c8a1902b "
554+ * knowledgeGraphId: "3808e060fb4a4d08806935b8c8a1902b "
555555 * },
556556 * {
557557 * name: "description",
@@ -572,20 +572,20 @@ function processType(type: SchemaType, typeIdMap: TypeIdMapping): ProcessedType
572572 *
573573 * expect(mapping).toEqual({
574574 * Account: {
575- * typeIds: [Id("a5fd07b1-120f-46c6-b46f-387ef98396a6 ")], // comes from input schema
575+ * typeIds: [Id("a5fd07b1120f46c6b46f387ef98396a6 ")], // comes from input schema
576576 * properties: {
577- * username: Id("994edcff-6996-4a77-9797-a13e5e3efad8 "), // comes from input schema
578- * createdAt: Id("8cd7d9ac-a878-4287-8000-e71e6f853117 "), // generated from Graph.createProperty Op
577+ * username: Id("994edcff69964a779797a13e5e3efad8 "), // comes from input schema
578+ * createdAt: Id("8cd7d9aca87842878000e71e6f853117 "), // generated from Graph.createProperty Op
579579 * }
580580 * },
581581 * Event: {
582- * typeIds: [Id("20b3fe39-8e62-41a0-b9cb-92743fd760da ")], // generated from Graph.createType Op
582+ * typeIds: [Id("20b3fe398e6241a0b9cb92743fd760da ")], // generated from Graph.createType Op
583583 * properties: {
584- * name: Id("3808e060-fb4a-4d08-8069-35b8c8a1902b "), // comes from input schema
585- * description: Id("8fc4e17c-7581-4d6c-a712-943385afc7b5 "), // generated from Graph.createProperty Op
584+ * name: Id("3808e060fb4a4d08806935b8c8a1902b "), // comes from input schema
585+ * description: Id("8fc4e17c75814d6ca712943385afc7b5 "), // generated from Graph.createProperty Op
586586 * },
587587 * relations: {
588- * speaker: Id("651ce59f-643b-4931-bf7a-5dc0ca0f5a47 "), // generated from Graph.createProperty Op
588+ * speaker: Id("651ce59f643b4931bf7a5dc0ca0f5a47 "), // generated from Graph.createProperty Op
589589 * }
590590 * }
591591 * })
@@ -594,31 +594,31 @@ function processType(type: SchemaType, typeIdMap: TypeIdMapping): ProcessedType
594594 * {
595595 * type: "CREATE_PROPERTY",
596596 * property: {
597- * id: Id("8cd7d9ac-a878-4287-8000-e71e6f853117 "),
597+ * id: Id("8cd7d9aca87842878000e71e6f853117 "),
598598 * dataType: "String"
599599 * }
600600 * },
601601 * // Graph.createProperty Op for Event.description property
602602 * {
603603 * type: "CREATE_PROPERTY",
604604 * property: {
605- * id: Id("8fc4e17c-7581-4d6c-a712-943385afc7b5 "),
605+ * id: Id("8fc4e17c75814d6ca712943385afc7b5 "),
606606 * dataType: "String"
607607 * }
608608 * },
609609 * // Graph.createProperty Op for Event.speaker property
610610 * {
611611 * type: "CREATE_PROPERTY",
612612 * property: {
613- * id: Id("651ce59f-643b-4931-bf7a-5dc0ca0f5a47 "),
613+ * id: Id("651ce59f643b4931bf7a5dc0ca0f5a47 "),
614614 * dataType: "RELATION"
615615 * }
616616 * },
617617 * // Graph.createType Op for Event type
618618 * {
619619 * type: "CREATE_PROPERTY",
620620 * property: {
621- * id: Id("651ce59f-643b-4931-bf7a-5dc0ca0f5a47 "),
621+ * id: Id("651ce59f643b4931bf7a5dc0ca0f5a47 "),
622622 * dataType: "RELATION"
623623 * }
624624 * },
0 commit comments