Skip to content

Commit 4cc3763

Browse files
authored
fix: update ComponentType types to match API changes [DX-692] (#2883)
* fix: update componenttype types to match API changes * fix: add missing properties for componentType
1 parent f172302 commit 4cc3763

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

lib/entities/component-type.ts

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Link, SysLink } from '../common-types'
1+
import type { Link, MetadataProps, SysLink } from '../common-types'
22

33
// Query options for getMany - matches Bridge API contract
44
export type ComponentTypeQueryOptions = {
@@ -21,6 +21,7 @@ export type ComponentTypeContentProperty = {
2121
name: string
2222
type: string
2323
required: boolean
24+
defaultValue?: unknown
2425
}
2526

2627
// Design property validation option
@@ -49,8 +50,13 @@ export type ComponentTypeDimensionKeyMap = {
4950
designProperties: Record<string, Record<string, string>>
5051
}
5152

52-
// Content property value types
53-
export type ContentPropertyValue = `$contentProperties/${string}` | `$contentBindings/${string}`
53+
// Content property pointer value types
54+
export type ContentPropertyPointerValue =
55+
| `$contentProperties/${string}`
56+
| `$contentBindings/${string}`
57+
58+
// Design property pointer value types
59+
export type DesignPropertyPointerValue = `$designProperties/${string}`
5460

5561
// Design property value types
5662
export type ManualDesignValue = {
@@ -63,14 +69,18 @@ export type DesignTokenValue = {
6369
token: string
6470
}
6571

66-
export type DesignPropertyValue = string | Record<string, ManualDesignValue | DesignTokenValue>
72+
export type DesignPropertyValue =
73+
| ManualDesignValue
74+
| DesignTokenValue
75+
| DesignPropertyPointerValue
76+
| Record<string, ManualDesignValue | DesignTokenValue | DesignPropertyPointerValue>
6777

6878
// Tree node types for component tree
6979
export type ComponentNode = {
7080
id: string
7181
nodeType: 'Component'
7282
componentTypeId: string
73-
contentProperties: Record<string, ContentPropertyValue>
83+
contentProperties: Record<string, ContentPropertyPointerValue | unknown>
7484
designProperties: Record<string, DesignPropertyValue>
7585
slots: Record<string, TreeNode[]>
7686
contentBindings?: string
@@ -99,11 +109,11 @@ export type ComponentTypeDataTypeField = {
99109
source?: string
100110
}
101111

112+
// DataAssembly link type
113+
export type DataAssemblyLink = Link<'DataAssembly'>
114+
102115
// Content bindings definition
103-
export type ComponentTypeContentBindings = {
104-
id: string
105-
type: 'Link'
106-
linkType: 'DataAssembly'
116+
export type ComponentTypeContentBindings = DataAssemblyLink['sys'] & {
107117
required: boolean
108118
dataType: ComponentTypeDataTypeField[]
109119
}
@@ -130,6 +140,11 @@ export type ComponentTypeSys = {
130140
publishedCounter?: number
131141
firstPublishedAt?: string
132142
publishedBy?: Link<'User'> | Link<'AppDefinition'>
143+
variant?: string
144+
createdAt?: string
145+
createdBy?: Link<'User'>
146+
updatedAt?: string
147+
updatedBy?: Link<'User'>
133148
}
134149

135150
// Main ComponentType props
@@ -144,4 +159,6 @@ export type ComponentTypeProps = {
144159
componentTree?: TreeNode[]
145160
contentBindings?: ComponentTypeContentBindings
146161
slots?: ComponentTypeSlotDefinition[]
162+
metadata?: MetadataProps
163+
dataAssemblies?: DataAssemblyLink[]
147164
}

0 commit comments

Comments
 (0)