Merge pull request #2 from hcengineering/TypeIdentifier

Add TypeIdentifier
This commit is contained in:
Andrey Sobolev
2025-10-21 21:21:58 +07:00
committed by GitHub
5 changed files with 46 additions and 3 deletions
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@hcengineering/core",
"comment": "Add TypeIdentifier for custom attribute incremental IDs",
"type": "patch"
}
],
"packageName": "@hcengineering/core"
}
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@hcengineering/model",
"comment": "Add TypeIdentifier for custom attribute incremental IDs",
"type": "patch"
}
],
"packageName": "@hcengineering/model"
}
+11
View File
@@ -338,6 +338,13 @@ export interface TypeDate extends Type<Date> {
withShift: boolean
}
/**
* @public
*/
export interface TypeIdentifier extends Type<string> {
of: Ref<CustomSequence>
}
/**
* @public
*/
@@ -628,6 +635,10 @@ export interface Sequence extends Doc {
sequence: number
}
export interface CustomSequence extends Sequence {
prefix: string
}
/**
* @public
*/
+3
View File
@@ -49,6 +49,7 @@ import type {
Relation,
Role,
Sequence,
CustomSequence,
Space,
SpaceType,
SpaceTypeDescriptor,
@@ -145,6 +146,7 @@ export default plugin(coreId, {
TypeCollaborativeDoc: '' as Ref<Class<Type<MarkupBlobRef>>>,
TypePersonId: '' as Ref<Class<Type<string>>>,
TypeAccountUuid: '' as Ref<Class<Type<string>>>,
TypeIdentifier: '' as Ref<Class<Type<string>>>,
RefTo: '' as Ref<Class<RefTo<Doc>>>,
ArrOf: '' as Ref<Class<ArrOf<Doc>>>,
Enum: '' as Ref<Class<Enum>>,
@@ -169,6 +171,7 @@ export default plugin(coreId, {
Association: '' as Ref<Class<Association>>,
Relation: '' as Ref<Class<Relation>>,
Sequence: '' as Ref<Class<Sequence>>,
CustomSequence: '' as Ref<Class<CustomSequence>>,
ClassCollaborators: '' as Ref<Class<ClassCollaborators<Doc>>>,
Collaborator: '' as Ref<Class<Collaborator>>
},
+12 -3
View File
@@ -14,12 +14,13 @@
//
import core, {
type PersonId,
type AccountUuid,
type AttachedDoc,
type Attribute,
type Class,
type Classifier,
ClassifierKind,
CustomSequence,
type Data,
DateRangeMode,
type Doc,
@@ -35,6 +36,7 @@ import core, {
type MarkupBlobRef,
type MixinData,
type Obj,
type PersonId,
type PropertyType,
type Rank,
type Ref,
@@ -50,9 +52,9 @@ import core, {
type ArrOf as TypeArrOf,
type Collection as TypeCollection,
type TypeDate as TypeDateType,
type TypeIdentifier as TypeIdentifierType,
type TypeNumber as TypeNumberType,
generateId,
type AccountUuid
generateId
} from '@hcengineering/core'
import type { Asset, IntlString } from '@hcengineering/platform'
import toposort from 'toposort'
@@ -467,6 +469,13 @@ export function TypeRef (_class: Ref<Class<Doc>>): RefTo<Doc> {
return { _class: core.class.RefTo, label: core.string.Ref, icon: core.icon.TypeRef, to: _class }
}
/**
* @public
*/
export function TypeIdentifier (of: Ref<CustomSequence>): TypeIdentifierType {
return { _class: core.class.TypeIdentifier, label: core.string.Id, icon: core.icon.TypeRef, of }
}
/**
* @public
*/