Skip to content

Commit

Permalink
chore: update mapeo schema (#8)
Browse files Browse the repository at this point in the history
* update @mapeo/schema fix type errors

* install local version of mapeo-schema

* update mapeo-schema to next.17

* update mapeo/schema, add correct string format for new stuff

* add comver string for `configMetadata`

* update mapeo/schema, add presetRef to observation

---------

Co-authored-by: Tomás Ciccola <[email protected]>
  • Loading branch information
tomasciccola and Tomás Ciccola authored Aug 6, 2024
1 parent 10e2386 commit 19dfbb8
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 142 deletions.
57 changes: 50 additions & 7 deletions lib/faker.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const FAKER_EXTENSIONS = /** @type {const} */ ({
},
}),
id8: () => hexString(8),
comver: () =>
`${Math.floor(Math.random() * 100)}.${Math.floor(Math.random() * 100)}`,
},
})

Expand Down Expand Up @@ -83,11 +85,6 @@ function createFakerSchema(schema) {
mutateWithFakerProperty(s.properties.lon, 'location.longitude')
mutateWithFakerProperty(s.properties.lat, 'location.latitude')

mutateWithFakerProperty(
s.properties.refs.items.properties.id,
'mapeo.versionId',
)

mutateWithFakerProperty(
s.properties.attachments.items.properties.driveDiscoveryId,
'mapeo.id',
Expand All @@ -101,14 +98,40 @@ function createFakerSchema(schema) {
'mapeo.id8',
)

mutateWithFakerProperty(
s.properties.presetRef.properties.docId,
'mapeo.id',
)

mutateWithFakerProperty(
s.properties.presetRef.properties.versionId,
'mapeo.versionId',
)

return s
}
case 'Preset': {
mutateWithFakerProperty(s.properties.fieldIds, 'mapeo.links')
mutateWithFakerProperty(s.properties.iconId, 'mapeo.id')
mutateWithFakerProperty(
s.properties.fieldRefs.items.properties.docId,
'mapeo.id',
)
mutateWithFakerProperty(
s.properties.fieldRefs.items.properties.versionId,
'mapeo.versionId',
)

mutateWithFakerProperty(s.properties.iconRef.properties.docId, 'mapeo.id')
mutateWithFakerProperty(
s.properties.iconRef.properties.versionId,
'mapeo.versionId',
)
return s
}
case 'ProjectSettings': {
mutateWithFakerProperty(
s.properties.configMetadata.properties.fileVersion,
'mapeo.comver',
)
return s
}
case 'Role': {
Expand All @@ -124,6 +147,26 @@ function createFakerSchema(schema) {
)
return s
}
case 'Track': {
mutateWithFakerProperty(
s.properties.observationRefs.items.properties.docId,
'mapeo.id',
)
mutateWithFakerProperty(
s.properties.observationRefs.items.properties.versionId,
'mapeo.versionId',
)
return s
}
case 'translation': {
mutateWithFakerProperty(s.properties.docRef.properties.docId, 'mapeo.id')
mutateWithFakerProperty(
s.properties.docRef.properties.versionId,
'mapeo.versionId',
)

return s
}
}
}

Expand Down
Loading

0 comments on commit 19dfbb8

Please sign in to comment.