File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -69,9 +69,9 @@ export type UpdateObject<T> = {
6969 /** The ID of the object to be updated */
7070 id : string ;
7171 /** The properties of the object to be updated */
72- properties ?: NonReferenceInputs < T > ;
72+ properties ?: Partial < NonReferenceInputs < T > > ;
7373 /** The references of the object to be updated */
74- references ?: ReferenceInputs < T > ;
74+ references ?: Partial < ReferenceInputs < T > > ;
7575 //* The vector(s) to update in the object */
7676 vectors ?: number [ ] | Vectors ;
7777} ;
@@ -170,6 +170,13 @@ const addContext = <B extends IBuilder>(
170170 return builder ;
171171} ;
172172
173+ type ParseObject < T > = {
174+ id ?: string ;
175+ properties ?: Partial < NonReferenceInputs < T > > ;
176+ references ?: Partial < ReferenceInputs < T > > ;
177+ vectors ?: number [ ] | Vectors ;
178+ } ;
179+
173180const data = < T > (
174181 connection : Connection ,
175182 name : string ,
@@ -180,7 +187,7 @@ const data = <T>(
180187 const objectsPath = new ObjectsPath ( dbVersionSupport ) ;
181188 const referencesPath = new ReferencesPath ( dbVersionSupport ) ;
182189
183- const parseObject = async ( object ?: InsertObject < any > ) : Promise < WeaviateObject < T > > => {
190+ const parseObject = async ( object ?: ParseObject < any > ) : Promise < WeaviateObject < T > > => {
184191 if ( ! object ) {
185192 return { } as WeaviateObject < T > ;
186193 }
Original file line number Diff line number Diff line change @@ -1504,8 +1504,8 @@ export class Serialize {
15041504 } ;
15051505
15061506 public static restProperties = (
1507- properties : Record < string , WeaviateField > ,
1508- references ?: Record < string , ReferenceInput < any > >
1507+ properties : Record < string , WeaviateField | undefined > ,
1508+ references ?: Record < string , ReferenceInput < any > | undefined >
15091509 ) : Record < string , any > => {
15101510 const parsedProperties : any = { } ;
15111511 Object . keys ( properties ) . forEach ( ( key ) => {
@@ -1529,6 +1529,9 @@ export class Serialize {
15291529 } ) ;
15301530 if ( ! references ) return parsedProperties ;
15311531 for ( const [ key , value ] of Object . entries ( references ) ) {
1532+ if ( value === undefined ) {
1533+ continue ;
1534+ }
15321535 if ( ReferenceGuards . isReferenceManager ( value ) ) {
15331536 parsedProperties [ key ] = value . toBeaconObjs ( ) ;
15341537 } else if ( ReferenceGuards . isUuid ( value ) ) {
You can’t perform that action at this time.
0 commit comments