@@ -51,6 +51,13 @@ export const sWHSource: WebSite = {
5151 additionalType : "SWH"
5252} ;
5353
54+ export const orcidSource : WebSite = {
55+ "@type" : "Website" as const ,
56+ name : "Open Researcher and Contributor ID" ,
57+ url : new URL ( "https://orcid.org/" ) ,
58+ additionalType : "ORCID"
59+ } ;
60+
5461export const identifersUtils = {
5562 makeGenericIdentifier : ( params : { value : string ; url ?: string | URL } ) : SchemaIdentifier => {
5663 const { value, url } = params ;
@@ -67,17 +74,15 @@ export const identifersUtils = {
6774 } ) : SchemaIdentifier => {
6875 const { framaLibreId, additionalType, url } = params ;
6976 return {
70- ...{
71- "@type" : "PropertyValue" as const ,
72- name : "ID on FramaLibre" ,
73- value : framaLibreId ,
74- url : url
75- ? url
76- : framaLibreId . includes ( "https" )
77- ? new URL ( framaLibreId )
78- : new URL ( `https://framalibre.org/notices/${ framaLibreId } ` ) ,
79- subjectOf : framaLibreSource
80- } ,
77+ "@type" : "PropertyValue" as const ,
78+ name : "ID on FramaLibre" ,
79+ value : framaLibreId ,
80+ url : url
81+ ? url
82+ : framaLibreId . includes ( "https" )
83+ ? new URL ( framaLibreId )
84+ : new URL ( `https://framalibre.org/notices/${ framaLibreId } ` ) ,
85+ subjectOf : framaLibreSource ,
8186 ...( additionalType ? { additionalType : additionalType } : { } )
8287 } ;
8388 } ,
@@ -88,51 +93,43 @@ export const identifersUtils = {
8893 } ) : SchemaIdentifier => {
8994 const { wikidataId, additionalType, url } = params ;
9095 return {
91- ...{
92- value : wikidataId ,
93- "@type" : "PropertyValue" as const ,
94- url : url ? url : `https://www.wikidata.org/wiki/${ wikidataId } ` ,
95- subjectOf : wikidataSource ,
96- name : "ID on Wikidata"
97- } ,
96+ value : wikidataId ,
97+ "@type" : "PropertyValue" as const ,
98+ url : url ? url : `https://www.wikidata.org/wiki/${ wikidataId } ` ,
99+ subjectOf : wikidataSource ,
100+ name : "ID on Wikidata" ,
98101 ...( additionalType ? { additionalType : additionalType } : { } )
99102 } ;
100103 } ,
101104 makeCDLIdentifier : ( params : { cdlId : string ; url : string | URL ; additionalType ?: string } ) : SchemaIdentifier => {
102105 const { cdlId, url, additionalType } = params ;
103106 return {
104- ...{
105- "@type" : "PropertyValue" as const ,
106- additionalType : "Organization" ,
107- value : cdlId ,
108- url : url ,
109- subjectOf : cDLSource
110- } ,
107+ "@type" : "PropertyValue" as const ,
108+ additionalType : "Organization" ,
109+ value : cdlId ,
110+ url : url ,
111+ subjectOf : cDLSource ,
111112 ...( additionalType ? { additionalType : additionalType } : { } )
112113 } ;
113114 } ,
114115 makeCNLLIdentifier : ( params : { cNNLId : string ; url : string ; additionalType ?: string } ) : SchemaIdentifier => {
115116 const { cNNLId, url, additionalType } = params ;
116117 return {
117- ...{
118- "@type" : "PropertyValue" as const ,
119- value : cNNLId ,
120- url : url ,
121- subjectOf : cNNLSource
122- } ,
118+ "@type" : "PropertyValue" as const ,
119+ value : cNNLId ,
120+ url : url ,
121+ subjectOf : cNNLSource ,
123122 ...( additionalType ? { additionalType : additionalType } : { } )
124123 } ;
125124 } ,
126125 makeDOIIdentifier : ( params : { doi : string ; additionalType ?: string } ) : SchemaIdentifier => {
127126 const { doi, additionalType } = params ;
128127 return {
129- ...{
130- "@type" : "PropertyValue" ,
131- name : "DOI id" ,
132- url : new URL ( `https://doi.org/${ doi } ` ) ,
133- value : doi ,
134- subjectOf : doiSource
135- } ,
128+ "@type" : "PropertyValue" ,
129+ name : "DOI id" ,
130+ url : new URL ( `https://doi.org/${ doi } ` ) ,
131+ value : doi ,
132+ subjectOf : doiSource ,
136133 ...( additionalType ? { additionalType : additionalType } : { } )
137134 } ;
138135 } ,
@@ -142,12 +139,10 @@ export const identifersUtils = {
142139 makeHALIdentifier : ( params : { halId : string ; additionalType ?: string ; url ?: string } ) : SchemaIdentifier => {
143140 const { halId, additionalType, url } = params ;
144141 return {
145- ...{
146- "@type" : "PropertyValue" as const ,
147- value : halId ,
148- url : url ? url : `https://hal.science/hal-0${ halId } ` ,
149- subjectOf : halSource
150- } ,
142+ "@type" : "PropertyValue" as const ,
143+ value : halId ,
144+ url : url ? url : `https://hal.science/hal-0${ halId } ` ,
145+ subjectOf : halSource ,
151146 ...( additionalType ? { additionalType : additionalType } : { } )
152147 } ;
153148 } ,
@@ -157,12 +152,20 @@ export const identifersUtils = {
157152 makeSWHIdentifier : ( params : { swhId : string ; additionalType ?: string ; url : string } ) : SchemaIdentifier => {
158153 const { swhId, additionalType, url } = params ;
159154 return {
160- ...{
161- "@type" : "PropertyValue" as const ,
162- value : swhId ,
163- url : url ,
164- subjectOf : sWHSource
165- } ,
155+ "@type" : "PropertyValue" as const ,
156+ value : swhId ,
157+ url : url ,
158+ subjectOf : sWHSource ,
159+ ...( additionalType ? { additionalType : additionalType } : { } )
160+ } ;
161+ } ,
162+ makeOrcidIdentifer : ( params : { orcidId : string ; additionalType ?: string } ) : SchemaIdentifier => {
163+ const { orcidId, additionalType } = params ;
164+ return {
165+ "@type" : "PropertyValue" as const ,
166+ value : orcidId ,
167+ url : `https://orcid.org/${ orcidId } ` ,
168+ subjectOf : orcidSource ,
166169 ...( additionalType ? { additionalType : additionalType } : { } )
167170 } ;
168171 }
0 commit comments