// // Copyright © 2020, 2021 Anticrm Platform Contributors. // Copyright © 2021 Hardcore Engineering Inc. // // Licensed under the Eclipse Public 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 https://www.eclipse.org/legal/epl-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. // import type { IntlString, Asset } from '@anticrm/platform' /** * @public */ export type Ref = string & { __ref: T } /** * @public */ export type PrimitiveType = number | string | boolean | undefined | Ref /** * @public */ export type Timestamp = number /** * @public */ export type Markup = string /** * @public */ export interface Obj { _class: Ref> } /** * @public */ export interface Doc extends Obj { _id: Ref space: Ref modifiedOn: Timestamp modifiedBy: Ref } /** * @public */ export type PropertyType = any /** * @public */ export interface UXObject extends Obj { label: IntlString icon?: Asset hidden?: boolean } /** * @public */ export interface AttachedDoc extends Doc { attachedTo: Ref attachedToClass: Ref> collection: string } /** * @public */ // eslint-disable-next-line @typescript-eslint/no-unused-vars export interface Type extends UXObject {} /** * @public */ export enum IndexKind { FullText, Indexed } /** * @public */ export interface Attribute extends Doc, UXObject { attributeOf: Ref> name: string type: Type index?: IndexKind } /** * @public */ export type AnyAttribute = Attribute> /** * @public */ export enum ClassifierKind { CLASS, INTERFACE, MIXIN } /** * @public */ export interface Classifier extends Doc, UXObject { kind: ClassifierKind } /** * @public */ export type Domain = string & { __domain: true } /** * @public */ // eslint-disable-next-line @typescript-eslint/no-unused-vars export interface Interface extends Classifier { extends?: Ref>[] } /** * @public */ // eslint-disable-next-line @typescript-eslint/no-unused-vars export interface Class extends Classifier { extends?: Ref> implements?: Ref>[] domain?: Domain shortLabel?: IntlString sortingKey?: string } /** * @public * Define a set of plugin to model document bindings. */ export interface PluginConfiguration extends Doc { pluginId: string transactions: Ref[] } /** * @public */ export type Mixin = Class // D A T A /** * @public */ export type Data = Omit /** * @public */ export type AttachedData = Omit // T Y P E S /** * @public */ export interface TypeDate extends Type { // If not set to true, will be false withTime?: boolean } /** * @public */ export interface RefTo extends Type>> { to: Ref> } /** * @public */ export interface Collection extends Type { of: Ref> itemLabel?: IntlString } /** * @public */ export type Bag = Record /** * @public */ export interface BagOf extends Type> { of: Type } /** * @public */ export type Arr = T[] /** * @public */ export interface ArrOf extends Type { of: Type } /** * @public */ export const DOMAIN_MODEL = 'model' as Domain /** * @public */ export const DOMAIN_TRANSIENT = 'transient' as Domain // S P A C E /** * @public */ export interface Space extends Doc { name: string description: string private: boolean members: Arr> archived: boolean } /** * @public */ export interface Account extends Doc { email: string } /** * @public */ export interface UserStatus extends Doc { online: boolean } /** * @public */ export interface Version extends Doc { major: number minor: number patch: number }