diff --git a/src/schema.js b/src/schema.js index 651fdf1..bcfee5e 100644 --- a/src/schema.js +++ b/src/schema.js @@ -5,6 +5,7 @@ import walkSync from 'walk-sync' import { resolvers } from './resolvers' import { authenticationFieldTransformer } from './transformers/authenticationFieldTransformer' import { subscriptionFieldTransformer } from './transformers/subscriptionFieldTransformer' +import { createdUpdatedFieldTransformer } from './transformers/createdUpdatedFieldTransformer' /* * Determine type definitions from which to auto generate queries and mutations @@ -46,6 +47,7 @@ export const schema = transformSchema( }), [ subscriptionFieldTransformer, - authenticationFieldTransformer + authenticationFieldTransformer, + createdUpdatedFieldTransformer, ] ) diff --git a/src/schema/interface/ActionInterface.graphql b/src/schema/interface/ActionInterface.graphql index a34f702..c9b1890 100644 --- a/src/schema/interface/ActionInterface.graphql +++ b/src/schema/interface/ActionInterface.graphql @@ -34,9 +34,9 @@ interface ActionInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ######################## ### ThingInterface properties ### diff --git a/src/schema/interface/CreativeWorkInterface.graphql b/src/schema/interface/CreativeWorkInterface.graphql index 6f0c450..27f1d48 100644 --- a/src/schema/interface/CreativeWorkInterface.graphql +++ b/src/schema/interface/CreativeWorkInterface.graphql @@ -34,9 +34,9 @@ interface CreativeWorkInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ######################## ### ThingInterface properties ### diff --git a/src/schema/interface/LegalPersonInterface.graphql b/src/schema/interface/LegalPersonInterface.graphql index 9a840e9..7a0b1fc 100644 --- a/src/schema/interface/LegalPersonInterface.graphql +++ b/src/schema/interface/LegalPersonInterface.graphql @@ -33,9 +33,9 @@ interface LegalPersonInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ################################# ### ThingInterface properties ### diff --git a/src/schema/interface/MediaObjectInterface.graphql b/src/schema/interface/MediaObjectInterface.graphql index 6e18645..719d4b6 100644 --- a/src/schema/interface/MediaObjectInterface.graphql +++ b/src/schema/interface/MediaObjectInterface.graphql @@ -34,9 +34,9 @@ interface MediaObjectInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ################################# ### ThingInterface properties ### diff --git a/src/schema/interface/OrganizationInterface.graphql b/src/schema/interface/OrganizationInterface.graphql index fe1915b..cbed74b 100644 --- a/src/schema/interface/OrganizationInterface.graphql +++ b/src/schema/interface/OrganizationInterface.graphql @@ -34,9 +34,9 @@ interface OrganizationInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ######################## ### ThingInterface properties ### diff --git a/src/schema/interface/PerformerInterface.graphql b/src/schema/interface/PerformerInterface.graphql index 0cf459e..183d309 100644 --- a/src/schema/interface/PerformerInterface.graphql +++ b/src/schema/interface/PerformerInterface.graphql @@ -33,9 +33,9 @@ interface PerformerInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ################################# ### ThingInterface properties ### diff --git a/src/schema/interface/SearchableInterface.graphql b/src/schema/interface/SearchableInterface.graphql index f149ebb..1351399 100644 --- a/src/schema/interface/SearchableInterface.graphql +++ b/src/schema/interface/SearchableInterface.graphql @@ -57,9 +57,9 @@ interface SearchableInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/interface/ThingInterface.graphql b/src/schema/interface/ThingInterface.graphql index b96633d..3d4fb21 100644 --- a/src/schema/interface/ThingInterface.graphql +++ b/src/schema/interface/ThingInterface.graphql @@ -58,7 +58,7 @@ interface ThingInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime } diff --git a/src/schema/type/Action.graphql b/src/schema/type/Action.graphql index 9d35b06..9081c94 100644 --- a/src/schema/type/Action.graphql +++ b/src/schema/type/Action.graphql @@ -34,9 +34,9 @@ type Action implements ThingInterface & ActionInterface & ProvenanceEntityInterf "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/AddAction.graphql b/src/schema/type/AddAction.graphql index 914968c..39c8769 100644 --- a/src/schema/type/AddAction.graphql +++ b/src/schema/type/AddAction.graphql @@ -34,9 +34,9 @@ type AddAction implements ThingInterface & ActionInterface & ProvenanceEntityInt "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ######################## ### ThingInterface properties ### diff --git a/src/schema/type/Article.graphql b/src/schema/type/Article.graphql index 31a1488..a1e66d1 100644 --- a/src/schema/type/Article.graphql +++ b/src/schema/type/Article.graphql @@ -34,9 +34,9 @@ type Article implements SearchableInterface & ThingInterface & ProvenanceEntityI "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/Audience.graphql b/src/schema/type/Audience.graphql index 8fec7e4..520ae65 100644 --- a/src/schema/type/Audience.graphql +++ b/src/schema/type/Audience.graphql @@ -34,9 +34,9 @@ type Audience implements ThingInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ######################## ### ThingInterface properties ### "https://schema.org/additionalType" diff --git a/src/schema/type/AudioObject.graphql b/src/schema/type/AudioObject.graphql index 2d73162..f26b7ba 100644 --- a/src/schema/type/AudioObject.graphql +++ b/src/schema/type/AudioObject.graphql @@ -34,9 +34,9 @@ type AudioObject implements SearchableInterface & ThingInterface & ProvenanceEnt "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/ControlAction.graphql b/src/schema/type/ControlAction.graphql index 8cb3bb4..b2857bf 100644 --- a/src/schema/type/ControlAction.graphql +++ b/src/schema/type/ControlAction.graphql @@ -34,9 +34,9 @@ type ControlAction implements ThingInterface & ActionInterface & ProvenanceEntit "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ######################## ### ThingInterface properties ### diff --git a/src/schema/type/DataDownload.graphql b/src/schema/type/DataDownload.graphql index ed8b650..7a3a3b2 100644 --- a/src/schema/type/DataDownload.graphql +++ b/src/schema/type/DataDownload.graphql @@ -34,9 +34,9 @@ type DataDownload implements SearchableInterface & ThingInterface & ProvenanceEn "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/Dataset.graphql b/src/schema/type/Dataset.graphql index 7eafa6e..3612816 100644 --- a/src/schema/type/Dataset.graphql +++ b/src/schema/type/Dataset.graphql @@ -34,9 +34,9 @@ type Dataset implements SearchableInterface & ThingInterface & ProvenanceEntityI "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/DefinedTerm.graphql b/src/schema/type/DefinedTerm.graphql index dee7020..4fb32e1 100644 --- a/src/schema/type/DefinedTerm.graphql +++ b/src/schema/type/DefinedTerm.graphql @@ -34,9 +34,9 @@ type DefinedTerm implements ThingInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ################################# ### ThingInterface properties ### diff --git a/src/schema/type/DefinedTermSet.graphql b/src/schema/type/DefinedTermSet.graphql index de450ac..8c550be 100644 --- a/src/schema/type/DefinedTermSet.graphql +++ b/src/schema/type/DefinedTermSet.graphql @@ -34,9 +34,9 @@ type DefinedTermSet implements CreativeWorkInterface & ThingInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ################################# ### ThingInterface properties ### diff --git a/src/schema/type/DeleteAction.graphql b/src/schema/type/DeleteAction.graphql index 3ffe6ce..48e1e72 100644 --- a/src/schema/type/DeleteAction.graphql +++ b/src/schema/type/DeleteAction.graphql @@ -58,9 +58,9 @@ type DeleteAction implements ThingInterface & ActionInterface & ProvenanceEntity "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ####################### ### SKOS properties ### diff --git a/src/schema/type/DigitalDocument.graphql b/src/schema/type/DigitalDocument.graphql index 137862b..91e6b18 100644 --- a/src/schema/type/DigitalDocument.graphql +++ b/src/schema/type/DigitalDocument.graphql @@ -34,9 +34,9 @@ type DigitalDocument implements SearchableInterface & ThingInterface & Provenanc "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/DigitalDocumentPermission.graphql b/src/schema/type/DigitalDocumentPermission.graphql index e1b9e0c..bdee763 100644 --- a/src/schema/type/DigitalDocumentPermission.graphql +++ b/src/schema/type/DigitalDocumentPermission.graphql @@ -34,9 +34,9 @@ type DigitalDocumentPermission implements ThingInterface & ProvenanceEntityInter "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ################################# ### ThingInterface properties ### diff --git a/src/schema/type/EntryPoint.graphql b/src/schema/type/EntryPoint.graphql index 6516020..9daebbe 100644 --- a/src/schema/type/EntryPoint.graphql +++ b/src/schema/type/EntryPoint.graphql @@ -34,9 +34,9 @@ type EntryPoint implements ThingInterface & ProvenanceEntityInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/Event.graphql b/src/schema/type/Event.graphql index d0f3c83..8eb0454 100644 --- a/src/schema/type/Event.graphql +++ b/src/schema/type/Event.graphql @@ -34,9 +34,9 @@ type Event implements SearchableInterface & ThingInterface & ProvenanceEntityInt "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/ImageObject.graphql b/src/schema/type/ImageObject.graphql index 13c39cb..7607d36 100644 --- a/src/schema/type/ImageObject.graphql +++ b/src/schema/type/ImageObject.graphql @@ -34,9 +34,9 @@ type ImageObject implements SearchableInterface & ThingInterface & ProvenanceEnt "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/Intangible.graphql b/src/schema/type/Intangible.graphql index 3ef9118..52d0f69 100644 --- a/src/schema/type/Intangible.graphql +++ b/src/schema/type/Intangible.graphql @@ -34,9 +34,9 @@ type Intangible implements SearchableInterface & ThingInterface & ProvenanceEnti "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### _searchScore: Float diff --git a/src/schema/type/ItemList.graphql b/src/schema/type/ItemList.graphql index a72fec3..8d73403 100644 --- a/src/schema/type/ItemList.graphql +++ b/src/schema/type/ItemList.graphql @@ -34,9 +34,9 @@ type ItemList implements ThingInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ################################# ### ThingInterface properties ### diff --git a/src/schema/type/ListItem.graphql b/src/schema/type/ListItem.graphql index 2656b6a..99f2524 100644 --- a/src/schema/type/ListItem.graphql +++ b/src/schema/type/ListItem.graphql @@ -34,9 +34,9 @@ type ListItem implements ThingInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ################################# ### ThingInterface properties ### diff --git a/src/schema/type/MediaObject.graphql b/src/schema/type/MediaObject.graphql index e621eb3..19267bd 100644 --- a/src/schema/type/MediaObject.graphql +++ b/src/schema/type/MediaObject.graphql @@ -34,9 +34,9 @@ type MediaObject implements SearchableInterface & ThingInterface & ProvenanceEnt "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/MusicAlbum.graphql b/src/schema/type/MusicAlbum.graphql index b923ffa..b23aeea 100644 --- a/src/schema/type/MusicAlbum.graphql +++ b/src/schema/type/MusicAlbum.graphql @@ -34,9 +34,9 @@ type MusicAlbum implements SearchableInterface & ThingInterface & ProvenanceEnti "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/MusicComposition.graphql b/src/schema/type/MusicComposition.graphql index 8f2a278..ffdc813 100644 --- a/src/schema/type/MusicComposition.graphql +++ b/src/schema/type/MusicComposition.graphql @@ -34,9 +34,9 @@ type MusicComposition implements SearchableInterface & ThingInterface & Provenan "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/MusicGroup.graphql b/src/schema/type/MusicGroup.graphql index 4e8da24..959d5c8 100644 --- a/src/schema/type/MusicGroup.graphql +++ b/src/schema/type/MusicGroup.graphql @@ -34,9 +34,9 @@ type MusicGroup implements SearchableInterface & ThingInterface & ProvenanceEnti "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/MusicPlaylist.graphql b/src/schema/type/MusicPlaylist.graphql index 703da50..1aff9af 100644 --- a/src/schema/type/MusicPlaylist.graphql +++ b/src/schema/type/MusicPlaylist.graphql @@ -34,9 +34,9 @@ type MusicPlaylist implements SearchableInterface & ThingInterface & ProvenanceE "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/MusicRecording.graphql b/src/schema/type/MusicRecording.graphql index bb57f62..61d7ae4 100644 --- a/src/schema/type/MusicRecording.graphql +++ b/src/schema/type/MusicRecording.graphql @@ -34,9 +34,9 @@ type MusicRecording implements SearchableInterface & ThingInterface & Provenance "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/Occupation.graphql b/src/schema/type/Occupation.graphql index 51f5717..aaf27fe 100644 --- a/src/schema/type/Occupation.graphql +++ b/src/schema/type/Occupation.graphql @@ -34,9 +34,9 @@ type Occupation implements ThingInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ######################## ### ThingInterface properties ### diff --git a/src/schema/type/Organization.graphql b/src/schema/type/Organization.graphql index 3cf1913..020dac0 100644 --- a/src/schema/type/Organization.graphql +++ b/src/schema/type/Organization.graphql @@ -34,9 +34,9 @@ type Organization implements SearchableInterface & ThingInterface & ProvenanceEn "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/Person.graphql b/src/schema/type/Person.graphql index ebb5b08..81f48d2 100644 --- a/src/schema/type/Person.graphql +++ b/src/schema/type/Person.graphql @@ -34,9 +34,9 @@ type Person implements SearchableInterface & ThingInterface & ProvenanceEntityIn "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/Place.graphql b/src/schema/type/Place.graphql index 307309d..f8896f5 100644 --- a/src/schema/type/Place.graphql +++ b/src/schema/type/Place.graphql @@ -34,9 +34,9 @@ type Place implements SearchableInterface & ThingInterface & ProvenanceEntityInt "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/Product.graphql b/src/schema/type/Product.graphql index e30a8a5..209b6ff 100644 --- a/src/schema/type/Product.graphql +++ b/src/schema/type/Product.graphql @@ -34,9 +34,9 @@ type Product implements SearchableInterface & ThingInterface & ProvenanceEntityI "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/Property.graphql b/src/schema/type/Property.graphql index a22defa..c3ceaa1 100644 --- a/src/schema/type/Property.graphql +++ b/src/schema/type/Property.graphql @@ -34,9 +34,9 @@ type Property implements ThingInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ################################# ### ThingInterface properties ### diff --git a/src/schema/type/PropertyValue.graphql b/src/schema/type/PropertyValue.graphql index 90b5964..31a3b02 100644 --- a/src/schema/type/PropertyValue.graphql +++ b/src/schema/type/PropertyValue.graphql @@ -34,9 +34,9 @@ type PropertyValue implements ThingInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ######################## ### ThingInterface properties ### diff --git a/src/schema/type/PropertyValueSpecification.graphql b/src/schema/type/PropertyValueSpecification.graphql index 916ec7b..c8aa08f 100644 --- a/src/schema/type/PropertyValueSpecification.graphql +++ b/src/schema/type/PropertyValueSpecification.graphql @@ -34,9 +34,9 @@ type PropertyValueSpecification implements ThingInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ################################# ### ThingInterface properties ### diff --git a/src/schema/type/Rating.graphql b/src/schema/type/Rating.graphql index c8a8ff6..715ec7e 100644 --- a/src/schema/type/Rating.graphql +++ b/src/schema/type/Rating.graphql @@ -34,9 +34,9 @@ type Rating implements ThingInterface { "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ################################# ### ThingInterface properties ### diff --git a/src/schema/type/ReplaceAction.graphql b/src/schema/type/ReplaceAction.graphql index 7ad629e..e0db79d 100644 --- a/src/schema/type/ReplaceAction.graphql +++ b/src/schema/type/ReplaceAction.graphql @@ -34,9 +34,9 @@ type ReplaceAction implements ThingInterface & ActionInterface & ProvenanceEntit "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime ######################## ### ThingInterface properties ### diff --git a/src/schema/type/Review.graphql b/src/schema/type/Review.graphql index d41a493..8fbbd8d 100644 --- a/src/schema/type/Review.graphql +++ b/src/schema/type/Review.graphql @@ -34,9 +34,9 @@ type Review implements SearchableInterface & ThingInterface & ProvenanceEntityIn "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/SoftwareApplication.graphql b/src/schema/type/SoftwareApplication.graphql index 8730a0c..8e64b7c 100644 --- a/src/schema/type/SoftwareApplication.graphql +++ b/src/schema/type/SoftwareApplication.graphql @@ -34,9 +34,9 @@ type SoftwareApplication implements SearchableInterface & ThingInterface & Prove "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/schema/type/VideoObject.graphql b/src/schema/type/VideoObject.graphql index ac85d83..6a4795a 100644 --- a/src/schema/type/VideoObject.graphql +++ b/src/schema/type/VideoObject.graphql @@ -34,9 +34,9 @@ type VideoObject implements SearchableInterface & ThingInterface & ProvenanceEnt "http://purl.org/dc/terms/type,http://www.w3.org/1999/02/22-rdf-syntax-ns#type" type: String "http://purl.org/dc/terms/created" - created: String + created: _Neo4jDateTime "http://purl.org/dc/terms/modified" - modified: String + modified: _Neo4jDateTime #################################### ### SearchableInterface property ### diff --git a/src/transformers/createdUpdatedFieldTransformer.js b/src/transformers/createdUpdatedFieldTransformer.js new file mode 100644 index 0000000..4159875 --- /dev/null +++ b/src/transformers/createdUpdatedFieldTransformer.js @@ -0,0 +1,63 @@ +import { TransformRootFields } from 'graphql-tools' +import { buildPropertyValue, parseFieldName } from '../utils/schema' +import { buildArgument, buildName } from 'neo4j-graphql-js/dist/augment/ast' +import { Kind } from 'graphql/language/kinds' + +export const createdUpdatedFieldTransformer = new TransformRootFields((operation, fieldName, field) => { + // Only needed for mutations + if (operation !== 'Mutation') { + return undefined + } + + const { action } = parseFieldName(fieldName) + + if (action !== 'Create' && action !== 'Update' && action !== 'Merge') { + return undefined + } + + const next = field.resolve + + field.resolve = (object, params, context, info) => { + info.fieldNodes = info.fieldNodes.map(fieldNode => { + const createdIndex = fieldNode.arguments.findIndex(argument => argument.name.value === 'created') + const modifiedIndex = fieldNode.arguments.findIndex(argument => argument.name.value === 'modified') + + // remove given created and modified arguments + if (createdIndex !== -1) { + fieldNode.arguments.splice(createdIndex, 1) + } + + if (modifiedIndex !== -1) { + fieldNode.arguments.splice(modifiedIndex, 1) + } + + const date = new Date() + + const value = { + kind: Kind.OBJECT, + fields: [ + buildPropertyValue('year', Kind.INT, date.getUTCFullYear()), + buildPropertyValue('month', Kind.INT, date.getUTCMonth()), + buildPropertyValue('day', Kind.INT, date.getUTCDate()), + buildPropertyValue('hour', Kind.INT, date.getUTCHours()), + buildPropertyValue('minute', Kind.INT, date.getUTCMinutes()), + buildPropertyValue('second', Kind.INT, date.getUTCSeconds()), + buildPropertyValue('millisecond', Kind.INT, date.getUTCMilliseconds()), + buildPropertyValue('timezone', Kind.STRING, 'z') + ] + } + + if (action === 'Create') { + fieldNode.arguments.push(buildArgument({ name: buildName({ name: 'created' }), value })) + } + + if (action === 'Create' || action === 'Update' || action === 'Merge') { + fieldNode.arguments.push(buildArgument({ name: buildName({ name: 'modified' }), value })) + } + + return fieldNode + }) + + return next(object, params, context, info) + } +}) diff --git a/src/utils/schema.js b/src/utils/schema.js index 60c0004..6c042d3 100644 --- a/src/utils/schema.js +++ b/src/utils/schema.js @@ -1,3 +1,6 @@ +import { Kind } from 'graphql/language/kinds' +import { buildName } from 'neo4j-graphql-js/dist/augment/ast' + /** * Parse the given field name into an action and type * @param {string} fieldName @@ -23,3 +26,20 @@ export const generateScope = (mutation, fieldName) => { return `${mutation}:${type}:${action}` } + +/** + * Build an ObjectField AST node + * @param name + * @param kind + * @param value + * @return {{kind: "ObjectField", name: *, value: {kind, block: boolean, value}}} + */ +export const buildPropertyValue = (name, kind, value) => ({ + kind: Kind.OBJECT_FIELD, + name: buildName({ name: name }), + value: { + kind: kind, + value: value, + block: false + } +})