@@ -44,6 +44,14 @@ export class BooleanFilter implements IFilter {
44
44
45
45
return `${ this . term } :${ this . value } ` ;
46
46
}
47
+
48
+ public toJSON ( ) {
49
+ return {
50
+ type : this . type ,
51
+ term : this . term ,
52
+ value : this . value
53
+ } ;
54
+ }
47
55
}
48
56
49
57
export class DateFilter implements IFilter {
@@ -81,6 +89,14 @@ export class DateFilter implements IFilter {
81
89
const date = this . value instanceof Date ? this . value . toISOString ( ) : this . value ;
82
90
return `${ this . term } :${ quoteIfSpecialCharacters ( date ) } ` ;
83
91
}
92
+
93
+ public toJSON ( ) {
94
+ return {
95
+ type : this . type ,
96
+ term : this . term ,
97
+ value : this . value
98
+ } ;
99
+ }
84
100
}
85
101
86
102
export class KeywordFilter implements IFilter {
@@ -111,6 +127,13 @@ export class KeywordFilter implements IFilter {
111
127
112
128
return this . value ! . trim ( ) ;
113
129
}
130
+
131
+ public toJSON ( ) {
132
+ return {
133
+ type : this . type ,
134
+ value : this . value
135
+ } ;
136
+ }
114
137
}
115
138
116
139
export class NumberFilter implements IFilter {
@@ -147,6 +170,14 @@ export class NumberFilter implements IFilter {
147
170
148
171
return `${ this . term } :${ this . value } ` ;
149
172
}
173
+
174
+ public toJSON ( ) {
175
+ return {
176
+ type : this . type ,
177
+ term : this . term ,
178
+ value : this . value
179
+ } ;
180
+ }
150
181
}
151
182
152
183
export class OrganizationFilter implements IFilter {
@@ -176,6 +207,13 @@ export class OrganizationFilter implements IFilter {
176
207
177
208
return `organization:${ this . value } ` ;
178
209
}
210
+
211
+ public toJSON ( ) {
212
+ return {
213
+ type : this . type ,
214
+ value : this . value
215
+ } ;
216
+ }
179
217
}
180
218
181
219
export class ProjectFilter implements IFilter {
@@ -212,6 +250,14 @@ export class ProjectFilter implements IFilter {
212
250
213
251
return `(${ this . value . map ( ( val ) => `project:${ val } ` ) . join ( ' OR ' ) } )` ;
214
252
}
253
+
254
+ public toJSON ( ) {
255
+ return {
256
+ type : this . type ,
257
+ organization : this . organization ,
258
+ value : this . value
259
+ } ;
260
+ }
215
261
}
216
262
217
263
export class ReferenceFilter implements IFilter {
@@ -242,6 +288,13 @@ export class ReferenceFilter implements IFilter {
242
288
243
289
return `reference:${ quoteIfSpecialCharacters ( this . value ) } ` ;
244
290
}
291
+
292
+ public toJSON ( ) {
293
+ return {
294
+ type : this . type ,
295
+ value : this . value
296
+ } ;
297
+ }
245
298
}
246
299
247
300
export class SessionFilter implements IFilter {
@@ -273,6 +326,13 @@ export class SessionFilter implements IFilter {
273
326
const session = quoteIfSpecialCharacters ( this . value ) ;
274
327
return `(reference:${ session } OR ref.session:${ session } )` ;
275
328
}
329
+
330
+ public toJSON ( ) {
331
+ return {
332
+ type : this . type ,
333
+ value : this . value
334
+ } ;
335
+ }
276
336
}
277
337
278
338
export class StatusFilter implements IFilter {
@@ -307,6 +367,13 @@ export class StatusFilter implements IFilter {
307
367
308
368
return `(${ this . value . map ( ( val ) => `status:${ val } ` ) . join ( ' OR ' ) } )` ;
309
369
}
370
+
371
+ public toJSON ( ) {
372
+ return {
373
+ type : this . type ,
374
+ value : this . value
375
+ } ;
376
+ }
310
377
}
311
378
312
379
export class StringFilter implements IFilter {
@@ -343,6 +410,14 @@ export class StringFilter implements IFilter {
343
410
344
411
return `${ this . term } :${ quoteIfSpecialCharacters ( this . value ) } ` ;
345
412
}
413
+
414
+ public toJSON ( ) {
415
+ return {
416
+ type : this . type ,
417
+ term : this . term ,
418
+ value : this . value
419
+ } ;
420
+ }
346
421
}
347
422
348
423
export class TypeFilter implements IFilter {
@@ -377,6 +452,13 @@ export class TypeFilter implements IFilter {
377
452
378
453
return `(${ this . value . map ( ( val ) => `type:${ val } ` ) . join ( ' OR ' ) } )` ;
379
454
}
455
+
456
+ public toJSON ( ) {
457
+ return {
458
+ type : this . type ,
459
+ value : this . value
460
+ } ;
461
+ }
380
462
}
381
463
382
464
export class VersionFilter implements IFilter {
@@ -413,6 +495,14 @@ export class VersionFilter implements IFilter {
413
495
414
496
return `${ this . term } :${ quoteIfSpecialCharacters ( this . value ) } ` ;
415
497
}
498
+
499
+ public toJSON ( ) {
500
+ return {
501
+ type : this . type ,
502
+ term : this . term ,
503
+ value : this . value
504
+ } ;
505
+ }
416
506
}
417
507
418
508
export function quoteIfSpecialCharacters ( value ?: string | null ) : string | null | undefined {
0 commit comments