@stencila/types
Version:
JavaScript classes and TypeScript types for the Stencila Schema
1,829 lines (1,726 loc) • 103 kB
TypeScript
/**
* The type of an `Admonition`.
*/
type AdmonitionType = 'Note' | 'Info' | 'Tip' | 'Important' | 'Success' | 'Failure' | 'Warning' | 'Danger' | 'Error';
/**
* A `roleName` for an `AuthorRole`.
*/
type AuthorRoleName = 'Writer' | 'Instructor' | 'Prompter' | 'Generator';
type Cord = string;
/**
* Under which circumstances the document node should be automatically executed.
*/
type AutomaticExecution = 'Never' | 'Needed' | 'Always';
/**
* Abstract base type for compound (ie. non-atomic) nodes.
*/
declare class Entity {
type: "Entity";
/**
* The identifier for this item.
*/
id?: string;
constructor(options?: Partial<Entity>);
}
/**
* Create a new `Entity`
*/
declare function entity(options?: Partial<Entity>): Entity;
type UnsignedInteger = number;
/**
* A digest of the content, semantics and dependencies of an executable node.
*/
declare class CompilationDigest extends Entity {
type: "CompilationDigest";
/**
* A digest of the state of a node.
*/
stateDigest: UnsignedInteger;
/**
* A digest of the semantics of the node with respect to the dependency graph.
*/
semanticDigest?: UnsignedInteger;
/**
* A digest of the semantic digests of the dependencies of a node.
*/
dependenciesDigest?: UnsignedInteger;
/**
* A count of the number of dependencies that are stale.
*/
dependenciesStale?: UnsignedInteger;
/**
* A count of the number of dependencies that failed.
*/
dependenciesFailed?: UnsignedInteger;
constructor(stateDigest: UnsignedInteger, options?: Partial<CompilationDigest>);
}
/**
* Create a new `CompilationDigest`
*/
declare function compilationDigest(stateDigest: UnsignedInteger, options?: Partial<CompilationDigest>): CompilationDigest;
/**
* The location within some source code.
*/
declare class CodeLocation extends Entity {
type: "CodeLocation";
/**
* The source of the code, a file path, label or URL.
*/
source?: string;
/**
* The 1-based index if the first line on which the error occurred.
*/
startLine?: UnsignedInteger;
/**
* The 1-based index if the first column on which the error occurred.
*/
startColumn?: UnsignedInteger;
/**
* The 1-based index if the last line on which the error occurred.
*/
endLine?: UnsignedInteger;
/**
* The 1-based index if the last column on which the error occurred.
*/
endColumn?: UnsignedInteger;
constructor(options?: Partial<CodeLocation>);
}
/**
* Create a new `CodeLocation`
*/
declare function codeLocation(options?: Partial<CodeLocation>): CodeLocation;
/**
* The severity level of a message.
*/
type MessageLevel = 'Trace' | 'Debug' | 'Info' | 'Warning' | 'Error' | 'Exception';
/**
* An error, warning or log message generated during compilation.
*/
declare class CompilationMessage extends Entity {
type: "CompilationMessage";
/**
* The severity level of the message.
*/
level: MessageLevel;
/**
* The text of the message.
*/
message: string;
/**
* The type of error e.g. "SyntaxError", "ZeroDivisionError".
*/
errorType?: string;
/**
* The location that the error occurred.
*/
codeLocation?: CodeLocation;
constructor(level: MessageLevel, message: string, options?: Partial<CompilationMessage>);
}
/**
* Create a new `CompilationMessage`
*/
declare function compilationMessage(level: MessageLevel, message: string, options?: Partial<CompilationMessage>): CompilationMessage;
type Integer = number;
/**
* A unit in which time can be measured.
*/
type TimeUnit = 'Year' | 'Month' | 'Week' | 'Day' | 'Hour' | 'Minute' | 'Second' | 'Millisecond' | 'Microsecond' | 'Nanosecond' | 'Picosecond' | 'Femtosecond' | 'Attosecond';
/**
* A value that represents the difference between two timestamps.
*/
declare class Duration extends Entity {
type: "Duration";
/**
* The time difference in `timeUnit`s.
*/
value: Integer;
/**
* The time unit that the `value` represents.
*/
timeUnit: TimeUnit;
constructor(value: Integer, timeUnit: TimeUnit, options?: Partial<Duration>);
}
/**
* Create a new `Duration`
*/
declare function duration(value: Integer, timeUnit: TimeUnit, options?: Partial<Duration>): Duration;
/**
* Abstract base type for executable code nodes (e.g. `CodeChunk`).
*/
declare class CodeExecutable extends Executable {
type: "CodeExecutable";
/**
* The code.
*/
code: Cord;
/**
* The programming language of the code.
*/
programmingLanguage?: string;
/**
* The authors of the executable code.
*/
authors?: Author[];
constructor(code: Cord, options?: Partial<CodeExecutable>);
}
/**
* Create a new `CodeExecutable`
*/
declare function codeExecutable(code: Cord, options?: Partial<CodeExecutable>): CodeExecutable;
/**
* A button.
*/
declare class Button extends CodeExecutable {
type: "Button";
/**
* The name of the variable associated with the button.
*/
name: string;
/**
* A label for the button
*/
label?: string;
/**
* Whether the button is currently disabled
*/
isDisabled?: boolean;
constructor(code: Cord, name: string, options?: Partial<Button>);
}
/**
* Create a new `Button`
*/
declare function button(code: Cord, name: string, options?: Partial<Button>): Button;
/**
* Indicates how a block (usually a `CodeChunk`) should be automatically labelled.
*/
type LabelType = 'FigureLabel' | 'TableLabel';
type Primitive = null | boolean | number | string | Primitive[] | {
[key: string]: Primitive;
};
type Array = Primitive[];
/**
* A hint to the content of an `Array`.
*/
declare class ArrayHint extends Entity {
type: "ArrayHint";
/**
* The length (number of items) of the array.
*/
length: Integer;
/**
* The distinct types of the array items.
*/
itemTypes?: string[];
/**
* The minimum value in the array.
*/
minimum?: Primitive;
/**
* The maximum value in the array.
*/
maximum?: Primitive;
/**
* The number of `Null` values in the array.
*/
nulls?: Integer;
constructor(length: Integer, options?: Partial<ArrayHint>);
}
/**
* Create a new `ArrayHint`
*/
declare function arrayHint(length: Integer, options?: Partial<ArrayHint>): ArrayHint;
/**
* A schema specifying that a node must be a boolean value.
*/
declare class BooleanValidator extends Entity {
type: "BooleanValidator";
constructor(options?: Partial<BooleanValidator>);
}
/**
* Create a new `BooleanValidator`
*/
declare function booleanValidator(options?: Partial<BooleanValidator>): BooleanValidator;
/**
* A validator specifying a constant value that a node must have.
*/
declare class ConstantValidator extends Entity {
type: "ConstantValidator";
/**
* The value that the node must have.
*/
value: Node;
constructor(value: Node, options?: Partial<ConstantValidator>);
}
/**
* Create a new `ConstantValidator`
*/
declare function constantValidator(value: Node, options?: Partial<ConstantValidator>): ConstantValidator;
/**
* A combination of date and time of day in the form `[-]CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]`.
*/
declare class DateTime extends Entity {
type: "DateTime";
/**
* The date as an ISO 8601 string.
*/
value: string;
constructor(value: string, options?: Partial<DateTime>);
}
/**
* Create a new `DateTime`
*/
declare function dateTime(value: string, options?: Partial<DateTime>): DateTime;
/**
* A validator specifying the constraints on a date-time.
*/
declare class DateTimeValidator extends Entity {
type: "DateTimeValidator";
/**
* The inclusive lower limit for a date-time.
*/
minimum?: DateTime;
/**
* The inclusive upper limit for a date-time.
*/
maximum?: DateTime;
constructor(options?: Partial<DateTimeValidator>);
}
/**
* Create a new `DateTimeValidator`
*/
declare function dateTimeValidator(options?: Partial<DateTimeValidator>): DateTimeValidator;
/**
* A calendar date encoded as a ISO 8601 string.
*/
declare class Date extends Entity {
type: "Date";
/**
* The date as an ISO 8601 string.
*/
value: string;
constructor(value: string, options?: Partial<Date>);
}
/**
* Create a new `Date`
*/
declare function date(value: string, options?: Partial<Date>): Date;
/**
* A validator specifying the constraints on a date.
*/
declare class DateValidator extends Entity {
type: "DateValidator";
/**
* The inclusive lower limit for a date.
*/
minimum?: Date;
/**
* The inclusive upper limit for a date.
*/
maximum?: Date;
constructor(options?: Partial<DateValidator>);
}
/**
* Create a new `DateValidator`
*/
declare function dateValidator(options?: Partial<DateValidator>): DateValidator;
/**
* A validator specifying the constraints on a duration.
*/
declare class DurationValidator extends Entity {
type: "DurationValidator";
/**
* The time units that the duration can have.
*/
timeUnits?: TimeUnit[];
/**
* The inclusive lower limit for a duration.
*/
minimum?: Duration;
/**
* The inclusive upper limit for a duration.
*/
maximum?: Duration;
constructor(options?: Partial<DurationValidator>);
}
/**
* Create a new `DurationValidator`
*/
declare function durationValidator(options?: Partial<DurationValidator>): DurationValidator;
/**
* A schema specifying that a node must be one of several values.
*/
declare class EnumValidator extends Entity {
type: "EnumValidator";
/**
* A node is valid if it is equal to any of these values.
*/
values: Node[];
constructor(values: Node[], options?: Partial<EnumValidator>);
}
/**
* Create a new `EnumValidator`
*/
declare function enumValidator(values: Node[], options?: Partial<EnumValidator>): EnumValidator;
/**
* A validator specifying the constraints on a numeric node.
*/
declare class NumberValidator extends Entity {
type: "NumberValidator";
/**
* The inclusive lower limit for a numeric node.
*/
minimum?: number;
/**
* The exclusive lower limit for a numeric node.
*/
exclusiveMinimum?: number;
/**
* The inclusive upper limit for a numeric node.
*/
maximum?: number;
/**
* The exclusive upper limit for a numeric node.
*/
exclusiveMaximum?: number;
/**
* A number that a numeric node must be a multiple of.
*/
multipleOf?: number;
constructor(options?: Partial<NumberValidator>);
}
/**
* Create a new `NumberValidator`
*/
declare function numberValidator(options?: Partial<NumberValidator>): NumberValidator;
/**
* A validator specifying the constraints on an integer node.
*/
declare class IntegerValidator extends NumberValidator {
type: "IntegerValidator";
constructor(options?: Partial<IntegerValidator>);
}
/**
* Create a new `IntegerValidator`
*/
declare function integerValidator(options?: Partial<IntegerValidator>): IntegerValidator;
/**
* A schema specifying constraints on a string node.
*/
declare class StringValidator extends Entity {
type: "StringValidator";
/**
* The minimum length for a string node.
*/
minLength?: Integer;
/**
* The maximum length for a string node.
*/
maxLength?: Integer;
/**
* A regular expression that a string node must match.
*/
pattern?: string;
constructor(options?: Partial<StringValidator>);
}
/**
* Create a new `StringValidator`
*/
declare function stringValidator(options?: Partial<StringValidator>): StringValidator;
/**
* A point in time recurring on multiple days.
*/
declare class Time extends Entity {
type: "Time";
/**
* The time of day as a string in format `hh:mm:ss[Z|(+|-)hh:mm]`.
*/
value: string;
constructor(value: string, options?: Partial<Time>);
}
/**
* Create a new `Time`
*/
declare function time(value: string, options?: Partial<Time>): Time;
/**
* A validator specifying the constraints on a time.
*/
declare class TimeValidator extends Entity {
type: "TimeValidator";
/**
* The inclusive lower limit for a time.
*/
minimum?: Time;
/**
* The inclusive upper limit for a time.
*/
maximum?: Time;
constructor(options?: Partial<TimeValidator>);
}
/**
* Create a new `TimeValidator`
*/
declare function timeValidator(options?: Partial<TimeValidator>): TimeValidator;
/**
* A value that represents a point in time.
*/
declare class Timestamp extends Entity {
type: "Timestamp";
/**
* The time, in `timeUnit`s, before or after the Unix Epoch (1970-01-01T00:00:00Z).
*/
value: Integer;
/**
* The time unit that the `value` represents.
*/
timeUnit: TimeUnit;
constructor(value: Integer, timeUnit: TimeUnit, options?: Partial<Timestamp>);
}
/**
* Create a new `Timestamp`
*/
declare function timestamp(value: Integer, timeUnit: TimeUnit, options?: Partial<Timestamp>): Timestamp;
/**
* A validator specifying the constraints on a timestamp.
*/
declare class TimestampValidator extends Entity {
type: "TimestampValidator";
/**
* The time units that the timestamp can have.
*/
timeUnits?: TimeUnit[];
/**
* The inclusive lower limit for a timestamp.
*/
minimum?: Timestamp;
/**
* The inclusive upper limit for a timestamp.
*/
maximum?: Timestamp;
constructor(options?: Partial<TimestampValidator>);
}
/**
* Create a new `TimestampValidator`
*/
declare function timestampValidator(options?: Partial<TimestampValidator>): TimestampValidator;
/**
* A validator specifying constraints on an array of heterogeneous items.
*/
declare class TupleValidator extends Entity {
type: "TupleValidator";
/**
* An array of validators specifying the constraints on each successive item in the array.
*/
items?: Validator[];
constructor(options?: Partial<TupleValidator>);
}
/**
* Create a new `TupleValidator`
*/
declare function tupleValidator(options?: Partial<TupleValidator>): TupleValidator;
/**
* Union type for validators.
*/
type Validator = ArrayValidator | BooleanValidator | ConstantValidator | DateTimeValidator | DateValidator | DurationValidator | EnumValidator | IntegerValidator | NumberValidator | StringValidator | TimeValidator | TimestampValidator | TupleValidator;
/**
* Create a `Validator` from an object
*/
declare function validator(other: Validator): Validator;
/**
* A validator specifying constraints on an array node.
*/
declare class ArrayValidator extends Entity {
type: "ArrayValidator";
/**
* Whether items can have the value `Node::Null`
*/
itemsNullable?: boolean;
/**
* Another validator node specifying the constraints on all items in the array.
*/
itemsValidator?: Validator;
/**
* An array node is valid if at least one of its items is valid against the `contains` schema.
*/
contains?: Validator;
/**
* An array node is valid if its size is greater than, or equal to, this value.
*/
minItems?: Integer;
/**
* An array node is valid if its size is less than, or equal to, this value.
*/
maxItems?: Integer;
/**
* A flag to indicate that each value in the array should be unique.
*/
uniqueItems?: boolean;
constructor(options?: Partial<ArrayValidator>);
}
/**
* Create a new `ArrayValidator`
*/
declare function arrayValidator(options?: Partial<ArrayValidator>): ArrayValidator;
/**
* `Integer` or `string`
*/
type IntegerOrString = Integer | string;
/**
* An article, including news and scholarly articles.
*/
declare class Article extends CreativeWork {
type: "Article";
/**
* The content of the article.
*/
content: Block[];
/**
* The page on which the article starts; for example "135" or "xiii".
*/
pageStart?: IntegerOrString;
/**
* The page on which the article ends; for example "138" or "xvi".
*/
pageEnd?: IntegerOrString;
/**
* Any description of pages that is not separated into pageStart and pageEnd; for example, "1-6, 9, 55".
*/
pagination?: string;
constructor(content: Block[], options?: Partial<Article>);
}
/**
* Create a new `Article`
*/
declare function article(content: Block[], options?: Partial<Article>): Article;
/**
* The type or nature of a citation, both factually and rhetorically.
*/
type CitationIntent = 'AgreesWith' | 'CitesAsAuthority' | 'CitesAsDataSource' | 'CitesAsEvidence' | 'CitesAsMetadataDocument' | 'CitesAsPotentialSolution' | 'CitesAsRecommendedReading' | 'CitesAsRelated' | 'CitesAsSourceDocument' | 'CitesForInformation' | 'Compiles' | 'Confirms' | 'ContainsAssertionFrom' | 'Corrects' | 'Credits' | 'Critiques' | 'Derides' | 'Describes' | 'DisagreesWith' | 'Discusses' | 'Disputes' | 'Documents' | 'Extends' | 'GivesBackgroundTo' | 'GivesSupportTo' | 'HasReplyFrom' | 'IncludesExcerptFrom' | 'IncludesQuotationFrom' | 'IsAgreedWithBy' | 'IsCitedAsAuthorityBy' | 'IsCitedAsDataSourceBy' | 'IsCitedAsEvidenceBy' | 'IsCitedAsMetadataDocumentBy' | 'IsCitedAsPotentialSolutionBy' | 'IsCitedAsRecommendedReadingBy' | 'IsCitedAsRelatedBy' | 'IsCitedAsSourceDocumentBy' | 'IsCitedBy' | 'IsCitedForInformationBy' | 'IsCompiledBy' | 'IsConfirmedBy' | 'IsCorrectedBy' | 'IsCreditedBy' | 'IsCritiquedBy' | 'IsDeridedBy' | 'IsDescribedBy' | 'IsDisagreedWithBy' | 'IsDiscussedBy' | 'IsDisputedBy' | 'IsDocumentedBy' | 'IsExtendedBy' | 'IsLinkedToBy' | 'IsParodiedBy' | 'IsPlagiarizedBy' | 'IsQualifiedBy' | 'IsRefutedBy' | 'IsRetractedBy' | 'IsReviewedBy' | 'IsRidiculedBy' | 'IsSpeculatedOnBy' | 'IsSupportedBy' | 'IsUpdatedBy' | 'Likes' | 'LinksTo' | 'ObtainsBackgroundFrom' | 'ObtainsSupportFrom' | 'Parodies' | 'Plagiarizes' | 'ProvidesAssertionFor' | 'ProvidesConclusionsFor' | 'ProvidesDataFor' | 'ProvidesExcerptFor' | 'ProvidesMethodFor' | 'ProvidesQuotationFor' | 'Qualifies' | 'Refutes' | 'RepliesTo' | 'Retracts' | 'Reviews' | 'Ridicules' | 'SharesAuthorInstitutionWith' | 'SharesAuthorWith' | 'SharesFundingAgencyWith' | 'SharesJournalWith' | 'SharesPublicationVenueWith' | 'SpeculatesOn' | 'Supports' | 'Updates' | 'UsesConclusionsFrom' | 'UsesDataFrom' | 'UsesMethodIn';
/**
* The mode of a `Cite`.
*/
type CitationMode = 'Parenthetical' | 'Narrative' | 'NarrativeAuthor';
/**
* A reference to a `CreativeWork` that is cited in another `CreativeWork`.
*/
declare class Cite extends Entity {
type: "Cite";
/**
* The target of the citation (URL or reference ID).
*/
target: string;
/**
* Determines how the citation is shown within the surrounding text.
*/
citationMode: CitationMode;
/**
* The type/s of the citation, both factually and rhetorically.
*/
citationIntent?: CitationIntent[];
/**
* Optional structured content/text of this citation.
*/
content?: Inline[];
/**
* The page on which the work starts; for example "135" or "xiii".
*/
pageStart?: IntegerOrString;
/**
* The page on which the work ends; for example "138" or "xvi".
*/
pageEnd?: IntegerOrString;
/**
* Any description of pages that is not separated into pageStart and pageEnd; for example, "1-6, 9, 55".
*/
pagination?: string;
/**
* Text to show before the citation.
*/
citationPrefix?: string;
/**
* Text to show after the citation.
*/
citationSuffix?: string;
constructor(target: string, citationMode: CitationMode, options?: Partial<Cite>);
}
/**
* Create a new `Cite`
*/
declare function cite(target: string, citationMode: CitationMode, options?: Partial<Cite>): Cite;
/**
* A group of `Cite` nodes.
*/
declare class CiteGroup extends Entity {
type: "CiteGroup";
/**
* One or more `Cite`s to be referenced in the same surrounding text.
*/
items: Cite[];
constructor(items: Cite[], options?: Partial<CiteGroup>);
}
/**
* Create a new `CiteGroup`
*/
declare function citeGroup(items: Cite[], options?: Partial<CiteGroup>): CiteGroup;
/**
* The type of a `Claim`.
*/
type ClaimType = 'Statement' | 'Theorem' | 'Lemma' | 'Proof' | 'Postulate' | 'Hypothesis' | 'Proposition' | 'Corollary';
/**
* A claim represents specific reviewable facts or statements.
*/
declare class Claim extends CreativeWork {
type: "Claim";
/**
* The type of the claim.
*/
claimType: ClaimType;
/**
* A short label for the claim.
*/
label?: string;
/**
* Content of the claim, usually a single paragraph.
*/
content: Block[];
constructor(claimType: ClaimType, content: Block[], options?: Partial<Claim>);
}
/**
* Create a new `Claim`
*/
declare function claim(claimType: ClaimType, content: Block[], options?: Partial<Claim>): Claim;
/**
* Abstract base type for non-executable code nodes (e.g. `CodeBlock`).
*/
declare class CodeStatic extends Entity {
type: "CodeStatic";
/**
* The code.
*/
code: Cord;
/**
* The programming language of the code.
*/
programmingLanguage?: string;
/**
* The authors of the code.
*/
authors?: Author[];
constructor(code: Cord, options?: Partial<CodeStatic>);
}
/**
* Create a new `CodeStatic`
*/
declare function codeStatic(code: Cord, options?: Partial<CodeStatic>): CodeStatic;
/**
* A code block.
*/
declare class CodeBlock extends CodeStatic {
type: "CodeBlock";
constructor(code: Cord, options?: Partial<CodeBlock>);
}
/**
* Create a new `CodeBlock`
*/
declare function codeBlock(code: Cord, options?: Partial<CodeBlock>): CodeBlock;
/**
* An executable programming code expression.
*/
declare class CodeExpression extends CodeExecutable {
type: "CodeExpression";
/**
* The value of the expression when it was last evaluated.
*/
output?: Node;
constructor(code: Cord, options?: Partial<CodeExpression>);
}
/**
* Create a new `CodeExpression`
*/
declare function codeExpression(code: Cord, options?: Partial<CodeExpression>): CodeExpression;
/**
* Inline code.
*/
declare class CodeInline extends CodeStatic {
type: "CodeInline";
constructor(code: Cord, options?: Partial<CodeInline>);
}
/**
* Create a new `CodeInline`
*/
declare function codeInline(code: Cord, options?: Partial<CodeInline>): CodeInline;
/**
* A comment on an item, e.g on a `Article` or `SoftwareSourceCode`.
*/
declare class Comment extends CreativeWork {
type: "Comment";
/**
* Content of the comment, usually one or more paragraphs.
*/
content: Block[];
/**
* The parent comment of this comment.
*/
parentItem?: Comment;
/**
* The part or facet of the item that is being commented on.
*/
commentAspect?: string;
constructor(content: Block[], options?: Partial<Comment>);
}
/**
* Create a new `Comment`
*/
declare function comment(content: Block[], options?: Partial<Comment>): Comment;
/**
* A column of data within a `Datatable`.
*/
declare class DatatableColumn extends Entity {
type: "DatatableColumn";
/**
* The name of the column.
*/
name: string;
/**
* The data values of the column.
*/
values: Primitive[];
/**
* The validator to use to validate data in the column.
*/
validator?: ArrayValidator;
constructor(name: string, values: Primitive[], options?: Partial<DatatableColumn>);
}
/**
* Create a new `DatatableColumn`
*/
declare function datatableColumn(name: string, values: Primitive[], options?: Partial<DatatableColumn>): DatatableColumn;
/**
* A table of data.
*/
declare class Datatable extends CreativeWork {
type: "Datatable";
/**
* The columns of data.
*/
columns: DatatableColumn[];
constructor(columns: DatatableColumn[], options?: Partial<Datatable>);
}
/**
* Create a new `Datatable`
*/
declare function datatable(columns: DatatableColumn[], options?: Partial<Datatable>): Datatable;
/**
* Encapsulates one or more images, videos, tables, etc, and provides captions and labels for them.
*/
declare class Figure extends CreativeWork {
type: "Figure";
/**
* The content of the figure.
*/
content: Block[];
/**
* A short label for the figure.
*/
label?: string;
/**
* A caption for the figure.
*/
caption?: Block[];
constructor(content: Block[], options?: Partial<Figure>);
}
/**
* Create a new `Figure`
*/
declare function figure(content: Block[], options?: Partial<Figure>): Figure;
/**
* A periodical publication.
*/
declare class Periodical extends CreativeWork {
type: "Periodical";
/**
* The date this Periodical was first published.
*/
dateStart?: Date;
/**
* The date this Periodical ceased publication.
*/
dateEnd?: Date;
/**
* The International Standard Serial Number(s) (ISSN) that identifies this serial publication.
*/
issns?: string[];
constructor(options?: Partial<Periodical>);
}
/**
* Create a new `Periodical`
*/
declare function periodical(options?: Partial<Periodical>): Periodical;
/**
* A part of a successively published publication such as a periodical or publication volume, often numbered.
*/
declare class PublicationIssue extends CreativeWork {
type: "PublicationIssue";
/**
* Identifies the issue of publication; for example, "iii" or "2".
*/
issueNumber?: IntegerOrString;
/**
* The page on which the issue starts; for example "135" or "xiii".
*/
pageStart?: IntegerOrString;
/**
* The page on which the issue ends; for example "138" or "xvi".
*/
pageEnd?: IntegerOrString;
/**
* Any description of pages that is not separated into pageStart and pageEnd; for example, "1-6, 9, 55".
*/
pagination?: string;
constructor(options?: Partial<PublicationIssue>);
}
/**
* Create a new `PublicationIssue`
*/
declare function publicationIssue(options?: Partial<PublicationIssue>): PublicationIssue;
/**
* A part of a successively published publication such as a periodical or multi-volume work.
*/
declare class PublicationVolume extends CreativeWork {
type: "PublicationVolume";
/**
* The page on which the volume starts; for example "135" or "xiii".
*/
pageStart?: IntegerOrString;
/**
* The page on which the volume ends; for example "138" or "xvi".
*/
pageEnd?: IntegerOrString;
/**
* Any description of pages that is not separated into pageStart and pageEnd; for example, "1-6, 9, 55".
*/
pagination?: string;
/**
* Identifies the volume of publication or multi-part work; for example, "iii" or "2".
*/
volumeNumber?: IntegerOrString;
constructor(options?: Partial<PublicationVolume>);
}
/**
* Create a new `PublicationVolume`
*/
declare function publicationVolume(options?: Partial<PublicationVolume>): PublicationVolume;
/**
* A property-value pair.
*/
declare class PropertyValue extends Thing {
type: "PropertyValue";
/**
* A commonly used identifier for the characteristic represented by the property.
*/
propertyID?: string;
/**
* The value of the property.
*/
value: Primitive;
constructor(value: Primitive, options?: Partial<PropertyValue>);
}
/**
* Create a new `PropertyValue`
*/
declare function propertyValue(value: Primitive, options?: Partial<PropertyValue>): PropertyValue;
/**
* `PropertyValue` or `string`
*/
type PropertyValueOrString = PropertyValue | string;
/**
* Create a `PropertyValueOrString` from an object
*/
declare function propertyValueOrString(other: PropertyValueOrString): PropertyValueOrString;
/**
* Textual content.
*/
declare class Text extends Entity {
type: "Text";
/**
* The value of the text content
*/
value: Cord;
constructor(value: Cord, options?: Partial<Text>);
}
/**
* Create a new `Text`
*/
declare function text(value: Cord, options?: Partial<Text>): Text;
/**
* The most generic type of item.
*/
declare class Thing extends Entity {
type: "Thing";
/**
* Alternate names (aliases) for the item.
*/
alternateNames?: string[];
/**
* A description of the item.
*/
description?: Text;
/**
* Any kind of identifier for any kind of Thing.
*/
identifiers?: PropertyValueOrString[];
/**
* Images of the item.
*/
images?: ImageObject[];
/**
* The name of the item.
*/
name?: string;
/**
* The URL of the item.
*/
url?: string;
constructor(options?: Partial<Thing>);
}
/**
* Create a new `Thing`
*/
declare function thing(options?: Partial<Thing>): Thing;
/**
* A review of an item, e.g of an `Article` or `SoftwareApplication`.
*/
declare class Review extends CreativeWork {
type: "Review";
/**
* The item that is being reviewed.
*/
itemReviewed?: Thing;
/**
* The part or facet of the item that is being reviewed.
*/
reviewAspect?: string;
constructor(options?: Partial<Review>);
}
/**
* Create a new `Review`
*/
declare function review(options?: Partial<Review>): Review;
/**
* A software application.
*/
declare class SoftwareApplication extends CreativeWork {
type: "SoftwareApplication";
/**
* The name of the item.
*/
name: string;
/**
* Requirements for application, including shared libraries that are not included in the application distribution.
*/
softwareRequirements?: SoftwareApplication[];
/**
* Version of the software.
*/
softwareVersion?: string;
/**
* Operating systems supported (e.g. Windows 7, OS X 10.6).
*/
operatingSystem?: string;
constructor(name: string, options?: Partial<SoftwareApplication>);
}
/**
* Create a new `SoftwareApplication`
*/
declare function softwareApplication(name: string, options?: Partial<SoftwareApplication>): SoftwareApplication;
/**
* `SoftwareSourceCode` or `SoftwareApplication` or `string`
*/
type SoftwareSourceCodeOrSoftwareApplicationOrString = SoftwareSourceCode | SoftwareApplication | string;
/**
* Create a `SoftwareSourceCodeOrSoftwareApplicationOrString` from an object
*/
declare function softwareSourceCodeOrSoftwareApplicationOrString(other: SoftwareSourceCodeOrSoftwareApplicationOrString): SoftwareSourceCodeOrSoftwareApplicationOrString;
/**
* Computer programming source code. Example: Full (compile ready) solutions, code snippet samples, scripts, templates.
*/
declare class SoftwareSourceCode extends CreativeWork {
type: "SoftwareSourceCode";
/**
* The name of the item.
*/
name: string;
/**
* The computer programming language.
*/
programmingLanguage: string;
/**
* Link to the repository where the un-compiled, human readable code and related code is located.
*/
codeRepository?: string;
/**
* What type of code sample: full (compile ready) solution, code snippet, inline code, scripts, template.
*/
codeSampleType?: string;
/**
* Runtime platform or script interpreter dependencies (Example - Java v1, Python2.3, .Net Framework 3.0).
*/
runtimePlatform?: string[];
/**
* Dependency requirements for the software.
*/
softwareRequirements?: SoftwareSourceCodeOrSoftwareApplicationOrString[];
/**
* Target operating system or product to which the code applies.
*/
targetProducts?: SoftwareApplication[];
constructor(name: string, programmingLanguage: string, options?: Partial<SoftwareSourceCode>);
}
/**
* Create a new `SoftwareSourceCode`
*/
declare function softwareSourceCode(name: string, programmingLanguage: string, options?: Partial<SoftwareSourceCode>): SoftwareSourceCode;
/**
* Indicates whether the cell is a header or data.
*/
type TableCellType = 'DataCell' | 'HeaderCell';
/**
* A cell within a `Table`.
*/
declare class TableCell extends Entity {
type: "TableCell";
/**
* The type of cell.
*/
cellType?: TableCellType;
/**
* The name of the cell.
*/
name?: string;
/**
* How many columns the cell extends.
*/
columnSpan?: Integer;
/**
* How many columns the cell extends.
*/
rowSpan?: Integer;
/**
* Contents of the table cell.
*/
content: Block[];
constructor(content: Block[], options?: Partial<TableCell>);
}
/**
* Create a new `TableCell`
*/
declare function tableCell(content: Block[], options?: Partial<TableCell>): TableCell;
/**
* Indicates whether the row is in the header, body or footer of the table.
*/
type TableRowType = 'HeaderRow' | 'BodyRow' | 'FooterRow';
/**
* A row within a Table.
*/
declare class TableRow extends Entity {
type: "TableRow";
/**
* An array of cells in the row.
*/
cells: TableCell[];
/**
* The type of row.
*/
rowType?: TableRowType;
constructor(cells: TableCell[], options?: Partial<TableRow>);
}
/**
* Create a new `TableRow`
*/
declare function tableRow(cells: TableCell[], options?: Partial<TableRow>): TableRow;
/**
* A table.
*/
declare class Table extends CreativeWork {
type: "Table";
/**
* A short label for the table.
*/
label?: string;
/**
* A caption for the table.
*/
caption?: Block[];
/**
* Rows of cells in the table.
*/
rows: TableRow[];
/**
* Notes for the table.
*/
notes?: Block[];
constructor(rows: TableRow[], options?: Partial<Table>);
}
/**
* Create a new `Table`
*/
declare function table(rows: TableRow[], options?: Partial<Table>): Table;
/**
* A video file.
*/
declare class VideoObject extends MediaObject {
type: "VideoObject";
/**
* The caption for this video recording.
*/
caption?: Inline[];
/**
* Thumbnail image of this video recording.
*/
thumbnail?: ImageObject;
/**
* The transcript of this video recording.
*/
transcript?: string;
constructor(contentUrl: string, options?: Partial<VideoObject>);
}
/**
* Create a new `VideoObject`
*/
declare function videoObject(contentUrl: string, options?: Partial<VideoObject>): VideoObject;
/**
* Union type for all types that are descended from `CreativeWork`
*/
type CreativeWorkType = Article | AudioObject | Claim | Collection | Comment | Datatable | Figure | ImageObject | MediaObject | Periodical | PublicationIssue | PublicationVolume | Review | SoftwareApplication | SoftwareSourceCode | Table | VideoObject;
/**
* Create a `CreativeWorkType` from an object
*/
declare function creativeWorkType(other: CreativeWorkType): CreativeWorkType;
/**
* A collection of CreativeWorks or other artifacts.
*/
declare class Collection extends CreativeWork {
type: "Collection";
/**
* Elements of the collection which can be a variety of different elements, such as Articles, Datatables, Tables and more.
*/
parts: CreativeWorkType[];
constructor(parts: CreativeWorkType[], options?: Partial<Collection>);
}
/**
* Create a new `Collection`
*/
declare function collection(parts: CreativeWorkType[], options?: Partial<Collection>): Collection;
/**
* A contact point, usually within an organization.
*/
declare class ContactPoint extends Thing {
type: "ContactPoint";
/**
* Email address for correspondence.
*/
emails?: string[];
/**
* Telephone numbers for the contact point.
*/
telephoneNumbers?: string[];
/**
* Languages (human not programming) in which it is possible to communicate with the organization/department etc.
*/
availableLanguages?: string[];
constructor(options?: Partial<ContactPoint>);
}
/**
* Create a new `ContactPoint`
*/
declare function contactPoint(options?: Partial<ContactPoint>): ContactPoint;
/**
* A hint to the type and values in a `DatatableColumn`.
*/
declare class DatatableColumnHint extends Entity {
type: "DatatableColumnHint";
/**
* The name of the column.
*/
name: string;
/**
* The type of items in the column.
*/
itemType: string;
/**
* The minimum value in the column.
*/
minimum?: Primitive;
/**
* The maximum value in the column.
*/
maximum?: Primitive;
/**
* The number of `Null` values in the column.
*/
nulls?: Integer;
constructor(name: string, itemType: string, options?: Partial<DatatableColumnHint>);
}
/**
* Create a new `DatatableColumnHint`
*/
declare function datatableColumnHint(name: string, itemType: string, options?: Partial<DatatableColumnHint>): DatatableColumnHint;
/**
* A hint to the structure of a table of data.
*/
declare class DatatableHint extends Entity {
type: "DatatableHint";
/**
* The number of rows of data.
*/
rows: Integer;
/**
* A hint for each column of data.
*/
columns: DatatableColumnHint[];
constructor(rows: Integer, columns: DatatableColumnHint[], options?: Partial<DatatableHint>);
}
/**
* Create a new `DatatableHint`
*/
declare function datatableHint(rows: Integer, columns: DatatableColumnHint[], options?: Partial<DatatableHint>): DatatableHint;
/**
* A word, name, acronym, phrase, etc. with a formal definition.
*/
declare class DefinedTerm extends Thing {
type: "DefinedTerm";
/**
* The name of the item.
*/
name: string;
/**
* A code that identifies this DefinedTerm within a DefinedTermSet
*/
termCode?: string;
constructor(name: string, options?: Partial<DefinedTerm>);
}
/**
* Create a new `DefinedTerm`
*/
declare function definedTerm(name: string, options?: Partial<DefinedTerm>): DefinedTerm;
/**
* Abstract base type for nodes that indicate a suggested change to content.
*/
declare class Suggestion extends Entity {
type: "Suggestion";
constructor(options?: Partial<Suggestion>);
}
/**
* Create a new `Suggestion`
*/
declare function suggestion(options?: Partial<Suggestion>): Suggestion;
/**
* Abstract base type for nodes that indicate a suggested change to block content.
*/
declare class SuggestionBlock extends Suggestion {
type: "SuggestionBlock";
/**
* The content that is suggested to be inserted, modified, replaced, or deleted.
*/
content: Block[];
constructor(content: Block[], options?: Partial<SuggestionBlock>);
}
/**
* Create a new `SuggestionBlock`
*/
declare function suggestionBlock(content: Block[], options?: Partial<SuggestionBlock>): SuggestionBlock;
/**
* A suggestion to delete some block content.
*/
declare class DeleteBlock extends SuggestionBlock {
type: "DeleteBlock";
constructor(content: Block[], options?: Partial<DeleteBlock>);
}
/**
* Create a new `DeleteBlock`
*/
declare function deleteBlock(content: Block[], options?: Partial<DeleteBlock>): DeleteBlock;
/**
* Abstract base type for nodes that indicate a suggested change to inline content.
*/
declare class SuggestionInline extends Suggestion {
type: "SuggestionInline";
/**
* The content that is suggested to be inserted, modified, replaced, or deleted.
*/
content: Inline[];
constructor(content: Inline[], options?: Partial<SuggestionInline>);
}
/**
* Create a new `SuggestionInline`
*/
declare function suggestionInline(content: Inline[], options?: Partial<SuggestionInline>): SuggestionInline;
/**
* A suggestion to delete some inline content.
*/
declare class DeleteInline extends SuggestionInline {
type: "DeleteInline";
constructor(content: Inline[], options?: Partial<DeleteInline>);
}
/**
* Create a new `DeleteInline`
*/
declare function deleteInline(content: Inline[], options?: Partial<DeleteInline>): DeleteInline;
/**
* A file on the file system.
*/
declare class File extends Entity {
type: "File";
/**
* The name of the file.
*/
name: string;
/**
* The path (absolute or relative) of the file on the file system
*/
path: string;
/**
* IANA media type (MIME type).
*/
mediaType?: string;
constructor(name: string, path: string, options?: Partial<File>);
}
/**
* Create a new `File`
*/
declare function file(name: string, path: string, options?: Partial<File>): File;
/**
* `File` or `Directory`
*/
type FileOrDirectory = File | Directory;
/**
* Create a `FileOrDirectory` from an object
*/
declare function fileOrDirectory(other: FileOrDirectory): FileOrDirectory;
/**
* A directory on the file system.
*/
declare class Directory extends Entity {
type: "Directory";
/**
* The name of the directory.
*/
name: string;
/**
* The path (absolute or relative) of the file on the file system.
*/
path: string;
/**
* The files and other directories within this directory.
*/
parts: FileOrDirectory[];
constructor(name: string, path: string, parts: FileOrDirectory[], options?: Partial<Directory>);
}
/**
* Create a new `Directory`
*/
declare function directory(name: string, path: string, parts: FileOrDirectory[], options?: Partial<Directory>): Directory;
/**
* Abstract base class for nodes that mark some other inline content in some way (e.g. as being emphasised, or quoted).
*/
declare class Mark extends Entity {
type: "Mark";
/**
* The content that is marked.
*/
content: Inline[];
constructor(content: Inline[], options?: Partial<Mark>);
}
/**
* Create a new `Mark`
*/
declare function mark(content: Inline[], options?: Partial<Mark>): Mark;
/**
* Emphasized content.
*/
declare class Emphasis extends Mark {
type: "Emphasis";
constructor(content: Inline[], options?: Partial<Emphasis>);
}
/**
* Create a new `Emphasis`
*/
declare function emphasis(content: Inline[], options?: Partial<Emphasis>): Emphasis;
/**
* Lists or enumerations, for example, a list of cuisines or music genres, etc.
*/
declare class Enumeration extends Thing {
type: "Enumeration";
constructor(options?: Partial<Enumeration>);
}
/**
* Create a new `Enumeration`
*/
declare function enumeration(options?: Partial<Enumeration>): Enumeration;
/**
* A function with a name, which might take Parameters and return a value of a certain type.
*/
declare class Function extends Entity {
type: "Function";
/**
* The name of the function.
*/
name: string;
/**
* The parameters of the function.
*/
parameters: Parameter[];
/**
* The return type of the function.
*/
returns?: Validator;
constructor(name: string, parameters: Parameter[], options?: Partial<Function>);
}
/**
* Create a new `Function`
*/
declare function function_(name: string, parameters: Parameter[], options?: Partial<Function>): Function;
/**
* A hint to the structure of an `Object`.
*/
declare class ObjectHint extends Entity {
type: "ObjectHint";
/**
* The number of entries in the object.
*/
length: Integer;
/**
* The keys of the object's entries.
*/
keys: string[];
/**
* Hints to the values of the object's entries.
*/
values: Hint[];
constructor(length: Integer, keys: string[], values: Hint[], options?: Partial<ObjectHint>);
}
/**
* Create a new `ObjectHint`
*/
declare function objectHint(length: Integer, keys: string[], values: Hint[], options?: Partial<ObjectHint>): ObjectHint;
/**
* A hint to the structure of an `String`.
*/
declare class StringHint extends Entity {
type: "StringHint";
/**
* The number of characters in the string.
*/
chars: Integer;
constructor(chars: Integer, options?: Partial<StringHint>);
}
/**
* Create a new `StringHint`
*/
declare function stringHint(chars: Integer, options?: Partial<StringHint>): StringHint;
/**
* A type to indicate a value or or other type in unknown.
*/
declare class Unknown extends Entity {
type: "Unknown";
constructor(options?: Partial<Unknown>);
}
/**
* Create a new `Unknown`
*/
declare function unknown(options?: Partial<Unknown>): Unknown;
/**
* Union type for hints of the value and/or structure of data.
*/
type Hint = ArrayHint | DatatableHint | Function | ObjectHint | StringHint | Unknown | boolean | Integer | number;
/**
* Create a `Hint` from an object
*/
declare function hint(other: Hint): Hint;
/**
* A variable representing a name / value pair.
*/
declare class Variable extends Entity {
type: "Variable";
/**
* The name of the variable.
*/
name: string;
/**
* The programming language that the variable is defined in e.g. Python, JSON.
*/
programmingLanguage?: string;
/**
* The native type of the variable e.g. `float`, `datetime.datetime`, `pandas.DataFrame`
*/
nativeType?: string;
/**
* The Stencila node type of the variable e.g. `Number`, `DateTime`, `Datatable`.
*/
nodeType?: string;
/**
* The value of the variable.
*/
value?: Node;
/**
* A hint of the value and/or structure of the variable.
*/
hint?: Hint;
constructor(name: string, options?: Partial<Variable>);
}
/**
* Create a new `Variable`
*/
declare function variable(name: string, options?: Partial<Variable>): Variable;
/**
* Node types that can be execution dependencies.
*/
type ExecutionDependencyNode = Button | CodeChunk | File | Parameter | SoftwareSourceCode | Variable;
/**
* Create a `ExecutionDependencyNode` from an object
*/
declare function executionDependencyNode(other: ExecutionDependencyNode): ExecutionDependencyNode;
/**
* The relation between a node and its execution dependency.
*/
type ExecutionDependencyRelation = 'Calls' | 'Derives' | 'Imports' | 'Includes' | 'Reads' | 'Uses';
/**
* An upstream execution dependency of a node.
*/
declare class ExecutionDependency extends Entity {
type: "ExecutionDependency";
/**
* The relation to the dependency.
*/
dependencyRelation: ExecutionDependencyRelation;
/**
* The node that is the dependency.
*/
dependencyNode: ExecutionDependencyNode;
/**
* The location that the dependency is defined.
*/
codeLocation?: CodeLocation;
constructor(dependencyRelation: ExecutionDependencyRelation, dependencyNode: ExecutionDependencyNode, options?: Partial<ExecutionDependency>);
}
/**
* Create a new `ExecutionDependency`
*/
declare function executionDependency(dependencyRelation: ExecutionDependencyRelation, dependencyNode: ExecutionDependencyNode, options?: Partial<ExecutionDependency>): ExecutionDependency;
/**
* An error, warning or log message generated during execution.
*/
declare class ExecutionMessage extends Entity {
type: "ExecutionMessage";
/**
* The severity level of the message.
*/
level: MessageLevel;
/**
* The text of the message.
*/
message: string;
/**
* The type of error e.g. "SyntaxError", "ZeroDivisionError".
*/
errorType?: string;
/**
* The location that the error occurred or other message emanated from.
*/
codeLocation?: CodeLocation;
/**
* Stack trace leading up to the error.
*/
stackTrace?: string;
constructor(level: MessageLevel, message: string, options?: Partial<ExecutionMessage>);
}
/**
* Create a new `ExecutionMessage`
*/
declare function executionMessage(level: MessageLevel, message: string, options?: Partial<ExecutionMessage>): ExecutionMessage;
/**
* A tag on code that affects its execution.
*/
declare class ExecutionTag extends Entity {
type: "ExecutionTag";
/**
* The name of the tag
*/
name: string;
/**
* The value of the tag
*/
value: string;
/**
* Whether the tag is global to the document
*/
isGlobal: boolean;
constructor(name: string, value: string, isGlobal: boolean, options?: Partial<ExecutionTag>);
}
/**
* Create a new `ExecutionTag`
*/
declare function executionTag(name: string, value: string, isGlobal: boolean, options?: Partial<ExecutionTag>): ExecutionTag;
/**
* The type of a `Section`.
*/
type SectionType = 'Main' | 'Header' | 'Footer' | 'Summary' | 'Introduction' | 'Methods' | 'Results' | 'Discussion' | 'Conclusion' | 'Iteration';
/**
* A section of a document.
*/
declare class Section extends Entity {
type: "Section";
/**
* The content within the section.
*/
content: Block[];
/**
* The type of section.
*/
sectionType?: SectionType;
constructor(content: Block[], options?: Partial<Section>);
}
/**
* Create a new `Section`
*/
declare function section(content: Block[], options?: Partial<Section>): Section;
/**
* Repeat a block content for each item in an array.
*/
declare class ForBlock extends CodeExecutable {
type: "ForBlock";
/**
* The name to give to the variable representing each item in the iterated array
*/
variable: string;
/**
* The content to repeat for each item
*/
content: Block[];
/**
* The content to render if there are no items
*/
otherwise?: Block[];
/**
* The content repeated for each iteration
*/
iterations?: Section[];
constructor(code: Cord, variable: string, content: Block[], options?: Partial<ForBlock>);
}
/**
* Create a new `ForBlock`
*/
declare function forBlock(code: Cord, variable: string, content: Block[], options?: Partial<ForBlock>): ForBlock;
/**
* Indicates the action (create, update or delete) to derive for a `Form`.
*/
type FormDeriveAction = 'Create' | 'Update' | 'Delete' | 'UpdateOrDelete';
/**
* A form to batch updates in document parameters.
*/
declare class Form extends Executable {
type: "Form";
/**
* The content within the form, usually containing at least one `Parameter`.
*/
content: Block[];
/**