From 9fc2f358e2a664d2ff2785d8360d0cf58d3173cf Mon Sep 17 00:00:00 2001 From: Rose Reatherford Date: Sat, 8 Nov 2025 09:29:11 -0800 Subject: [PATCH 1/7] Add author types. --- typescript-types/types.ts | 201 +++++++++++++++++++++++++++++++++++++- 1 file changed, 199 insertions(+), 2 deletions(-) diff --git a/typescript-types/types.ts b/typescript-types/types.ts index 33c1792..a2b01de 100644 --- a/typescript-types/types.ts +++ b/typescript-types/types.ts @@ -6,10 +6,207 @@ * LICENSE: MIT */ -export type Author = Record & {}; - export type URI = string; // in JSON schema this should be a validated string +/** ===================== + * Common Primitive Aliases + * ===================== */ +type URL = string; +type PositiveInteger = number; + +/** ===================== + * MediaObject + * ===================== */ +export type MediaObject = Record & { + /** The bitrate of the media object. */ + bitrate?: number; + + /** File size in (mega/kilo)bytes. */ + contentSize: number; + + /** Actual bytes of the media object, e.g., the image or video file. */ + contentUrl?: URL; + + /** + * Media type (MIME format, IANA/MDN ref). E.g., application/zip, audio/mpeg. + * Can also be a URL describing the format. + */ + encodingFormat?: Text | URL; + + /** Height of the item. */ + height?: number; + + /** Width of the item. */ + width?: number; + + /** Upload date. */ + uploadDate: string; // ISO date or date-time +} + +/** ===================== + * Identifier / OrganizationIdentifier + * ===================== */ +export type Identifier = PropertyValue & {} + +export type OrganizationIdentifier = + | ISO6523Code + | Ringgold + | ResearchOrganizationRegistry + | EIN + | CaliforniaCorporationNumber + | PropertyValue; + +/** ===================== + * Organization + * ===================== */ +export type Organization = Record & { + /** Physical address of the item. */ + address?: PostalAddress; + + /** The name of the organization. */ + name: Text; + + /** Contact emails. */ + emails?: Email[]; + + /** Identifiers for the organization. */ + identifiers: OrganizationIdentifier[]; + + /** Parent organizations (supersedes branchOf). */ + parentOrganizations?: Organization[]; + + /** An Organization to which this Organization belongs. */ + memberOf?: Organization[]; + + /** Members (Persons or Organizations). */ + members?: Organization[]; + + /** Sub-organizations (inverse of parentOrganizations). */ + subOrganization?: Organization[]; +} + +/** ===================== + * Author and AuthorCRediT + * ===================== */ +export type Author = Record & { + /** The creator of an item. */ + author: Organization | Person; + + /** Description of how a user contributed. */ + contributorRoles: (PropertyValue | AuthorCRediT)[]; + + /** Order of appearance (tie-break by family name). */ + order?: PositiveInteger; +} + +export enum AuthorCRediT { + Conceptualization = "Conceptualization", + Methodology = "Methodology", + Software = "Software", + Validation = "Validation", + FormalAnalysis = "Formal analysis", + Investigation = "Investigation", + Resources = "Resources", + DataCuration = "Data Curation", + WritingOriginalDraft = "Writing - Original Draft", + WritingReviewEditing = "Writing - Review & Editing", + Visualization = "Visualization", + Supervision = "Supervision", + ProjectAdministration = "Project administration", + FundingAcquisition = "Funding acquisition", +} + +/** ===================== + * Person + * ===================== */ +export type Person = Record & { + /** Identifiers for a person. */ + identifiers?: PersonIdentifier[]; + + /** Affiliations. */ + affiliations?: Affiliation[]; + + /** Emails. */ + emails?: string[]; + + /** Names the author is known by. */ + names: PersonName[]; + + /** Physical address. */ + address?: PostalAddress; + + /** Known languages (IETF BCP 47 codes). */ + knowsLanguage?: Language; +} +export type Affiliation = Record & { + affiliate: Organization | Person; + dateStart: string; // date or date-time + dateEnd?: string; // date or date-time + affiliationType: string; +} + +export type PersonName = Record & { + familyNames?: string[]; + givenNames?: string[]; + honorificPrefixes?: string[]; + honorificSuffixes?: string[]; + order?: number; +} + +/** ===================== + * Grant + * ===================== */ +export type Grant = Record & { + /** Ways to identify the grant. */ + identifiers: PropertyValue[]; + + /** + * Something funded or sponsored through a Grant. + * (inverse: funding) + */ + fundedItem: ScholarlyWork | Person | Organization | Event | Product; + + /** The person or organization funding. */ + funder: Person | Organization; + + /** The monetary or non-monetary contribution. */ + funding: MonetaryAmount | Product | Service; + + /** Description of what the funding contributed towards. */ + description?: Text; +} + +/** ===================== + * MonetaryAmount + * ===================== */ +export type MonetaryAmount = Record & { + /** Currency, e.g., USD, BTC, etc. */ + currency: Text; + + /** The value of the monetary amount. */ + value: number | StructuredValue; +} + +/** ===================== + * Placeholder Types (referenced but not defined in YAML) + * ===================== */ +export interface PropertyValue { [key: string]: any; } +export interface ISO6523Code { [key: string]: any; } +export interface Ringgold { [key: string]: any; } +export interface ResearchOrganizationRegistry { [key: string]: any; } +export interface EIN { [key: string]: any; } +export interface CaliforniaCorporationNumber { [key: string]: any; } +export interface PostalAddress { [key: string]: any; } +export interface Email { [key: string]: any; } +export interface PersonIdentifier { [key: string]: any; } +export interface Language { [key: string]: any; } +export interface ScholarlyWork { [key: string]: any; } +export interface Event { [key: string]: any; } +export interface Product { [key: string]: any; } +export interface Service { [key: string]: any; } +export interface StructuredValue { [key: string]: any; } + + export type License = { uri?: URI; // link to full version of license if short name provided name?: string; // short name (eg "CC-BY-SA 3.0", "MIT") From ac0d71caab46096634b79c664e0e60d4c12dca3e Mon Sep 17 00:00:00 2001 From: Rose Reatherford Date: Sat, 8 Nov 2025 09:48:17 -0800 Subject: [PATCH 2/7] Update to remove typos. --- typescript-types/types.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/typescript-types/types.ts b/typescript-types/types.ts index a2b01de..44a220e 100644 --- a/typescript-types/types.ts +++ b/typescript-types/types.ts @@ -140,17 +140,17 @@ export type Person = Record & { } export type Affiliation = Record & { affiliate: Organization | Person; - dateStart: string; // date or date-time - dateEnd?: string; // date or date-time - affiliationType: string; + dateStart: string; // in JSON-schema this should be format date or date-time + dateEnd?: string; // in JSON-schema this should be format date or date-time + affiliationType: string; // in JSON-schema this should have the description, "Describe the relationship to the item." } export type PersonName = Record & { - familyNames?: string[]; + familyNames: string[]; givenNames?: string[]; honorificPrefixes?: string[]; honorificSuffixes?: string[]; - order?: number; + order: number; } /** ===================== @@ -173,7 +173,7 @@ export type Grant = Record & { funding: MonetaryAmount | Product | Service; /** Description of what the funding contributed towards. */ - description?: Text; + description?: string; } /** ===================== From c7e2493f4e8323507858cbf5fd284bcca4e2df91 Mon Sep 17 00:00:00 2001 From: Rose Reatherford Date: Sat, 8 Nov 2025 10:07:00 -0800 Subject: [PATCH 3/7] Update to remove some fields and add more descriptions. --- typescript-types/types.ts | 67 ++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/typescript-types/types.ts b/typescript-types/types.ts index 44a220e..08f5af2 100644 --- a/typescript-types/types.ts +++ b/typescript-types/types.ts @@ -11,36 +11,13 @@ export type URI = string; // in JSON schema this should be a validated string /** ===================== * Common Primitive Aliases * ===================== */ -type URL = string; -type PositiveInteger = number; /** ===================== * MediaObject * ===================== */ export type MediaObject = Record & { - /** The bitrate of the media object. */ - bitrate?: number; - - /** File size in (mega/kilo)bytes. */ - contentSize: number; - /** Actual bytes of the media object, e.g., the image or video file. */ - contentUrl?: URL; - - /** - * Media type (MIME format, IANA/MDN ref). E.g., application/zip, audio/mpeg. - * Can also be a URL describing the format. - */ - encodingFormat?: Text | URL; - - /** Height of the item. */ - height?: number; - - /** Width of the item. */ - width?: number; - - /** Upload date. */ - uploadDate: string; // ISO date or date-time + contentUri: URI; } /** ===================== @@ -63,6 +40,9 @@ export type Organization = Record & { /** Physical address of the item. */ address?: PostalAddress; + /** The URI(s) associated with this organization. */ + uris?: URI[] + /** The name of the organization. */ name: Text; @@ -79,7 +59,7 @@ export type Organization = Record & { memberOf?: Organization[]; /** Members (Persons or Organizations). */ - members?: Organization[]; + members?: (Person | Organization)[]; /** Sub-organizations (inverse of parentOrganizations). */ subOrganization?: Organization[]; @@ -96,7 +76,7 @@ export type Author = Record & { contributorRoles: (PropertyValue | AuthorCRediT)[]; /** Order of appearance (tie-break by family name). */ - order?: PositiveInteger; + order?: number; // In JSON-schema this should have a minimum of 0. } export enum AuthorCRediT { @@ -127,30 +107,47 @@ export type Person = Record & { affiliations?: Affiliation[]; /** Emails. */ - emails?: string[]; + emails?: string[]; // In JSON-schema this should have a format of email. /** Names the author is known by. */ names: PersonName[]; /** Physical address. */ address?: PostalAddress; - - /** Known languages (IETF BCP 47 codes). */ - knowsLanguage?: Language; } + +/** + * The affiliation between people and organziations. + */ export type Affiliation = Record & { + /** The Organization or Person itself. */ affiliate: Organization | Person; + + /** The date the affiliation to this item began. */ dateStart: string; // in JSON-schema this should be format date or date-time + + /** The date the affiliation to this item ended. Leave blank to indicate the affiliation is current. */ dateEnd?: string; // in JSON-schema this should be format date or date-time + + /** Describe the relationship to the item. */ affiliationType: string; // in JSON-schema this should have the description, "Describe the relationship to the item." } +/** + * The name of a Person object. + */ export type PersonName = Record & { + /** Family name. In the U.S., the last name of a Person. */ familyNames: string[]; + + /** Given name. In the U.S., the first name of a Person. */ givenNames?: string[]; + + /** An honorific prefix preceding a Person's name such as Dr/Mrs/Mr. */ honorificPrefixes?: string[]; + + /** An honorific suffix following a Person's name such as M.D./PhD/MSCSW. */ honorificSuffixes?: string[]; - order: number; } /** ===================== @@ -158,7 +155,7 @@ export type PersonName = Record & { * ===================== */ export type Grant = Record & { /** Ways to identify the grant. */ - identifiers: PropertyValue[]; + identifiers?: PropertyValue[]; /** * Something funded or sponsored through a Grant. @@ -181,10 +178,10 @@ export type Grant = Record & { * ===================== */ export type MonetaryAmount = Record & { /** Currency, e.g., USD, BTC, etc. */ - currency: Text; + currency: string; /** The value of the monetary amount. */ - value: number | StructuredValue; + value: number; } /** ===================== @@ -199,12 +196,10 @@ export interface CaliforniaCorporationNumber { [key: string]: any; } export interface PostalAddress { [key: string]: any; } export interface Email { [key: string]: any; } export interface PersonIdentifier { [key: string]: any; } -export interface Language { [key: string]: any; } export interface ScholarlyWork { [key: string]: any; } export interface Event { [key: string]: any; } export interface Product { [key: string]: any; } export interface Service { [key: string]: any; } -export interface StructuredValue { [key: string]: any; } export type License = { From 2abab300c695fa0b8a0b9acf60e7cbd05012ad5b Mon Sep 17 00:00:00 2001 From: Rose Reatherford Date: Sat, 8 Nov 2025 10:16:22 -0800 Subject: [PATCH 4/7] More streamlining and better operability. --- typescript-types/types.ts | 62 ++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/typescript-types/types.ts b/typescript-types/types.ts index 08f5af2..336f1f7 100644 --- a/typescript-types/types.ts +++ b/typescript-types/types.ts @@ -6,37 +6,39 @@ * LICENSE: MIT */ -export type URI = string; // in JSON schema this should be a validated string - /** ===================== * Common Primitive Aliases * ===================== */ +export type URI = string; // in JSON schema this should be a validated string + +/** + * An item which allows flexible and descriptive values. + */ +export interface PropertyValue { + type: "PropertyValue"; + + propertyId: string; + + value: any; +} + /** ===================== * MediaObject * ===================== */ export type MediaObject = Record & { + type: "MediaObject" + /** Actual bytes of the media object, e.g., the image or video file. */ contentUri: URI; } -/** ===================== - * Identifier / OrganizationIdentifier - * ===================== */ -export type Identifier = PropertyValue & {} - -export type OrganizationIdentifier = - | ISO6523Code - | Ringgold - | ResearchOrganizationRegistry - | EIN - | CaliforniaCorporationNumber - | PropertyValue; - /** ===================== * Organization * ===================== */ export type Organization = Record & { + type: "Organization" + /** Physical address of the item. */ address?: PostalAddress; @@ -44,13 +46,13 @@ export type Organization = Record & { uris?: URI[] /** The name of the organization. */ - name: Text; + name: string; /** Contact emails. */ - emails?: Email[]; + emails?: string[]; // In JSON-schema this should be of format "email". /** Identifiers for the organization. */ - identifiers: OrganizationIdentifier[]; + identifiers: PropertyValue[]; /** Parent organizations (supersedes branchOf). */ parentOrganizations?: Organization[]; @@ -69,6 +71,8 @@ export type Organization = Record & { * Author and AuthorCRediT * ===================== */ export type Author = Record & { + type: "Author" + /** The creator of an item. */ author: Organization | Person; @@ -100,8 +104,10 @@ export enum AuthorCRediT { * Person * ===================== */ export type Person = Record & { + type: "Person" + /** Identifiers for a person. */ - identifiers?: PersonIdentifier[]; + identifiers?: PropertyValue[]; /** Affiliations. */ affiliations?: Affiliation[]; @@ -120,6 +126,8 @@ export type Person = Record & { * The affiliation between people and organziations. */ export type Affiliation = Record & { + type: "Affiliation" + /** The Organization or Person itself. */ affiliate: Organization | Person; @@ -137,6 +145,8 @@ export type Affiliation = Record & { * The name of a Person object. */ export type PersonName = Record & { + type: "PersonName" + /** Family name. In the U.S., the last name of a Person. */ familyNames: string[]; @@ -154,6 +164,8 @@ export type PersonName = Record & { * Grant * ===================== */ export type Grant = Record & { + type: "Grant"; + /** Ways to identify the grant. */ identifiers?: PropertyValue[]; @@ -177,6 +189,8 @@ export type Grant = Record & { * MonetaryAmount * ===================== */ export type MonetaryAmount = Record & { + type: "MonetaryAmount"; + /** Currency, e.g., USD, BTC, etc. */ currency: string; @@ -187,15 +201,9 @@ export type MonetaryAmount = Record & { /** ===================== * Placeholder Types (referenced but not defined in YAML) * ===================== */ -export interface PropertyValue { [key: string]: any; } -export interface ISO6523Code { [key: string]: any; } -export interface Ringgold { [key: string]: any; } -export interface ResearchOrganizationRegistry { [key: string]: any; } -export interface EIN { [key: string]: any; } -export interface CaliforniaCorporationNumber { [key: string]: any; } + + export interface PostalAddress { [key: string]: any; } -export interface Email { [key: string]: any; } -export interface PersonIdentifier { [key: string]: any; } export interface ScholarlyWork { [key: string]: any; } export interface Event { [key: string]: any; } export interface Product { [key: string]: any; } From c48228184d661254dc15a3966129920d63e547c2 Mon Sep 17 00:00:00 2001 From: Rose Reatherford Date: Sat, 8 Nov 2025 10:20:18 -0800 Subject: [PATCH 5/7] Made dateStart for Affiliation optional. --- typescript-types/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript-types/types.ts b/typescript-types/types.ts index 336f1f7..7327552 100644 --- a/typescript-types/types.ts +++ b/typescript-types/types.ts @@ -132,7 +132,7 @@ export type Affiliation = Record & { affiliate: Organization | Person; /** The date the affiliation to this item began. */ - dateStart: string; // in JSON-schema this should be format date or date-time + dateStart?: string; // in JSON-schema this should be format date or date-time /** The date the affiliation to this item ended. Leave blank to indicate the affiliation is current. */ dateEnd?: string; // in JSON-schema this should be format date or date-time From 29ff72a1d15f5238831af99c2bbcfc229bd08f19 Mon Sep 17 00:00:00 2001 From: Rose Reatherford Date: Sat, 8 Nov 2025 10:23:43 -0800 Subject: [PATCH 6/7] Made familyName for PersonName optional. --- typescript-types/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript-types/types.ts b/typescript-types/types.ts index 7327552..9a4b375 100644 --- a/typescript-types/types.ts +++ b/typescript-types/types.ts @@ -148,7 +148,7 @@ export type PersonName = Record & { type: "PersonName" /** Family name. In the U.S., the last name of a Person. */ - familyNames: string[]; + familyNames?: string[]; /** Given name. In the U.S., the first name of a Person. */ givenNames?: string[]; From f38504bd8dd8673b3691201ca93309bf195f9e5b Mon Sep 17 00:00:00 2001 From: Rose Reatherford Date: Sat, 8 Nov 2025 10:39:41 -0800 Subject: [PATCH 7/7] Make Grant an extension of FundingSource. --- typescript-types/types.ts | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/typescript-types/types.ts b/typescript-types/types.ts index 9a4b375..3f38a40 100644 --- a/typescript-types/types.ts +++ b/typescript-types/types.ts @@ -161,20 +161,17 @@ export type PersonName = Record & { } /** ===================== - * Grant + * Funding information block. * ===================== */ -export type Grant = Record & { - type: "Grant"; +/** + * The source of funding for a scholarly work. + */ +export type FundingSource = Record & { + type: "FundingSource" /** Ways to identify the grant. */ identifiers?: PropertyValue[]; - /** - * Something funded or sponsored through a Grant. - * (inverse: funding) - */ - fundedItem: ScholarlyWork | Person | Organization | Event | Product; - /** The person or organization funding. */ funder: Person | Organization; @@ -185,6 +182,18 @@ export type Grant = Record & { description?: string; } +/** + * The way to connect a funding source to its funded item. + */ +export type Grant = FundingSource & { + type: "Grant"; + + /** + * Something funded or sponsored through a Grant. + */ + fundedItem: ScholarlyWork | Person | Organization | Event | Product; +} + /** ===================== * MonetaryAmount * ===================== */