Skip to content

Commit 264fff7

Browse files
committed
Ensure all runes are serialized with toJSON
sveltejs/svelte#9639
1 parent fbdd2c4 commit 264fff7

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

src/Exceptionless.Web/ClientApp/src/lib/components/filters/filters.svelte.ts

+90
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ export class BooleanFilter implements IFilter {
4444

4545
return `${this.term}:${this.value}`;
4646
}
47+
48+
public toJSON() {
49+
return {
50+
type: this.type,
51+
term: this.term,
52+
value: this.value
53+
};
54+
}
4755
}
4856

4957
export class DateFilter implements IFilter {
@@ -81,6 +89,14 @@ export class DateFilter implements IFilter {
8189
const date = this.value instanceof Date ? this.value.toISOString() : this.value;
8290
return `${this.term}:${quoteIfSpecialCharacters(date)}`;
8391
}
92+
93+
public toJSON() {
94+
return {
95+
type: this.type,
96+
term: this.term,
97+
value: this.value
98+
};
99+
}
84100
}
85101

86102
export class KeywordFilter implements IFilter {
@@ -111,6 +127,13 @@ export class KeywordFilter implements IFilter {
111127

112128
return this.value!.trim();
113129
}
130+
131+
public toJSON() {
132+
return {
133+
type: this.type,
134+
value: this.value
135+
};
136+
}
114137
}
115138

116139
export class NumberFilter implements IFilter {
@@ -147,6 +170,14 @@ export class NumberFilter implements IFilter {
147170

148171
return `${this.term}:${this.value}`;
149172
}
173+
174+
public toJSON() {
175+
return {
176+
type: this.type,
177+
term: this.term,
178+
value: this.value
179+
};
180+
}
150181
}
151182

152183
export class OrganizationFilter implements IFilter {
@@ -176,6 +207,13 @@ export class OrganizationFilter implements IFilter {
176207

177208
return `organization:${this.value}`;
178209
}
210+
211+
public toJSON() {
212+
return {
213+
type: this.type,
214+
value: this.value
215+
};
216+
}
179217
}
180218

181219
export class ProjectFilter implements IFilter {
@@ -212,6 +250,14 @@ export class ProjectFilter implements IFilter {
212250

213251
return `(${this.value.map((val) => `project:${val}`).join(' OR ')})`;
214252
}
253+
254+
public toJSON() {
255+
return {
256+
type: this.type,
257+
organization: this.organization,
258+
value: this.value
259+
};
260+
}
215261
}
216262

217263
export class ReferenceFilter implements IFilter {
@@ -242,6 +288,13 @@ export class ReferenceFilter implements IFilter {
242288

243289
return `reference:${quoteIfSpecialCharacters(this.value)}`;
244290
}
291+
292+
public toJSON() {
293+
return {
294+
type: this.type,
295+
value: this.value
296+
};
297+
}
245298
}
246299

247300
export class SessionFilter implements IFilter {
@@ -273,6 +326,13 @@ export class SessionFilter implements IFilter {
273326
const session = quoteIfSpecialCharacters(this.value);
274327
return `(reference:${session} OR ref.session:${session})`;
275328
}
329+
330+
public toJSON() {
331+
return {
332+
type: this.type,
333+
value: this.value
334+
};
335+
}
276336
}
277337

278338
export class StatusFilter implements IFilter {
@@ -307,6 +367,13 @@ export class StatusFilter implements IFilter {
307367

308368
return `(${this.value.map((val) => `status:${val}`).join(' OR ')})`;
309369
}
370+
371+
public toJSON() {
372+
return {
373+
type: this.type,
374+
value: this.value
375+
};
376+
}
310377
}
311378

312379
export class StringFilter implements IFilter {
@@ -343,6 +410,14 @@ export class StringFilter implements IFilter {
343410

344411
return `${this.term}:${quoteIfSpecialCharacters(this.value)}`;
345412
}
413+
414+
public toJSON() {
415+
return {
416+
type: this.type,
417+
term: this.term,
418+
value: this.value
419+
};
420+
}
346421
}
347422

348423
export class TypeFilter implements IFilter {
@@ -377,6 +452,13 @@ export class TypeFilter implements IFilter {
377452

378453
return `(${this.value.map((val) => `type:${val}`).join(' OR ')})`;
379454
}
455+
456+
public toJSON() {
457+
return {
458+
type: this.type,
459+
value: this.value
460+
};
461+
}
380462
}
381463

382464
export class VersionFilter implements IFilter {
@@ -413,6 +495,14 @@ export class VersionFilter implements IFilter {
413495

414496
return `${this.term}:${quoteIfSpecialCharacters(this.value)}`;
415497
}
498+
499+
public toJSON() {
500+
return {
501+
type: this.type,
502+
term: this.term,
503+
value: this.value
504+
};
505+
}
416506
}
417507

418508
export function quoteIfSpecialCharacters(value?: string | null): string | null | undefined {

0 commit comments

Comments
 (0)