Generate typescript types from json schema. (#3136)

This commit is contained in:
Sachin Chaurasiya 2022-03-04 14:08:49 +05:30 committed by GitHub
parent 834bb8e483
commit 9e68a03a05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 73 additions and 7 deletions

View File

@ -0,0 +1,35 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/*
* Copyright 2021 Collate
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This schema defines the type for reporting the count of threads related to an entity.
*/
export interface ThreadCount {
counts: EntityLinkThreadCount[];
/**
* Total count of all the threads.
*/
totalCount: number;
}
/**
* Type used to return thread count per entity link.
*/
export interface EntityLinkThreadCount {
/**
* Count of threads for the given entity link.
*/
count: number;
entityLink: string;
}

View File

@ -515,4 +515,5 @@ export enum Operation {
UpdateLineage = 'UpdateLineage', UpdateLineage = 'UpdateLineage',
UpdateOwner = 'UpdateOwner', UpdateOwner = 'UpdateOwner',
UpdateTags = 'UpdateTags', UpdateTags = 'UpdateTags',
UpdateTeam = 'UpdateTeam',
} }

View File

@ -17,26 +17,30 @@
*/ */
export interface CreateTeam { export interface CreateTeam {
/** /**
* Optional description of the team * Roles to be assigned to all users that are part of this team.
*/
defaultRoles?: string[];
/**
* Optional description of the team.
*/ */
description?: string; description?: string;
/** /**
* Optional name used for display purposes. Example 'Marketing Team' * Optional name used for display purposes. Example 'Marketing Team'.
*/ */
displayName?: string; displayName?: string;
name: string; name: string;
/** /**
* Optional team profile information * Optional team profile information.
*/ */
profile?: Profile; profile?: Profile;
/** /**
* Optional IDs of users that are part of the team * Optional IDs of users that are part of the team.
*/ */
users?: string[]; users?: string[];
} }
/** /**
* Optional team profile information * Optional team profile information.
* *
* This schema defines the type for a profile of a user, team, or organization. * This schema defines the type for a profile of a user, team, or organization.
*/ */

View File

@ -34,6 +34,10 @@ export interface Thread {
* User who created the thread. * User who created the thread.
*/ */
createdBy?: string; createdBy?: string;
/**
* Entity Id of the entity that the thread belongs to.
*/
entityId?: string;
/** /**
* Link to the resource corresponding to this entity. * Link to the resource corresponding to this entity.
*/ */
@ -42,7 +46,15 @@ export interface Thread {
* Unique identifier that identifies an entity instance. * Unique identifier that identifies an entity instance.
*/ */
id: string; id: string;
/**
* The main message of the thread in markdown format
*/
message?: string;
posts: Post[]; posts: Post[];
/**
* The total count of posts in the thread
*/
postsCount?: number;
/** /**
* When `true` indicates the thread has been resolved * When `true` indicates the thread has been resolved
*/ */

View File

@ -64,4 +64,5 @@ export enum Operation {
UpdateLineage = 'UpdateLineage', UpdateLineage = 'UpdateLineage',
UpdateOwner = 'UpdateOwner', UpdateOwner = 'UpdateOwner',
UpdateTags = 'UpdateTags', UpdateTags = 'UpdateTags',
UpdateTeam = 'UpdateTeam',
} }

View File

@ -624,4 +624,5 @@ export enum Operation {
UpdateLineage = 'UpdateLineage', UpdateLineage = 'UpdateLineage',
UpdateOwner = 'UpdateOwner', UpdateOwner = 'UpdateOwner',
UpdateTags = 'UpdateTags', UpdateTags = 'UpdateTags',
UpdateTeam = 'UpdateTeam',
} }

View File

@ -20,6 +20,10 @@ export interface Role {
* Change that lead to this version of the entity. * Change that lead to this version of the entity.
*/ */
changeDescription?: ChangeDescription; changeDescription?: ChangeDescription;
/**
* If `true`, this role is set as default and will be assigned to all users.
*/
default?: boolean;
/** /**
* When `true` indicates the entity has been soft deleted. * When `true` indicates the entity has been soft deleted.
*/ */
@ -42,6 +46,10 @@ export interface Role {
* Policy that is attached to this role. * Policy that is attached to this role.
*/ */
policy?: EntityReference; policy?: EntityReference;
/**
* Teams that have this role assigned.
*/
teams?: EntityReference[];
/** /**
* Last update time corresponding to the new version of the entity in Unix epoch time * Last update time corresponding to the new version of the entity in Unix epoch time
* milliseconds. * milliseconds.
@ -110,7 +118,7 @@ export interface FieldChange {
* example, a table has an attribute called database of type EntityReference that captures * example, a table has an attribute called database of type EntityReference that captures
* the relationship of a table `belongs to a` database. * the relationship of a table `belongs to a` database.
* *
* Users that have this role assigned. * Teams that have this role assigned.
*/ */
export interface EntityReference { export interface EntityReference {
/** /**

View File

@ -21,6 +21,10 @@ export interface Team {
* Change that lead to this version of the entity. * Change that lead to this version of the entity.
*/ */
changeDescription?: ChangeDescription; changeDescription?: ChangeDescription;
/**
* Roles to be assigned to all users that are part of this team.
*/
defaultRoles?: EntityReference[];
/** /**
* When `true` indicates the entity has been soft deleted. * When `true` indicates the entity has been soft deleted.
*/ */
@ -108,7 +112,7 @@ export interface FieldChange {
} }
/** /**
* List of entities owned by the team. * Roles to be assigned to all users that are part of this team.
* *
* This schema defines the EntityReference type used for referencing an entity. * This schema defines the EntityReference type used for referencing an entity.
* EntityReference is used for capturing relationships from one entity to another. For * EntityReference is used for capturing relationships from one entity to another. For