@@ -8,9 +8,6 @@ import type {
88 VaultOverview ,
99 Website ,
1010} from '@1password/sdk'
11- import { createLogger } from '@sim/logger'
12-
13- const logger = createLogger ( 'OnePasswordRouteUtils' )
1411
1512/** Connect-format field type strings returned by normalization. */
1613type ConnectFieldType =
@@ -262,8 +259,6 @@ export async function connectRequest(options: {
262259 headers [ 'Content-Type' ] = 'application/json'
263260 }
264261
265- logger . info ( `Connect request: ${ options . method } ${ options . path } ` )
266-
267262 return fetch ( url , {
268263 method : options . method ,
269264 headers,
@@ -295,7 +290,7 @@ export function normalizeSdkItemOverview(item: ItemOverview): NormalizedItemOver
295290 title : item . title ,
296291 vault : { id : item . vaultId } ,
297292 category : SDK_TO_CONNECT_CATEGORY [ item . category ] ?? 'CUSTOM' ,
298- urls : item . websites . map ( ( w : Website ) => ( {
293+ urls : ( item . websites ?? [ ] ) . map ( ( w : Website ) => ( {
299294 href : w . url ,
300295 label : w . label ?? null ,
301296 primary : false ,
@@ -319,7 +314,7 @@ export function normalizeSdkItem(item: Item): NormalizedItem {
319314 title : item . title ,
320315 vault : { id : item . vaultId } ,
321316 category : SDK_TO_CONNECT_CATEGORY [ item . category ] ?? 'CUSTOM' ,
322- urls : item . websites . map ( ( w : Website ) => ( {
317+ urls : ( item . websites ?? [ ] ) . map ( ( w : Website ) => ( {
323318 href : w . url ,
324319 label : w . label ?? null ,
325320 primary : false ,
@@ -328,7 +323,7 @@ export function normalizeSdkItem(item: Item): NormalizedItem {
328323 tags : item . tags ?? [ ] ,
329324 version : item . version ?? 0 ,
330325 state : null ,
331- fields : item . fields . map ( ( field : ItemField ) => ( {
326+ fields : ( item . fields ?? [ ] ) . map ( ( field : ItemField ) => ( {
332327 id : field . id ,
333328 label : field . title ,
334329 type : SDK_TO_CONNECT_FIELD_TYPE [ field . fieldType ] ?? 'STRING' ,
@@ -339,7 +334,7 @@ export function normalizeSdkItem(item: Item): NormalizedItem {
339334 recipe : null ,
340335 entropy : null ,
341336 } ) ) ,
342- sections : item . sections . map ( ( section : ItemSection ) => ( {
337+ sections : ( item . sections ?? [ ] ) . map ( ( section : ItemSection ) => ( {
343338 id : section . id ,
344339 label : section . title ,
345340 } ) ) ,
0 commit comments