Skip to content

Commit de9a4ac

Browse files
committed
core: add support of status to creative work
1 parent 59c27af commit de9a4ac

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

packages/core/src/types/external/OrgSchema/CreativeWork.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { lazy, object, parse, string, union, type ObjectEntries } from 'valibot';
1+
import { lazy, literal, object, parse, string, union, type ObjectEntries } from 'valibot';
22

33
import { definedTerm, type DefinedTerm } from './DefinedTerm';
44
import orgSchemaProperties from './private/orgSchemaProperties';
@@ -35,6 +35,13 @@ export type CreativeWork = Thing & {
3535
*/
3636
citation?: readonly CreativeWork[] | undefined;
3737

38+
/**
39+
* The status of the creative work, such as whether it is incomplete or published.
40+
*
41+
* @see https://schema.org/creativeWorkStatus
42+
*/
43+
creativeWorkStatus?: 'incomplete' | 'published' | undefined;
44+
3845
/**
3946
* The schema.org [isBasedOn](https://schema.org/isBasedOn) property provides a resource from which this work is derived or from which it is a modification or adaptation.
4047
*/
@@ -93,6 +100,7 @@ export const creativeWork = <TEntries extends ObjectEntries>(entries?: TEntries
93100
abstract: orgSchemaProperty(string()),
94101
author: orgSchemaProperty(union([person(), string()])),
95102
citation: orgSchemaProperties(lazy(() => creativeWork())),
103+
creativeWorkStatus: orgSchemaProperty(union([literal('incomplete'), literal('published')])),
96104
isBasedOn: orgSchemaProperty(lazy(() => creativeWork())),
97105
keywords: orgSchemaProperties(union([lazy(() => definedTerm()), string()])),
98106
pattern: orgSchemaProperty(lazy(() => definedTerm())),

packages/core/src/types/external/OrgSchema/Thing.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { type EmptyObject } from 'type-fest';
2-
import { lazy, literal, looseObject, optional, parse, pipe, string, type ObjectEntries } from 'valibot';
2+
import { lazy, literal, looseObject, optional, parse, pipe, string, union, type ObjectEntries } from 'valibot';
33

44
import { action, type Action } from './Action';
55
import orgSchemaProperties from './private/orgSchemaProperties';
66
import orgSchemaProperty from './private/orgSchemaProperty';
7+
import type OneOrMany from '../../OneOrMany';
8+
import { creativeWork, type CreativeWork } from './CreativeWork';
79

810
/**
911
* The most generic type of item.
@@ -58,6 +60,13 @@ export type Thing = {
5860
* @see https://schema.org/url
5961
*/
6062
url?: string | undefined;
63+
64+
/**
65+
* Indicates an item or CreativeWork that this item, or CreativeWork (in some sense), is part of.
66+
*
67+
* @see https://schema.org/isPartOf
68+
*/
69+
isPartOf?: OneOrMany<CreativeWork> | undefined;
6170
};
6271

6372
const thingEntries = {
@@ -70,7 +79,8 @@ const thingEntries = {
7079
description: orgSchemaProperty(string()),
7180
name: orgSchemaProperty(string()),
7281
potentialAction: orgSchemaProperties(lazy(() => action())),
73-
url: orgSchemaProperty(string())
82+
url: orgSchemaProperty(string()),
83+
isPartOf: orgSchemaProperties(lazy(() => creativeWork()))
7484
};
7585

7686
export const thing = <TEntries extends ObjectEntries>(entries?: TEntries | undefined) =>

0 commit comments

Comments
 (0)