diff --git a/common/changes/@hcengineering/core/TypeIdentifier_2025-10-21-13-31.json b/common/changes/@hcengineering/core/TypeIdentifier_2025-10-21-13-31.json new file mode 100644 index 0000000000..8a36048ffe --- /dev/null +++ b/common/changes/@hcengineering/core/TypeIdentifier_2025-10-21-13-31.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@hcengineering/core", + "comment": "Add TypeIdentifier for custom attribute incremental IDs", + "type": "patch" + } + ], + "packageName": "@hcengineering/core" +} \ No newline at end of file diff --git a/common/changes/@hcengineering/model/TypeIdentifier_2025-10-21-13-31.json b/common/changes/@hcengineering/model/TypeIdentifier_2025-10-21-13-31.json new file mode 100644 index 0000000000..6b6d7a5603 --- /dev/null +++ b/common/changes/@hcengineering/model/TypeIdentifier_2025-10-21-13-31.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@hcengineering/model", + "comment": "Add TypeIdentifier for custom attribute incremental IDs", + "type": "patch" + } + ], + "packageName": "@hcengineering/model" +} \ No newline at end of file diff --git a/packages/core/src/classes.ts b/packages/core/src/classes.ts index 9299e0171a..42c72413f2 100644 --- a/packages/core/src/classes.ts +++ b/packages/core/src/classes.ts @@ -338,6 +338,13 @@ export interface TypeDate extends Type { withShift: boolean } +/** + * @public + */ +export interface TypeIdentifier extends Type { + of: Ref +} + /** * @public */ @@ -628,6 +635,10 @@ export interface Sequence extends Doc { sequence: number } +export interface CustomSequence extends Sequence { + prefix: string +} + /** * @public */ diff --git a/packages/core/src/component.ts b/packages/core/src/component.ts index b61451663b..441c27ed75 100644 --- a/packages/core/src/component.ts +++ b/packages/core/src/component.ts @@ -49,6 +49,7 @@ import type { Relation, Role, Sequence, + CustomSequence, Space, SpaceType, SpaceTypeDescriptor, @@ -145,6 +146,7 @@ export default plugin(coreId, { TypeCollaborativeDoc: '' as Ref>>, TypePersonId: '' as Ref>>, TypeAccountUuid: '' as Ref>>, + TypeIdentifier: '' as Ref>>, RefTo: '' as Ref>>, ArrOf: '' as Ref>>, Enum: '' as Ref>, @@ -169,6 +171,7 @@ export default plugin(coreId, { Association: '' as Ref>, Relation: '' as Ref>, Sequence: '' as Ref>, + CustomSequence: '' as Ref>, ClassCollaborators: '' as Ref>>, Collaborator: '' as Ref> }, diff --git a/packages/model/src/dsl.ts b/packages/model/src/dsl.ts index 2a869e1711..2674c819b5 100644 --- a/packages/model/src/dsl.ts +++ b/packages/model/src/dsl.ts @@ -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>): RefTo { return { _class: core.class.RefTo, label: core.string.Ref, icon: core.icon.TypeRef, to: _class } } +/** + * @public + */ +export function TypeIdentifier (of: Ref): TypeIdentifierType { + return { _class: core.class.TypeIdentifier, label: core.string.Id, icon: core.icon.TypeRef, of } +} + /** * @public */