@@ -50,7 +50,7 @@ export const applyManifest = async () => {
5050 return ;
5151 }
5252
53- const { error : createError } = await ProjectsService . create ( {
53+ const { data : projectId , error : createError } = await ProjectsService . create ( {
5454 name : projectName ,
5555 organizationId,
5656 } ) ;
@@ -78,34 +78,13 @@ export const applyManifest = async () => {
7878 }
7979 const manifestDirectory = getDirectoryOfFile ( filePath ) ;
8080
81- if ( ! manifestResponse ?. projectIds . length ) {
82- LoggerService . error (
83- namespaces . applyManifest ,
84- translate ( ) . t ( "errors.applyManifestNoProjectsLog" , {
85- request : "applyManifest" ,
86- } )
87- ) ;
88- return ;
89- }
90-
91- const { logs, projectIds } = manifestResponse ! ;
81+ const { logs } = manifestResponse ! ;
9282 const currentProjectPaths = ( await commands . executeCommand (
9383 vsCommands . getContext ,
9484 "projectsPaths"
9585 ) ) as unknown as string ;
9686
9787 let vscodeProjectsPaths = JSON . parse ( currentProjectPaths ) ;
98- if ( ! projectIds . length ) {
99- commands . executeCommand ( vsCommands . showErrorMessage , translate ( ) . t ( "manifest.ProjectCreationFailed" ) ) ;
100- LoggerService . error (
101- namespaces . applyManifest ,
102- translate ( ) . t ( "manifest.ProjectCreationFailedLog" , {
103- request : "applyManifest" ,
104- error : ( createError as Error ) . message ,
105- } )
106- ) ;
107- return ;
108- }
10988
11089 if ( Object . keys ( vscodeProjectsPaths || { } ) . length ) {
11190 let projectLocallyExists ;
@@ -122,23 +101,22 @@ export const applyManifest = async () => {
122101 vsCommands . showErrorMessage ,
123102 namespaces . applyManifest ,
124103 translate ( ) . t ( "projects.projectLocallyExistsFilesNotUpdated" , {
125- projectId : projectIds [ 0 ] ,
104+ projectId,
126105 directory : manifestDirectory ,
127106 } )
128107 ) ;
129108
130109 LoggerService . error (
131110 namespaces . applyManifest ,
132111 translate ( ) . t ( "projects.projectLocallyExistsFilesNotUpdatedLog" , {
133- projectId : projectIds [ 0 ] ,
112+ projectId,
134113 directory : manifestDirectory ,
135114 } )
136115 ) ;
137116 return ;
138117 }
139118 }
140- const projectId = projectIds [ 0 ] ;
141- vscodeProjectsPaths [ projectId ] = manifestDirectory ;
119+ vscodeProjectsPaths [ projectId ! ] = manifestDirectory ;
142120 await commands . executeCommand ( vsCommands . setContext , "projectsPaths" , JSON . stringify ( vscodeProjectsPaths ) ) ;
143121
144122 const organizationName =
@@ -149,7 +127,7 @@ export const applyManifest = async () => {
149127 commands . executeCommand ( vsCommands . showInfoMessage , translate ( ) . t ( "manifest.appliedSuccessfully" ) ) ;
150128 setTimeout ( ( ) => commands . executeCommand ( vsCommands . refreshSidebar ) , 2500 ) ;
151129
152- const { data : resources , error : resourcesError } = await getLocalResources ( manifestDirectory , projectId ) ;
130+ const { data : resources , error : resourcesError } = await getLocalResources ( manifestDirectory , projectId ! ) ;
153131
154132 if ( resourcesError || ! resources ) {
155133 LoggerService . error (
@@ -162,7 +140,7 @@ export const applyManifest = async () => {
162140 const filteredResources = { ...resources } ;
163141 delete filteredResources [ "autokitteh.yaml" ] ;
164142
165- const { error : setResourcesError } = await ProjectsService . setResources ( projectId , filteredResources ) ;
143+ const { error : setResourcesError } = await ProjectsService . setResources ( projectId ! , filteredResources ) ;
166144
167145 if ( setResourcesError ) {
168146 LoggerService . error (
0 commit comments