···11/// <reference types="next" />
22/// <reference types="next/image-types/global" />
33-import "./.next/types/routes.d.ts";
33+import "./.next/dev/types/routes.d.ts";
4455// NOTE: This file should not be edited
66// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
···6767 return true;
6868 },
6969 {
7070- error: "Value must be manual when type is manual",
7070+ message: "Value must be manual when type is manual",
7171 path: ["value"],
7272 },
7373 );
···1313 .number()
1414 .max(5)
1515 .optional()
1616- .prefault(1)
1616+ .default(1)
1717 .openapi({ description: "The number of times to run the check" }),
1818 aggregated: z
1919 .boolean()
···8787 .optional()
8888 .openapi({ description: "The body of the response" }),
8989 headers: z
9090- .record(z.string(), z.string())
9090+ .record(z.string())
9191 .optional()
9292 .openapi({ description: "The headers of the response" }),
9393 timing: TimingSchema.openapi({
···131131});
132132133133export const CheckPostResponseSchema = z.object({
134134- id: z.int().openapi({ description: "The id of the check" }),
134134+ id: z.number().int().openapi({ description: "The id of the check" }),
135135 raw: z.array(TimingSchema).openapi({
136136 description: "The raw data of the check",
137137 }),
+1-4
apps/server/src/routes/v1/incidents/put.test.ts
···6060 });
61616262 const result = (await res.json()) as Record<string, unknown>;
6363- // expect(result.message).toBe("invalid_date in 'acknowledgedAt': Invalid date");
6464- expect(result.message).toBe(
6565- "invalid_type in 'acknowledgedAt': Invalid input: expected date, received Date",
6666- );
6363+ expect(result.message).toBe("invalid_date in 'acknowledgedAt': Invalid date");
6764 expect(res.status).toBe(400);
6865});
6966
+1-1
apps/server/src/routes/v1/maintenances/schema.ts
···3737 monitorIds: z
3838 .array(z.number())
3939 .optional()
4040- .prefault([])
4040+ .default([])
4141 .openapi({ description: "IDs of affected monitors" }),
4242 pageId: z.number().openapi({
4343 description: "The id of the status page this maintenance belongs to",
+1-1
apps/server/src/routes/v1/monitors/run/schema.ts
···2233export const QuerySchema = z
44 .object({
55- "no-wait": z.coerce.boolean().optional().prefault(false).openapi({
55+ "no-wait": z.coerce.boolean().optional().default(false).openapi({
66 description: "Don't wait for the result",
77 }),
88 })
+62-52
apps/server/src/routes/v1/monitors/schema.ts
···2020 description: "The comparison to run",
2121 example: "eq",
2222 }),
2323- target: z.int().positive().openapi({ description: "The target value" }),
2323+ target: z
2424+ .number()
2525+ .int()
2626+ .positive()
2727+ .openapi({ description: "The target value" }),
2428 })
2529 .openapi({
2630 description: "The status assertion",
···9094 }),
9195});
92969393-const PeriodicityEnumHonoSchema = z.enum([...monitorPeriodicitySchema.options]);
9494-9597export const MonitorSchema = z
9698 .object({
9799 id: z.number().openapi({
98100 example: 123,
99101 description: "The id of the monitor",
100102 }),
101101- periodicity: PeriodicityEnumHonoSchema.openapi({
103103+ periodicity: monitorPeriodicitySchema.openapi({
102104 example: "1m",
103105 description: "How often the monitor should run",
104106 }),
···109111 regions: z
110112 .preprocess(
111113 (val) => {
112112- let parsedRegions: Array<unknown> = [];
113113- if (!val) return parsedRegions;
114114+ let regions: Array<unknown> = [];
115115+ if (!val) return regions;
114116 if (Array.isArray(val)) {
115115- parsedRegions = val;
117117+ regions = val;
116118 }
117119 if (String(val).length > 0) {
118118- parsedRegions = String(val).split(",");
120120+ regions = String(val).split(",");
121121+ }
122122+123123+ const deprecatedRegions = regions.filter((r) => {
124124+ return !AVAILABLE_REGIONS.includes(
125125+ r as (typeof AVAILABLE_REGIONS)[number],
126126+ );
127127+ });
128128+129129+ if (deprecatedRegions.length > 0) {
130130+ throw new ZodError([
131131+ {
132132+ code: "custom",
133133+ path: ["regions"],
134134+ message: `Deprecated regions are not allowed: ${deprecatedRegions.join(
135135+ ", ",
136136+ )}`,
137137+ },
138138+ ]);
119139 }
120120- return parsedRegions;
140140+141141+ return regions;
121142 },
122143 z.array(z.enum(monitorRegions)),
123144 )
124124- .superRefine((regions, ctx) => {
125125- const deprecatedRegions = regions.filter((r) => {
126126- return !AVAILABLE_REGIONS.includes(
127127- r as (typeof AVAILABLE_REGIONS)[number],
128128- );
129129- });
130130- if (deprecatedRegions.length > 0) {
131131- ctx.addIssue({
132132- code: "custom",
133133- path: ["regions"],
134134- message: `Deprecated regions are not allowed: ${deprecatedRegions.join(
135135- ", ",
136136- )}`,
137137- });
138138- }
139139- })
140140- .prefault([])
145145+ .default([])
141146 .openapi({
142147 example: ["ams"],
143148 description: "Where we should monitor it",
···161166 return String(val);
162167 }, z.string())
163168 .nullish()
164164- .prefault("")
169169+ .default("")
165170 .openapi({
166171 example: "Hello World",
167172 description: "The body",
···185190 ]);
186191 }
187192 },
188188- z.array(z.object({ key: z.string(), value: z.string() })).prefault([]),
193193+ z.array(z.object({ key: z.string(), value: z.string() })).default([]),
189194 )
190195 .nullish()
191196 .openapi({
···211216 }
212217 }, z.array(assertion))
213218 .nullish()
214214- .prefault([])
219219+ .default([])
215220 .openapi({
216221 description: "The assertions to run",
217222 }),
218223 active: z
219224 .boolean()
220220- .prefault(false)
225225+ .default(false)
221226 .openapi({ description: "If the monitor is active" }),
222227 public: z
223228 .boolean()
224224- .prefault(false)
229229+ .default(false)
225230 .openapi({ description: "If the monitor is public" }),
226231 degradedAfter: z.number().nullish().openapi({
227232 description:
228233 "The time after the monitor is considered degraded in milliseconds",
229234 }),
230230- timeout: z.number().nullish().prefault(45000).openapi({
235235+ timeout: z.number().nullish().default(45000).openapi({
231236 description: "The timeout of the request in milliseconds",
232237 }),
233233- retry: z.number().prefault(3).openapi({
238238+ retry: z.number().default(3).openapi({
234239 description: "The number of retries to attempt",
235240 }),
236236- followRedirects: z.boolean().prefault(true).openapi({
241241+ followRedirects: z.boolean().default(true).openapi({
237242 description: "If the monitor should follow redirects",
238243 }),
239239- jobType: z.enum(monitorJobTypes).optional().prefault("http").openapi({
244244+ jobType: z.enum(monitorJobTypes).optional().default("http").openapi({
240245 description: "The type of the monitor",
241246 }),
242247 openTelemetry: z
243248 .object({
244244- endpoint: z.url().optional().prefault("http://localhost:4317").openapi({
245245- description: "The endpoint of the OpenTelemetry collector",
246246- }),
247247- headers: z
248248- .record(z.string(), z.string())
249249+ endpoint: z
250250+ .string()
251251+ .url()
249252 .optional()
250250- .prefault({})
253253+ .default("http://localhost:4317")
251254 .openapi({
252252- description: "The headers to send to the OpenTelemetry collector",
255255+ description: "The endpoint of the OpenTelemetry collector",
253256 }),
257257+ headers: z.record(z.string()).optional().default({}).openapi({
258258+ description: "The headers to send to the OpenTelemetry collector",
259259+ }),
254260 })
255261 .optional()
256262 .openapi({
···310316]);
311317312318export const ResultRun = z.object({
313313- latency: z.int(), // in ms
314314- statusCode: z.int().nullable().prefault(null),
315315- monitorId: z.string().prefault(""),
319319+ latency: z.number().int(), // in ms
320320+ statusCode: z.number().int().nullable().default(null),
321321+ monitorId: z.string().default(""),
316322 url: z.string().optional(),
317317- error: z.coerce.boolean().prefault(false),
323323+ error: z.coerce.boolean().default(false),
318324 region: z.enum(monitorRegions),
319319- timestamp: z.int().optional(),
325325+ timestamp: z.number().int().optional(),
320326 message: z.string().nullable().optional(),
321327 timing: z
322328 .preprocess((val) => {
···407413 },
408414 z.array(z.enum(monitorRegions)),
409415 )
410410- .prefault([])
416416+ .default([])
411417 .openapi({
412418 example: ["ams"],
413419 description: "Where we should monitor it",
···415421 openTelemetry: z
416422 .object({
417423 endpoint: z
424424+ .string()
418425 .url()
419426 .optional()
420427 .openapi({
···434441435442const httpRequestSchema = z.object({
436443 method: z.enum(monitorMethods),
437437- url: z.url().openapi({
438438- description: "URL to request",
439439- examples: ["https://openstat.us", "https://www.openstatus.dev"],
440440- }),
444444+ url: z
445445+ .string()
446446+ .url()
447447+ .openapi({
448448+ description: "URL to request",
449449+ examples: ["https://openstat.us", "https://www.openstatus.dev"],
450450+ }),
441451 headers: z
442452 .record(z.string(), z.string())
443453 .optional()
···44export { ParamsSchema };
5566export const SummarySchema = z.object({
77- ok: z.int().openapi({
77+ ok: z.number().int().openapi({
88 description:
99 "The number of ok responses (defined by the assertions - or by default status code 200)",
1010 }),
1111- count: z.int().openapi({ description: "The total number of request" }),
1111+ count: z
1212+ .number()
1313+ .int()
1414+ .openapi({ description: "The total number of request" }),
1215 day: z.coerce
1316 .date()
1417 .openapi({ description: "The date of the daily stat in ISO8601 format" }),
···2020 description: "The id of the subscriber",
2121 example: 1,
2222 }),
2323- email: z.email().openapi({
2323+ email: z.string().email().openapi({
2424 description: "The email of the subscriber",
2525 }),
2626 pageId: z.number().openapi({
+3-2
apps/server/src/routes/v1/pages/schema.ts
···4343 example: "status.acme.com",
4444 }),
4545 icon: z
4646+ .string()
4647 .url()
4748 .or(z.literal(""))
4849 .transform((val) => (val ? val : undefined))
···5152 description: "The icon of the page",
5253 example: "https://example.com/icon.png",
5354 }),
5454- passwordProtected: z.boolean().optional().prefault(false).openapi({
5555+ passwordProtected: z.boolean().optional().default(false).openapi({
5556 description:
5657 "Make the page password protected. Used with the 'passwordProtected' property.",
5758 example: true,
···6061 description: "Your password to protect the page from the public",
6162 example: "hidden-password",
6263 }),
6363- showMonitorValues: z.boolean().optional().nullish().prefault(true).openapi({
6464+ showMonitorValues: z.boolean().optional().nullish().default(true).openapi({
6465 description:
6566 "Displays the total and failed request numbers for each monitor",
6667 example: true,
···2222 status: z.enum(statusReportStatus).openapi({
2323 description: "The status of the update",
2424 }),
2525- date: z.coerce.date().prefault(new Date()).openapi({
2525+ date: z.coerce.date().default(new Date()).openapi({
2626 description: "The date of the update in ISO8601 format",
2727 }),
2828 message: z.string().openapi({
+1-1
apps/server/src/routes/v1/statusReports/post.ts
···3232 id: true,
3333 statusReportUpdateIds: true,
3434 }).extend({
3535- date: z.coerce.date().optional().prefault(new Date()).openapi({
3535+ date: z.coerce.date().optional().default(new Date()).openapi({
3636 description:
3737 "The date of the report in ISO8601 format, defaults to now",
3838 }),
+2-2
apps/server/src/routes/v1/statusReports/schema.ts
···3030 .array(z.number())
3131 .optional()
3232 .nullable()
3333- .prefault([])
3333+ .default([])
3434 .openapi({
3535 description: "The ids of the status report updates",
3636 }),
3737 monitorIds: z
3838 .array(z.number())
3939 .optional()
4040- .prefault([])
4040+ .default([])
4141 .openapi({ description: "Ids of the monitors the status report." }),
4242 pageId: z.number().openapi({
4343 description: "The id of the page this status report belongs to",
+1-1
apps/server/src/routes/v1/whoami/schema.ts
···99 .optional()
1010 .openapi({ description: "The current workspace name" }),
1111 slug: z.string().openapi({ description: "The current workspace slug" }),
1212- plan: z.enum(workspacePlans).nullable().prefault("free").openapi({
1212+ plan: z.enum(workspacePlans).nullable().default("free").openapi({
1313 description: "The current workspace plan",
1414 }),
1515 })
···11/// <reference types="next" />
22/// <reference types="next/image-types/global" />
33-import "./.next/types/routes.d.ts";
33+import "./.next/dev/types/routes.d.ts";
4455// NOTE: This file should not be edited
66// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
···2233export const preferencesSchema = z
44 .object({
55- combinedRegions: z.boolean().nullable().prefault(false).optional(),
55+ combinedRegions: z.boolean().nullable().default(false).optional(),
66 // ... other settings to store user preferences
77 // accessible via document.cookie in the client and cookies() on the server
88 })