@@ -23,8 +23,8 @@ import { useRouterStore } from "./router.store";
2323
2424export type AssetId = string ;
2525
26- export interface ListVariantDefsResponse {
27- variantDefs : ListedVariantDef [ ] ;
26+ export interface ListVariantsResponse {
27+ variants : ListedVariant [ ] ;
2828}
2929
3030export interface InstalledPkgAssetView {
@@ -70,10 +70,10 @@ export interface DetachedValidationPrototype {
7070 propKind : PropKind ;
7171}
7272
73- export interface ListedVariantDef {
73+ export interface ListedVariant {
7474 id : AssetId ;
7575 name : string ;
76- menuName ?: string ;
76+ displayName ?: string ;
7777 category : string ;
7878 componentType : ComponentType ;
7979 color : string ;
@@ -83,16 +83,15 @@ export interface ListedVariantDef {
8383 updatedAt : IsoDateString ;
8484}
8585
86- export interface VariantDef extends ListedVariantDef {
86+ export interface Variant extends ListedVariant {
8787 link ?: string ;
88- schemaVariantId ?: string ;
8988 code : string ;
9089 types ?: string ;
9190 hasComponents : boolean ;
9291}
9392
94- export type Asset = VariantDef ;
95- export type AssetListEntry = ListedVariantDef ;
93+ export type Asset = Variant ;
94+ export type AssetListEntry = ListedVariant ;
9695export type AssetSaveRequest = Visibility &
9796 Omit < Asset , "createdAt" | "updatedAt" | "variantExists" | "hasComponents" > ;
9897export type AssetCreateRequest = Omit <
@@ -104,7 +103,7 @@ export type AssetCloneRequest = Visibility & { id: AssetId };
104103const LOCAL_STORAGE_LAST_SELECTED_ASSET_ID_KEY = "si-open-asset-id" ;
105104
106105export const assetDisplayName = ( asset : Asset | AssetListEntry ) =>
107- ( asset . menuName ?? "" ) . length === 0 ? asset . name : asset . menuName ;
106+ ( asset . displayName ?? "" ) . length === 0 ? asset . name : asset . displayName ;
108107
109108export const useAssetStore = ( ) => {
110109 const changeSetsStore = useChangeSetsStore ( ) ;
@@ -170,8 +169,8 @@ export const useAssetStore = () => {
170169 assetBySchemaVariantId ( ) : Record < string , Asset > {
171170 const assetsWithSchemaVariantId = _ . filter (
172171 this . assets ,
173- ( a ) => a . schemaVariantId !== undefined ,
174- ) as ( VariantDef & {
172+ ( a ) => a . id !== undefined ,
173+ ) as ( Variant & {
175174 schemaVariantId : string ;
176175 } ) [ ] ;
177176
@@ -182,7 +181,7 @@ export const useAssetStore = () => {
182181 setSchemaVariantIdForAsset ( assetId : AssetId , schemaVariantId : string ) {
183182 const asset = this . assetsById [ assetId ] ;
184183 if ( asset ) {
185- asset . schemaVariantId = schemaVariantId ;
184+ asset . id = schemaVariantId ;
186185 this . assetsById [ assetId ] = asset ;
187186 }
188187 } ,
@@ -254,7 +253,6 @@ export const useAssetStore = () => {
254253 funcs : [ ] ,
255254 createdAt : new Date ( ) . toISOString ( ) ,
256255 updatedAt : new Date ( ) . toISOString ( ) ,
257- schemaVariantId : undefined ,
258256 hasComponents : false ,
259257 } ;
260258 } ,
@@ -269,12 +267,11 @@ export const useAssetStore = () => {
269267 AssetCreateRequest
270268 > ( {
271269 method : "post" ,
272- url : "/variant_def/create_variant_def " ,
270+ url : "/variant/create_variant " ,
273271 params : {
274272 ...visibility ,
275273 ..._ . omit ( asset , [
276274 "id" ,
277- "schemaVariantId" ,
278275 "hasComponents" ,
279276 "createdAt" ,
280277 "updatedAt" ,
@@ -295,7 +292,7 @@ export const useAssetStore = () => {
295292 > ( {
296293 method : "post" ,
297294 keyRequestStatusBy : assetId ,
298- url : "/variant_def/clone_variant_def " ,
295+ url : "/variant/clone_variant " ,
299296 params : {
300297 ...visibility ,
301298 id : assetId ,
@@ -331,7 +328,7 @@ export const useAssetStore = () => {
331328 return new ApiRequest < { success : boolean } , AssetSaveRequest > ( {
332329 method : "post" ,
333330 keyRequestStatusBy : asset . id ,
334- url : "/variant_def/save_variant_def " ,
331+ url : "/variant/save_variant " ,
335332 optimistic : ( ) => {
336333 if ( isHead ) return ( ) => { } ;
337334
@@ -347,12 +344,7 @@ export const useAssetStore = () => {
347344 } ,
348345 params : {
349346 ...visibility ,
350- ..._ . omit ( asset , [
351- "schemaVariantId" ,
352- "hasComponents" ,
353- "createdAt" ,
354- "updatedAt" ,
355- ] ) ,
347+ ..._ . omit ( asset , [ "hasComponents" , "createdAt" , "updatedAt" ] ) ,
356348 } ,
357349 } ) ;
358350 } ,
@@ -364,7 +356,7 @@ export const useAssetStore = () => {
364356 id : AssetId ;
365357 }
366358 > ( {
367- url : "/variant_def/get_variant_def " ,
359+ url : "/variant/get_variant " ,
368360 keyRequestStatusBy : assetId ,
369361 params : {
370362 id : assetId ,
@@ -377,11 +369,11 @@ export const useAssetStore = () => {
377369 } ,
378370
379371 async LOAD_ASSET_LIST ( ) {
380- return new ApiRequest < ListVariantDefsResponse , Visibility > ( {
381- url : "/variant_def/list_variant_defs " ,
372+ return new ApiRequest < ListVariantsResponse , Visibility > ( {
373+ url : "/variant/list_variants " ,
382374 params : { ...visibility } ,
383375 onSuccess : ( response ) => {
384- this . assetList = response . variantDefs ;
376+ this . assetList = response . variants ;
385377 } ,
386378 } ) ;
387379 } ,
@@ -405,16 +397,11 @@ export const useAssetStore = () => {
405397 AssetSaveRequest
406398 > ( {
407399 method : "post" ,
408- url : "/variant_def/exec_variant_def " ,
400+ url : "/variant/exec_variant " ,
409401 keyRequestStatusBy : assetId ,
410402 params : {
411403 ...visibility ,
412- ..._ . omit ( asset , [
413- "schemaVariantId" ,
414- "hasComponents" ,
415- "createdAt" ,
416- "updatedAt" ,
417- ] ) ,
404+ ..._ . omit ( asset , [ "hasComponents" , "createdAt" , "updatedAt" ] ) ,
418405 } ,
419406 onSuccess : ( response ) => {
420407 this . executeAssetTaskId = response . taskId ;
@@ -433,21 +420,21 @@ export const useAssetStore = () => {
433420 } ,
434421 } ,
435422 {
436- eventType : "SchemaVariantDefinitionCreated " ,
423+ eventType : "SchemaVariantCreated " ,
437424 callback : ( data ) => {
438425 if ( data . changeSetId !== changeSetId ) return ;
439426 this . LOAD_ASSET_LIST ( ) ;
440427 } ,
441428 } ,
442429 {
443- eventType : "SchemaVariantDefinitionCloned " ,
430+ eventType : "SchemaVariantCloned " ,
444431 callback : ( data ) => {
445432 if ( data . changeSetId !== changeSetId ) return ;
446433 this . LOAD_ASSET_LIST ( ) ;
447434 } ,
448435 } ,
449436 {
450- eventType : "SchemaVariantDefinitionSaved " ,
437+ eventType : "SchemaVariantSaved " ,
451438 callback : ( data ) => {
452439 if ( data . changeSetId !== changeSetId ) return ;
453440 this . LOAD_ASSET_LIST ( ) ;
@@ -491,7 +478,7 @@ export const useAssetStore = () => {
491478 } ,
492479 } ,
493480 {
494- eventType : "SchemaVariantDefinitionFinished " ,
481+ eventType : "SchemaVariantFinished " ,
495482 callback : async ( {
496483 taskId,
497484 schemaVariantId,
0 commit comments