@atlaskit/json-ld-types
Version:
A set of types for the Atlassian Object Vocabulary
533 lines (532 loc) • 26.2 kB
TypeScript
import type { Action as ActionSchema, AssignAction, CommentAction, DeleteAction, DownloadAction, ReplyAction, ShareAction, SubscribeAction, ViewAction, WatchAction } from 'schema-dts';
export declare namespace JsonLd {
namespace Primitives {
export type Access = 'granted' | 'forbidden' | 'unauthorized' | 'not_found';
export type Visibility = 'public' | 'restricted' | 'other' | 'not_found';
export type LeafType = 'Object' | 'Link' | 'Collection';
export type ObjectType = 'Collection' | 'Application' | 'Group' | 'Person' | 'Service' | 'Organization' | 'Relationship' | 'Object' | 'Article' | 'Document' | 'Audio' | 'Image' | 'Video' | 'Note' | 'Page' | 'Event' | 'Place' | 'Profile' | 'Tombstone' | 'schema:BlogPosting' | 'schema:TextDigitalDocument' | 'schema:DigitalDocument' | 'schema:PresentationDigitalDocument' | 'schema:SpreadsheetDigitalDocument' | 'schema:Message' | 'atlassian:Goal' | 'atlassian:Project' | 'atlassian:SourceCodeReference' | 'atlassian:SourceCodeRepository' | 'atlassian:SourceCodePullRequest' | 'atlassian:SourceCodeCommit' | 'atlassian:Task' | 'atlassian:UndefinedLink' | 'atlassian:Emoji' | 'atlassian:Schema' | 'atlassian:Type' | 'atlassian:Object';
export type LinkType = 'Mention';
export type CollectionType = 'Collection' | 'CollectionPage';
export type Type = ObjectType | LinkType | CollectionType | LeafType;
export type PotentialServerActionType = 'CreateAction' | 'ReadAction' | 'UpdateAction' | 'DeleteAction';
export interface AuthService {
displayName: string;
key: string;
url: string;
}
export type Property<T> = T | T[];
export type TypeProperty<ResourceType extends Type, ParentType extends Type = 'Object'> = ResourceType | Array<ParentType | ResourceType>;
export interface Context {
'@vocab': 'https://www.w3.org/ns/activitystreams#';
atlassian: 'https://schema.atlassian.com/ns/vocabulary#';
schema: 'http://schema.org/';
}
export interface PreviewExtension {
'atlassian:aspectRatio'?: number;
'atlassian:supportedPlatforms'?: Primitives.Platforms[];
interactiveHref?: string;
}
export interface CheckItemProgress {
checkedItems: number;
totalItems: number;
}
export interface SubTasksProgress {
resolvedCount: number;
totalCount: number;
}
export interface UserAttributes {
department?: string;
location?: string;
pronouns?: string;
role?: string;
}
export interface Object<T = any> {
'@id'?: string;
'@type': Property<'Object' | ObjectType>;
anyOf?: Array<Primitives.Object | Primitives.Link>;
attachment?: Property<Primitives.Object | Primitives.Link>;
attributedTo?: Property<(Primitives.Object | Primitives.Link) & {
actor?: Property<Primitives.Object | Primitives.Link>;
}>;
audience?: Property<Primitives.Object | Primitives.Link>;
bcc?: Property<Primitives.Object | Primitives.Link>;
bto?: Property<Primitives.Object | Primitives.Link>;
cc?: Property<Primitives.Object | Primitives.Link>;
closed?: Primitives.Object | Primitives.Link | string | boolean;
content?: string;
contentMap?: Record<string, string>;
context?: Primitives.Object | Primitives.Link;
duration?: string;
endTime?: string;
generator?: Primitives.Object | Primitives.Link;
icon?: Image | Primitives.Link;
image?: Image | Primitives.Link;
inReplyTo?: Property<Primitives.Object | Primitives.Link>;
location?: Property<Primitives.Object | Primitives.Link>;
mediaType?: string;
name?: string;
nameMap?: Record<string, string>;
oneOf?: Array<Primitives.Object | Primitives.Link>;
preview?: string | ((Primitives.LinkModel | Primitives.Object) & PreviewExtension);
published?: string;
replies?: Collection<T>;
startTime?: string;
summary?: string;
summaryMap?: Record<string, string>;
tag?: Property<Primitives.Object | Primitives.Link>;
teamMemberCount?: number;
to?: Property<Primitives.Object | Primitives.Link>;
updated?: string;
url?: Property<string | Primitives.Link>;
userAttributes?: Primitives.UserAttributes;
}
export type Link = string | LinkModel;
export interface LinkModel {
'@type': 'Link';
height?: number;
href?: string;
hreflang?: string;
mediaType?: string;
name?: string;
nameMap?: Record<string, string>;
preview?: string | ((Primitives.LinkModel | Primitives.Object) & PreviewExtension);
rel?: Primitives.Link;
width?: number;
}
export interface Activity {
actor?: Primitives.Object | Primitives.Link;
instrument?: Property<Primitives.Object | Primitives.Link>;
object?: Primitives.Object | Primitives.Link;
origin?: Primitives.Object | Primitives.Link;
result?: Primitives.Object | Primitives.Link;
target?: Primitives.Object | Primitives.Link;
}
export type IntransitiveActivity = Omit<Activity, 'object'>;
export interface Collection<T> {
current?: CollectionPage<T> | Primitives.Link;
first?: CollectionPage<T> | Primitives.Link;
items?: Primitives.Object | Primitives.Link | Array<Primitives.Object | Primitives.Link | T>;
last?: CollectionPage<T> | Primitives.Link;
totalItems?: number;
}
export type OrderedCollection<T> = Collection<T>;
export interface CollectionPage<T = any> extends Collection<T> {
next?: CollectionPage<T> | Primitives.Link;
partOf?: Primitives.Link | Collection<T>;
prev?: CollectionPage<T> | Primitives.Link;
}
export interface OrderedCollectionPage<T> extends CollectionPage<T> {
startIndex?: number;
}
export interface Application<T = any> extends Primitives.Object<T> {
'@type': TypeProperty<'Application'>;
}
export interface Group<T = any> extends Primitives.Object<T> {
'@type': TypeProperty<'Group'>;
}
export interface Organization<T = any> extends Primitives.Object<T> {
'@type': TypeProperty<'Organization'>;
}
export interface Person<T = any> extends Primitives.Object<T> {
'@type': TypeProperty<'Person'>;
'atlassian:displayName'?: string;
'atlassian:emails'?: Array<{
primary?: boolean;
value: string;
}>;
'atlassian:extendedProfile'?: Record<string, any>;
'atlassian:externalId'?: string;
'atlassian:name'?: {
familyName?: string;
formatted?: string;
givenName?: string;
};
'atlassian:nickname'?: string;
'atlassian:photos'?: Array<{
type?: 'photo' | 'thumbnail';
value?: string;
}>;
'atlassian:userName'?: string;
}
export interface Service<T = any> extends Primitives.Object<T> {
'@type': TypeProperty<'Service'>;
}
export interface Relationship extends Primitives.Object {
'@type': TypeProperty<'Relationship'>;
object?: Primitives.Object | Primitives.Link;
relationship?: Primitives.Object;
subject?: Primitives.Link | Primitives.Object;
}
export interface Article extends Primitives.Object {
'@type': TypeProperty<'Article'>;
}
export interface Document extends Primitives.Object {
'@type': TypeProperty<'Document'>;
}
export interface Audio extends Primitives.Object {
'@type': TypeProperty<'Audio'>;
}
export interface Image extends Primitives.Object {
'@type': TypeProperty<'Image'>;
}
export interface Video extends Primitives.Object {
'@type': TypeProperty<'Video'>;
}
export interface Note extends Primitives.Object {
'@type': TypeProperty<'Note'>;
}
export interface Page extends Primitives.Object {
'@type': TypeProperty<'Page'>;
}
export interface Event extends Primitives.Object {
'@type': TypeProperty<'Event'>;
}
export interface Place extends Primitives.Object {
'@type': TypeProperty<'Place'>;
accuracy?: number;
altitude?: number;
latitude?: number;
longitude?: number;
radius?: number;
units?: 'cm' | 'feet' | 'inches' | 'km' | 'm' | 'miles' | string;
}
export type Mention = Primitives.Link & {
'@type': TypeProperty<'Mention', 'Link'>;
};
export interface Profile extends Primitives.Object {
'@type': TypeProperty<'Profile'>;
describes?: Primitives.Object;
}
export interface State extends Primitives.Object {
accent?: string;
appearance?: string;
}
export interface Tombstone extends Primitives.Object {
'@type': TypeProperty<'Tombstone'>;
deleted?: string;
formerType?: Primitives.Object;
}
export type AssignedObjectActions = AssignAction | SubscribeAction | ServerAction;
export interface AssignedObject {
'atlassian:assigned'?: string;
'atlassian:assignedBy'?: Primitives.Link | Person;
'atlassian:assignedTo'?: Primitives.Link | Person;
'atlassian:subscriber'?: Primitives.Link | Person;
'atlassian:subscriberCount'?: number;
}
export type PreviewAction = ActionSchema & {
'@type': 'PreviewAction';
};
/**
* Basic type of the Smart Link Action that describes the mandatory fields an action must contain
*/
type PotentialSmartLinkAction = ActionSchema & {
/**
* Type of the Potential Action, one of PotentialServerActionType
*/
'@type': PotentialServerActionType;
/**
* Name of the actual action, for example: 'StatusUpdateAction'
*/
name: string;
/**
* references a field in the response to which the action is associated with
* for eg. "tag" for jira issues
*/
refField?: string;
/**
* An object with key value to identify the resource.
* For e.g. for a jira issue link/resource, it could be hostname, and issueId
* The values can change for different action and resources hence the type is not strictly defined
*/
resourceIdentifiers?: Record<string, any>;
};
/**
* An action that represent a read of some resource(s).
* Example: 'GetStatusTransitions'
*/
export type ReadAction = PotentialSmartLinkAction & {
'@type': 'ReadAction';
};
/**
* An action that represent a creation of some resource(s).
*/
export type CreateAction = PotentialSmartLinkAction & {
'@type': 'CreateAction';
};
/**
* An action that represents an update of some resource.
* May contain embedded actions that signify how the data required to execute the action
* can be retrieved & updated
*/
export type UpdateAction = PotentialSmartLinkAction & {
'@type': 'UpdateAction';
dataRetrievalAction?: ReadAction;
dataUpdateAction?: UpdateAction;
};
export type AtlassianActionSchema = PreviewAction;
export type ClientAction = DownloadAction | ViewAction | AtlassianActionSchema;
export type ServerAction = AssignAction | CommentAction | DeleteAction | ReplyAction | ShareAction | SubscribeAction | WatchAction | CreateAction | ReadAction | UpdateAction;
export type Action = ServerAction | ClientAction;
export type Platforms = 'web' | 'mobile';
export {};
}
namespace Meta {
interface BaseMeta {
[k: string]: any;
access: Primitives.Access;
'atlassian:remoteLinkCategory'?: string;
auth?: Primitives.AuthService[];
category?: any;
containerId?: any;
follow?: boolean;
objectId?: any;
product?: any;
resourceType?: any;
subproduct?: any;
tenantId?: any;
visibility: Primitives.Visibility;
}
interface Public extends BaseMeta {
access: 'granted';
visibility: 'public';
}
interface Granted extends BaseMeta {
access: 'granted';
visibility: 'restricted';
}
interface Unauthorized extends BaseMeta {
access: 'unauthorized';
visibility: 'restricted';
}
interface PermissionDenied extends BaseMeta {
access: 'forbidden';
visibility: 'restricted';
}
interface NotFound extends BaseMeta {
access: 'forbidden';
visibility: 'not_found';
}
}
namespace Data {
interface BaseData extends Primitives.Object {
'@context': Primitives.Context;
'@type': Primitives.Property<Primitives.ObjectType>;
/**
* The Atlassian Resource Identifier (ARI) of the object
*/
'atlassian:ari'?: string;
'atlassian:createdBy'?: Primitives.Link | Primitives.Person | Primitives.Collection<Primitives.Link | Primitives.Person>;
'atlassian:downloadUrl'?: string;
'atlassian:ownedBy'?: Primitives.Person;
/**
* Added because schema:potentialAction could not be used by the new action implementation
* https://product-fabric.atlassian.net/wiki/spaces/EM/pages/3531374887/Alternatives+for+using+potentialActions+property
* https://team.atlassian.com/project/ATLAS-13099
*/
'atlassian:serverAction'?: Primitives.Property<Primitives.ServerAction>;
'atlassian:titlePrefix'?: TitlePrefix;
'atlassian:updatedBy'?: Primitives.Link | Primitives.Person | Primitives.Collection<Primitives.Link | Primitives.Person>;
'atlassian:visitUrl'?: string;
'schema:dateCreated'?: string;
'schema:potentialAction'?: Primitives.Property<Primitives.Action>;
}
interface BaseCollectionData<T extends BaseData> extends Primitives.Collection<T> {
'@context': Primitives.Context;
'@type': Primitives.TypeProperty<Primitives.Type, 'Collection'>;
items: Omit<T, '@context'>[];
}
interface BaseCollectionPage<T> extends Primitives.CollectionPage<T> {
'@context': Primitives.Context;
'@type': Primitives.TypeProperty<Primitives.Type, 'CollectionPage'>;
}
interface TitlePrefix extends Primitives.Object {
'@type': Primitives.Property<Primitives.ObjectType>;
text: string;
}
type DocumentAction = DeleteAction | ViewAction | DownloadAction | ShareAction | CommentAction | WatchAction;
type DocumentParentType = 'Object' | 'Document';
type DocumentChildType = 'schema:BlogPosting' | 'schema:TextDigitalDocument' | 'schema:DigitalDocument' | 'schema:PresentationDigitalDocument' | 'schema:SpreadsheetDigitalDocument' | 'atlassian:UndefinedLink' | 'Collection';
interface Document extends BaseData {
'@type': Primitives.TypeProperty<'Document', 'Object'> | Primitives.TypeProperty<DocumentChildType, DocumentParentType> | Primitives.TypeProperty<'schema:DigitalDocument', 'Document'>;
'atlassian:attachmentCount'?: number;
'atlassian:checkItems'?: Primitives.CheckItemProgress;
'atlassian:dateViewed'?: string;
'atlassian:fileSize'?: number;
'atlassian:isDeleted'?: boolean;
'atlassian:reactCount'?: number;
'atlassian:readTimeInMinutes'?: number;
'atlassian:state'?: string | Primitives.State;
'atlassian:viewCount'?: number;
'atlassian:viewerCount'?: number;
'atlassian:voteCount'?: number;
'schema:commentCount'?: number;
'schema:fileFormat'?: string;
'schema:potentialAction'?: Primitives.Property<DocumentAction>;
version?: string;
}
interface BlogPostDocument extends Document {
'@type': Primitives.TypeProperty<'schema:BlogPosting', DocumentParentType>;
}
interface PresentationDocument extends Document {
'@type': Primitives.TypeProperty<'schema:PresentationDigitalDocument', DocumentParentType>;
}
interface SpreadSheetDocument extends Document {
'@type': Primitives.TypeProperty<'schema:SpreadsheetDigitalDocument', DocumentParentType>;
}
type Template = Document;
interface TextDocument extends Document {
'@type': Primitives.TypeProperty<'schema:TextDigitalDocument', DocumentParentType>;
}
type DocumentFolder = BaseCollectionData<Document>;
type DocumentFolderPaged = BaseCollectionPage<Document>;
interface Image extends BaseData, Primitives.Image {
'@type': 'Image';
}
type MessageAction = ReplyAction | DeleteAction | ViewAction;
interface Message extends BaseData {
'@type': Primitives.TypeProperty<'schema:Message'>;
'atlassian:reactCount'?: number;
dateRead?: string;
dateReceived?: string;
dateSent?: string;
'schema:potentialAction'?: Primitives.Property<MessageAction>;
}
type PageAction = ViewAction | DownloadAction | ShareAction | CommentAction | WatchAction;
interface Page extends Primitives.Page, BaseData {
'@type': Primitives.Page['@type'];
'schema:commentCount'?: number;
'schema:potentialAction'?: Primitives.Property<PageAction>;
}
interface UndefinedLinkDocument extends Document {
'@type': Primitives.TypeProperty<'atlassian:UndefinedLink', DocumentParentType>;
}
interface Goal extends BaseData {
'@type': Primitives.TypeProperty<'atlassian:Goal'>;
'atlassian:state'?: string | Primitives.State;
'atlassian:subscriber'?: Primitives.Link | Primitives.Person;
'atlassian:subscriberCount'?: number;
'schema:commentCount'?: number;
}
interface Object extends BaseData {
'@type': Primitives.TypeProperty<'atlassian:Object'>;
'schema:attachmentCount'?: number;
'schema:commentCount'?: number;
'schema:dateCreated'?: string;
}
interface Type extends BaseData {
'@type': Primitives.TypeProperty<'atlassian:Type'>;
'schema:dateCreated'?: string;
}
interface Schema extends BaseData {
'@type': Primitives.TypeProperty<'atlassian:Schema'>;
'schema:dateCreated'?: string;
}
interface Project extends BaseData {
'@type': Primitives.TypeProperty<'atlassian:Project'>;
'atlassian:appliedToComponentsCount'?: number;
'atlassian:attachmentCount'?: number;
'atlassian:checkItems'?: Primitives.CheckItemProgress;
'atlassian:isDeleted': boolean;
'atlassian:member': Primitives.Link | Primitives.Person | Primitives.Collection<Primitives.Person>;
'atlassian:reactCount'?: number;
'atlassian:state'?: string | Primitives.State;
'schema:commentCount'?: number;
}
interface SourceCodeDocument extends Document {
'atlassian:latestCommit'?: Partial<SourceCodeCommit> | Primitives.Link;
'schema:codeSampleType'?: string;
'schema:potentialAction'?: Primitives.Property<DocumentAction>;
'schema:programmingLanguage'?: string;
'schema:runtimePlatform'?: string;
'schema:targetProduct'?: string;
}
type SourceCodeCommitAction = DeleteAction | ViewAction | WatchAction;
interface SourceCodeCommit extends BaseData {
'@type': Primitives.TypeProperty<'atlassian:SourceCodeCommit'>;
'atlassian:committedBy': Primitives.Link | Primitives.Person;
'atlassian:parent'?: Primitives.Property<Primitives.Object | Primitives.Link>;
'schema:commentCount'?: number;
'schema:potentialAction'?: Primitives.Property<SourceCodeCommitAction>;
'schema:programmingLanguage'?: string;
}
type SourceCodePullRequestAction = DeleteAction | ViewAction | DownloadAction | WatchAction;
interface SourceCodePullRequest extends BaseData {
'@type': Primitives.TypeProperty<'atlassian:SourceCodePullRequest'>;
'atlassian:internalId'?: string;
'atlassian:isMerged': boolean;
'atlassian:mergeable'?: boolean;
'atlassian:mergeCommit'?: Partial<SourceCodeCommit> | Primitives.Link;
'atlassian:merged'?: string;
'atlassian:mergedBy'?: Primitives.Link | Primitives.Person;
'atlassian:mergeDestination'?: Partial<SourceCodeCommit> | Partial<SourceCodeReference> | Primitives.Link;
'atlassian:mergeSource'?: Partial<SourceCodeCommit> | Partial<SourceCodeReference> | Primitives.Link;
'atlassian:reviewedBy'?: Array<Primitives.Link | Primitives.Person>;
'atlassian:reviewer'?: Array<Primitives.Link | Primitives.Person>;
'atlassian:state': string | Primitives.Link | Primitives.State;
'atlassian:subscriberCount'?: number;
'atlassian:voteCount'?: number;
'schema:potentialAction'?: Primitives.Property<SourceCodePullRequestAction>;
'schema:programmingLanguage'?: string;
}
type SourceCodeReferenceAction = DownloadAction | DeleteAction | ViewAction;
interface SourceCodeReference extends BaseData {
'@type': Primitives.TypeProperty<'atlassian:SourceCodeReference'>;
'atlassian:commit': Partial<SourceCodeCommit> | Primitives.Link;
'schema:potentialAction'?: Primitives.Property<SourceCodeReferenceAction>;
'schema:programmingLanguage'?: string;
}
type SourceCodeRepositoryAction = DeleteAction | ViewAction | DownloadAction | WatchAction;
interface SourceCodeRepository extends BaseData {
'@type': Primitives.TypeProperty<'atlassian:SourceCodeRepository'>;
'atlassian:latestCommit'?: Partial<SourceCodeCommit> | Primitives.Link;
'atlassian:subscriber'?: Primitives.Link | Primitives.Person;
'atlassian:subscriberCount': number;
'atlassian:viewCount'?: number;
'atlassian:voteCount'?: number;
'schema:potentialAction'?: Primitives.Property<SourceCodeRepositoryAction>;
'schema:programmingLanguage'?: string;
}
type TaskAction = Primitives.AssignedObjectActions;
interface Task extends BaseData, Primitives.AssignedObject {
'@type': Primitives.TypeProperty<'atlassian:Task'>;
'atlassian:attachmentCount'?: number;
'atlassian:checkItems'?: Primitives.CheckItemProgress;
'atlassian:completed'?: string;
'atlassian:isCompleted'?: boolean;
'atlassian:isDeleted'?: boolean;
'atlassian:originalEstimateInSeconds'?: number;
'atlassian:priority'?: string | Primitives.Object;
'atlassian:reactCount'?: number;
'atlassian:storyPoints'?: number;
'atlassian:subTasks'?: Primitives.SubTasksProgress;
'atlassian:taskStatus'?: Primitives.Object;
'atlassian:taskType'?: TaskType | Primitives.Object | Primitives.Link;
'atlassian:viewCount'?: number;
'atlassian:voteCount'?: number;
'schema:commentCount'?: number;
'schema:potentialAction'?: Primitives.Property<TaskAction>;
}
type TaskTypeAction = Primitives.AssignedObjectActions;
interface TaskType extends BaseData, Primitives.AssignedObject {
'@type': Primitives.TypeProperty<'atlassian:Task'>;
'atlassian:attachmentCount'?: number;
'atlassian:checkItems'?: Primitives.CheckItemProgress;
'schema:commentCount'?: number;
'schema:dateCreated': string;
'schema:potentialAction'?: Primitives.Property<TaskTypeAction>;
}
}
interface Response<T extends Data.BaseData = Data.BaseData> {
data: Data.BaseData | Data.BaseCollectionData<T> | Data.BaseCollectionPage<T> | undefined;
meta: Meta.BaseMeta;
}
interface Object<MetaType extends Meta.BaseMeta, DataType extends Data.BaseData> {
data: DataType | undefined;
meta: MetaType;
}
interface Collection<MetaType extends Meta.BaseMeta = Meta.BaseMeta, ResourceType extends Data.BaseData = Data.BaseData, DataType = Data.BaseCollectionData<ResourceType>> {
data: DataType | undefined;
meta: MetaType;
}
}