@@ -41,19 +41,23 @@ export class Uploader {
41
41
const sortedNewObjs = normalizeIndexedItemArray ( newObjects ) ;
42
42
const operations = this . determineOperations ( existingObjects , sortedNewObjs ) ;
43
43
44
- if ( operations . update . length === 0 && operations . add . length === 0 ) {
44
+ if (
45
+ operations . update . length === 0 &&
46
+ operations . add . length === 0 &&
47
+ operations . delete . length === 0
48
+ ) {
45
49
console . log ( "No updates needed. All objects are up to date." ) ;
46
50
return ;
47
51
}
48
52
49
53
// Update Operation
50
54
if ( operations . update . length > 0 ) {
51
- const res = await this . client . partialUpdateObjects ( {
55
+ const res : BatchResponse [ ] = await this . client . partialUpdateObjects ( {
52
56
indexName : this . indexName ,
53
57
objects : operations . update ,
54
58
createIfNotExists : true ,
55
59
} ) ;
56
- console . log ( `Updated ${ res . length } objects` ) ;
60
+ console . log ( `Updated ${ res [ 0 ] . objectIDs . length } objects` ) ;
57
61
}
58
62
59
63
// Add Operation
@@ -62,7 +66,7 @@ export class Uploader {
62
66
indexName : this . indexName ,
63
67
objects : operations . add ,
64
68
} ) ;
65
- console . log ( `Added ${ res . length } objects` ) ;
69
+ console . log ( `Added ${ res [ 0 ] . objectIDs . length } objects` ) ;
66
70
}
67
71
68
72
// Delete Operation
@@ -72,7 +76,7 @@ export class Uploader {
72
76
indexName : this . indexName ,
73
77
objectIDs : targetIds ,
74
78
} ) ;
75
- console . log ( `Deleted ${ res . length } objects` ) ;
79
+ console . log ( `Deleted ${ res [ 0 ] . objectIDs . length } objects` ) ;
76
80
}
77
81
}
78
82
0 commit comments