@@ -12,6 +12,7 @@ import InsertOneCommand = Components.Schemas.InsertOneCommand;
12
12
import InsertManyCommand = Components . Schemas . InsertManyCommand ;
13
13
import UpdateManyCommand = Components . Schemas . UpdateManyCommand ;
14
14
import UpdateOneCommand = Components . Schemas . UpdateOneCommand ;
15
+ import CommandResult = Components . Schemas . CommandResult ;
15
16
16
17
export interface AstraCollectionArgs {
17
18
collectionName : string ;
@@ -36,7 +37,9 @@ export class Collection {
36
37
this . apiConfig = args . apiConfig ;
37
38
}
38
39
39
- public countDocuments = async ( opts ?: CountDocumentsCommands ) => {
40
+ public countDocuments = async (
41
+ opts ?: CountDocumentsCommands ,
42
+ ) : Promise < CommandResult > => {
40
43
const response = await axios . post (
41
44
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
42
45
{
@@ -50,7 +53,7 @@ export class Collection {
50
53
return response ?. data ;
51
54
} ;
52
55
53
- public deleteOne = async ( opts : DeleteOneCommand ) => {
56
+ public deleteOne = async ( opts : DeleteOneCommand ) : Promise < CommandResult > => {
54
57
const response = await axios . post (
55
58
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
56
59
{
@@ -65,7 +68,9 @@ export class Collection {
65
68
return response ?. data ;
66
69
} ;
67
70
68
- public deleteMany = async ( opts ?: DeleteManyCommand ) => {
71
+ public deleteMany = async (
72
+ opts ?: DeleteManyCommand ,
73
+ ) : Promise < CommandResult > => {
69
74
const response = await axios . post (
70
75
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
71
76
{
@@ -79,7 +84,7 @@ export class Collection {
79
84
return response ?. data ;
80
85
} ;
81
86
82
- public find = async ( opts ?: FindCommand ) => {
87
+ public find = async ( opts ?: FindCommand ) : Promise < CommandResult > => {
83
88
const response = await axios . post (
84
89
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
85
90
{
@@ -95,7 +100,7 @@ export class Collection {
95
100
return response ?. data ;
96
101
} ;
97
102
98
- public findOne = async ( opts ?: FindOneCommand ) => {
103
+ public findOne = async ( opts ?: FindOneCommand ) : Promise < CommandResult > => {
99
104
const response = await axios . post (
100
105
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
101
106
{
@@ -110,7 +115,9 @@ export class Collection {
110
115
) ;
111
116
return response ?. data ;
112
117
} ;
113
- public findOneAndDelete = async ( opts : FindOneAndDeleteCommand ) => {
118
+ public findOneAndDelete = async (
119
+ opts : FindOneAndDeleteCommand ,
120
+ ) : Promise < CommandResult > => {
114
121
const response = await axios . post (
115
122
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
116
123
{
@@ -124,7 +131,9 @@ export class Collection {
124
131
) ;
125
132
return response ?. data ;
126
133
} ;
127
- public findOneAndReplace = async ( opts : FindOneAndReplaceCommand ) => {
134
+ public findOneAndReplace = async (
135
+ opts : FindOneAndReplaceCommand ,
136
+ ) : Promise < CommandResult > => {
128
137
const response = await axios . post (
129
138
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
130
139
{
@@ -140,7 +149,9 @@ export class Collection {
140
149
) ;
141
150
return response ?. data ;
142
151
} ;
143
- public findOneAndUpdate = async ( opts : FindOneAndUpdateCommand ) => {
152
+ public findOneAndUpdate = async (
153
+ opts : FindOneAndUpdateCommand ,
154
+ ) : Promise < CommandResult > => {
144
155
const response = await axios . post (
145
156
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
146
157
{
@@ -156,7 +167,7 @@ export class Collection {
156
167
) ;
157
168
return response ?. data ;
158
169
} ;
159
- public insertOne = async ( opts : InsertOneCommand ) => {
170
+ public insertOne = async ( opts : InsertOneCommand ) : Promise < CommandResult > => {
160
171
const response = await axios . post (
161
172
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
162
173
{
@@ -169,7 +180,9 @@ export class Collection {
169
180
) ;
170
181
return response ?. data ;
171
182
} ;
172
- public insertMany = async ( opts : InsertManyCommand ) => {
183
+ public insertMany = async (
184
+ opts : InsertManyCommand ,
185
+ ) : Promise < CommandResult > => {
173
186
const response = await axios . post (
174
187
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
175
188
{
@@ -182,7 +195,9 @@ export class Collection {
182
195
) ;
183
196
return response ?. data ;
184
197
} ;
185
- public updateMany = async ( opts : UpdateManyCommand ) => {
198
+ public updateMany = async (
199
+ opts : UpdateManyCommand ,
200
+ ) : Promise < CommandResult > => {
186
201
const response = await axios . post (
187
202
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
188
203
{
@@ -196,7 +211,7 @@ export class Collection {
196
211
) ;
197
212
return response ?. data ;
198
213
} ;
199
- public updateOne = async ( opts : UpdateOneCommand ) => {
214
+ public updateOne = async ( opts : UpdateOneCommand ) : Promise < CommandResult > => {
200
215
const response = await axios . post (
201
216
`${ this . apiConfig . base } /${ this . namespace } /${ this . collectionName } ` ,
202
217
{
0 commit comments