Skip to content

Open-source status page, incident response and uptime monitoring

[POC] use honojs for api server (#296)

Maximilian Kaske2419aff2ef23
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..da5202812
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,6 @@
+**/.dockerignore
+**/node_modules
+**/npm-debug.log
+**/README.md
+**/.next
+**/.git
diff --git a/.vscode/settings.json b/.vscode/settings.json
index cac704b65..b3e03e119 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -13,5 +13,8 @@
"typescript.enablePromptUseWorkspaceTsdk": true,
"[dotenv]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
+ },
+ "[dockerfile]": {
+ "editor.defaultFormatter": "ms-azuretools.vscode-docker"
}
}
diff --git a/README.md b/README.md
index efb31f88f..f0e0378e4 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
<p align="center" style="margin-top: 120px">
- <h3 align="center">The Open-source Uptime Monitoring with Status Page
+ <h3 align="center">The Open-Source Uptime Monitoring with Status Page
</h3>
<p align="center">
- The BetterUptime Open Source Alternative.
+ The Open-Source Serverless monitoring platform.
<br />
<a href="https://www.openstatus.dev"><strong>Learn more »</strong></a>
<br />
diff --git a/apps/api/.env.example b/apps/api/.env.example
deleted file mode 100644
index b8233ade6..000000000
--- a/apps/api/.env.example
+++ /dev/null
@@ -1,2 +0,0 @@
-DATABASE_URL=http://127.0.0.1:8080
-DATABASE_AUTH_TOKEN=any-token
\ No newline at end of file
diff --git a/apps/api/.gitignore b/apps/api/.gitignore
deleted file mode 100644
index c3ab0c684..000000000
--- a/apps/api/.gitignore
+++ /dev/null
@@ -1,38 +0,0 @@
-# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
-
-# dependencies
-/node_modules
-/.pnp
-.pnp.js
-
-# testing
-/coverage
-
-# next.js
-/.next/
-/out/
-
-# production
-/build
-
-# misc
-.DS_Store
-*.pem
-
-# debug
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-
-# local env files
-.env*.local
-
-# vercel
-.vercel
-
-# typescript
-*.tsbuildinfo
-next-env.d.ts
-
-# generated on build time
-/public/swagger.json
\ No newline at end of file
diff --git a/apps/api/README.md b/apps/api/README.md
deleted file mode 100644
index fc5639826..000000000
--- a/apps/api/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-This is a [Next.js](https://nextjs.org/) project bootstrapped with
-[`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
-
-## Getting Started
-
-First, run the development server:
-
-```bash
-npm run dev
-# or
-yarn dev
-# or
-pnpm dev
-```
-
-Open [http://localhost:3000](http://localhost:3000) with your browser to see the
-result.
-
-You can start editing the page by modifying `app/page.tsx`. The page
-auto-updates as you edit the file.
-
-This project uses
-[`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to
-automatically optimize and load Inter, a custom Google Font.
-
-## Learn More
-
-To learn more about Next.js, take a look at the following resources:
-
-- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
- features and API.
-- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
-
-You can check out
-[the Next.js GitHub repository](https://github.com/vercel/next.js/) - your
-feedback and contributions are welcome!
-
-## Deploy on Vercel
-
-The easiest way to deploy your Next.js app is to use the
-[Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme)
-from the creators of Next.js.
-
-Check out our
-[Next.js deployment documentation](https://nextjs.org/docs/deployment) for more
-details.
diff --git a/apps/api/next-swagger-doc.json b/apps/api/next-swagger-doc.json
deleted file mode 100644
index 21a0c42c2..000000000
--- a/apps/api/next-swagger-doc.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "apiFolder": "src/app",
- "definition": {
- "openapi": "3.0.0",
- "info": {
- "title": "OpenStatus API",
- "version": "1.0"
- },
- "components": {
- "securitySchemes": {
- "ApiKeyAuth": {
- "type": "apiKey",
- "name": "x-openstatus-key"
- }
- }
- },
- "security": [{ "ApiKeyAuth": [] }]
- }
-}
\ No newline at end of file
diff --git a/apps/api/next.config.js b/apps/api/next.config.js
deleted file mode 100644
index 767719fc4..000000000
--- a/apps/api/next.config.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/** @type {import('next').NextConfig} */
-const nextConfig = {}
-
-module.exports = nextConfig
diff --git a/apps/api/package.json b/apps/api/package.json
deleted file mode 100644
index 3b9436abb..000000000
--- a/apps/api/package.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "@openstatus/api-server",
- "version": "0.1.0",
- "private": true,
- "scripts": {
- "dev": "next dev",
- "build": "pnpm gen:swagger && next build",
- "start": "next start",
- "lint": "next lint",
- "gen:swagger": "next-swagger-doc-cli next-swagger-doc.json"
- },
- "dependencies": {
- "@openstatus/db": "workspace:^",
- "next": "13.4.12",
- "next-swagger-doc": "0.4.0",
- "react": "18.2.0",
- "react-dom": "18.2.0",
- "zod": "3.21.4"
- },
- "devDependencies": {
- "@types/node": "20.5.9",
- "@types/react": "18.2.12",
- "@types/react-dom": "18.2.5",
- "tsconfig": "workspace:*",
- "typescript": "5.1.6"
- }
-}
diff --git a/apps/api/postcss.config.js b/apps/api/postcss.config.js
deleted file mode 100644
index 12a703d90..000000000
--- a/apps/api/postcss.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-module.exports = {
- plugins: {
- tailwindcss: {},
- autoprefixer: {},
- },
-};
diff --git a/apps/api/public/.gitkeep b/apps/api/public/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/apps/api/src/app/layout.tsx b/apps/api/src/app/layout.tsx
deleted file mode 100644
index 5ff842ef0..000000000
--- a/apps/api/src/app/layout.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-export const metadata = {
- title: "Next.js",
- description: "Generated by Next.js",
-};
-
-export default function RootLayout({
- children,
-}: {
- children: React.ReactNode;
-}) {
- return (
- <html lang="en">
- <body>{children}</body>
- </html>
- );
-}
diff --git a/apps/api/src/app/v1/monitors/[id]/route.ts b/apps/api/src/app/v1/monitors/[id]/route.ts
deleted file mode 100644
index 819f1229b..000000000
--- a/apps/api/src/app/v1/monitors/[id]/route.ts
+++ /dev/null
@@ -1,189 +0,0 @@
-import { db, eq, schema } from "@openstatus/db";
-
-const { insertMonitorSchema, monitor } = schema;
-
-/**
- * @swagger
- * /v1/monitors/{id}:
- * get:
- * summmary: Returns the monitor
- * parameters:
- * - in: path
- * name: id
- * schema:
- * type: integer
- * required: true
- * description: ID of the monitors to get
- * tags:
- * - Monitors
- * responses:
- * 200:
- * description: The monitor
- * 401:
- * description: Unauthorized
- * 404:
- * description: No monitors were found
- * 500:
- * description: Bad Request
- */
-export async function GET(
- req: Request,
- { params }: { params: { id: string } },
-) {
- try {
- const workspaceId = Number(req.headers.get("x-workspace-id"));
- const id = Number(params.id);
- const _monitor = await db
- .select()
- .from(monitor)
- .where(eq(monitor.id, id))
- .get();
-
- if (!_monitor) {
- return new Response("Not Found", { status: 404 });
- }
-
- if (workspaceId !== _monitor.workspaceId) {
- return new Response("Unauthorized", { status: 401 });
- }
-
- return new Response(JSON.stringify(_monitor), { status: 200 });
- } catch (e) {
- console.error(e);
-
- return new Response("Internal Error", { status: 500 });
- }
-}
-
-/**
- * @swagger
- * /v1/monitors/{id}:
- * put:
- * summmary: Update the monitor
- * parameters:
- * - in: path
- * name: id
- * schema:
- * type: integer
- * required: true
- * description: ID of the monitors to get
- * tags:
- * - Monitors
- * responses:
- * 200:
- * description: The monitor
- * 401:
- * description: Unauthorized
- * 404:
- * description: No monitors were found
- * 500:
- * description: Bad Request
- */
-export async function PUT(
- req: Request,
- { params }: { params: { id: string } },
-) {
- try {
- const workspaceId = Number(req.headers.get("x-workspace-id"));
- const id = Number(params.id);
- const _monitor = await db
- .select()
- .from(monitor)
- .where(eq(monitor.id, id))
- .get();
-
- if (!_monitor) {
- return new Response("Not Found", { status: 404 });
- }
-
- if (workspaceId !== _monitor.workspaceId) {
- return new Response("Unauthorized", { status: 401 });
- }
-
- const json = await req.json();
- const _valid = insertMonitorSchema
- .partial()
- .safeParse({ ...json, workspaceId });
-
- if (!_valid.success) {
- return new Response(JSON.stringify(_valid.error), { status: 400 });
- }
-
- const { data } = _valid;
- const _newMonitor = await db
- .update(monitor)
- .set({
- ..._monitor,
- ...data,
- regions: (data || _monitor).regions?.join(","), // mapping array to string
- headers:
- data.headers || _monitor.headers
- ? JSON.parse(String((data || _monitor).headers))
- : undefined, // mapping JSON to string
- })
- .where(eq(monitor.id, id))
- .returning()
- .get();
-
- return new Response(JSON.stringify(_newMonitor), { status: 200 });
- } catch (e) {
- console.error(e);
-
- return new Response("Internal Error", { status: 500 });
- }
-}
-
-/**
- * @swagger
- * /v1/monitors/{id}:
- * delete:
- * summmary: Update the monitor
- * parameters:
- * - in: path
- * name: id
- * schema:
- * type: integer
- * required: true
- * description: ID of the monitors to delete
- * tags:
- * - Monitors
- * responses:
- * 200:
- * description: The monitor
- * 401:
- * description: Unauthorized
- * 404:
- * description: No monitors were found
- * 500:
- * description: Bad Request
- */
-export async function DELETE(
- req: Request,
- { params }: { params: { id: string } },
-) {
- try {
- const workspaceId = Number(req.headers.get("x-workspace-id"));
- const id = Number(params.id);
- const _monitor = await db
- .select()
- .from(monitor)
- .where(eq(monitor.id, id))
- .get();
-
- if (!_monitor) {
- return new Response("Not Found", { status: 404 });
- }
-
- if (workspaceId !== _monitor.workspaceId) {
- return new Response("Unauthorized", { status: 401 });
- }
-
- await db.delete(monitor).where(eq(monitor.id, id)).run();
-
- return new Response("Deleted", { status: 200 });
- } catch (e) {
- console.log(e);
-
- return new Response("Internal Error", { status: 500 });
- }
-}
diff --git a/apps/api/src/app/v1/monitors/route.ts b/apps/api/src/app/v1/monitors/route.ts
deleted file mode 100644
index ac1b9f64e..000000000
--- a/apps/api/src/app/v1/monitors/route.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import { db } from "@openstatus/db";
-import { insertMonitorSchema, monitor } from "@openstatus/db/src/schema";
-
-// TODO: make sure that only valid frequency values (based on plan) are allowed
-
-/**
- * @swagger
- * /v1/monitors:
- * post:
- * summmary: Returns the monitor
- * parameters:
- * - in: path
- * name: id
- * schema:
- * type: integer
- * required: true
- * description: ID of the monitors to get
- * tags:
- * - Monitors
- * responses:
- * 200:
- * description: The monitor
- * 404:
- * description: No monitors were found
- * 500:
- * description: Bad Request
- */
-export async function POST(req: Request) {
- try {
- const workspaceId = Number(req.headers.get("x-workspace-id"));
- const json = await req.json();
- const _valid = insertMonitorSchema.safeParse({ ...json, workspaceId });
-
- if (!_valid.success) {
- return new Response(JSON.stringify(_valid.error), { status: 400 });
- }
-
- const { data } = _valid;
- const _monitor = await db
- .insert(monitor)
- .values({
- ...data,
- regions: data.regions?.join(","), // mapping array to string
- headers: data.headers ? JSON.parse(String(data.headers)) : undefined, // mapping JSON to string
- })
- .returning()
- .get();
-
- return new Response(JSON.stringify(_monitor), { status: 200 });
- } catch (e) {
- console.error(e);
-
- return new Response("Internal Error", { status: 500 });
- }
-}
diff --git a/apps/api/src/app/v1/pages/[id]/route.ts b/apps/api/src/app/v1/pages/[id]/route.ts
deleted file mode 100644
index 7c63343a7..000000000
--- a/apps/api/src/app/v1/pages/[id]/route.ts
+++ /dev/null
@@ -1,168 +0,0 @@
-import { db, eq } from "@openstatus/db";
-import { insertPageSchemaWithMonitors, page } from "@openstatus/db/src/schema";
-
-/**
- * @swagger
- * /v1/pages/{id}:
- * get:
- * summmary: Returns the status page
- * parameters:
- * - in: path
- * name: id
- * schema:
- * type: integer
- * required: true
- * description: ID of the page to get
- * tags:
- * - Status pages
- * responses:
- * 200:
- * description: The page
- * 401:
- * description: Unauthorized
- * 404:
- * description: No page were found
- * 500:
- * description: Bad Request
- */
-export async function GET(
- req: Request,
- { params }: { params: { id: string } },
-) {
- try {
- const workspaceId = Number(req.headers.get("x-workspace-id"));
- const id = Number(params.id);
- const _page = await db.select().from(page).where(eq(page.id, id)).get();
-
- if (!_page) {
- return new Response("Not Found", { status: 404 });
- }
-
- if (workspaceId !== _page.workspaceId) {
- return new Response("Unauthorized", { status: 401 });
- }
-
- return new Response(JSON.stringify(_page), { status: 200 });
- } catch (e) {
- console.error(e);
-
- return new Response("Internal Error", { status: 500 });
- }
-}
-
-/**
- * @swagger
- * /v1/pages/{id}:
- * put:
- * summmary: Returns the status page
- * parameters:
- * - in: path
- * name: id
- * schema:
- * type: integer
- * required: true
- * description: ID of the page to get
- * tags:
- * - Status pages
- * responses:
- * 200:
- * description: The page
- * 401:
- * description: Unauthorized
- * 404:
- * description: No page were found
- * 500:
- * description: Bad Request
- */
-export async function PUT(
- req: Request,
- { params }: { params: { id: string } },
-) {
- try {
- const workspaceId = Number(req.headers.get("x-workspace-id"));
- const id = Number(params.id);
- const _page = await db.select().from(page).where(eq(page.id, id)).get();
-
- if (!_page) {
- return new Response("Not Found", { status: 404 });
- }
-
- if (workspaceId !== _page.workspaceId) {
- return new Response("Unauthorized", { status: 401 });
- }
-
- const json = await req.json();
- const _valid = insertPageSchemaWithMonitors.safeParse({
- ...json,
- workspaceId,
- });
-
- if (!_valid.success) {
- return new Response(JSON.stringify(_valid.error), { status: 400 });
- }
-
- const { data } = _valid;
- const _newPage = await db
- .update(page)
- .set(data)
- .where(eq(page.id, id))
- .returning()
- .get();
-
- return new Response(JSON.stringify(_newPage), { status: 200 });
- } catch (e) {
- console.error(e);
- return new Response("Internal Error", { status: 500 });
- }
-}
-
-/**
- * @swagger
- * /v1/pages/{id}:
- * delete:
- * summmary: Returns the status page
- * parameters:
- * - in: path
- * name: id
- * schema:
- * type: integer
- * required: true
- * description: ID of the page to get
- * tags:
- * - Status pages
- * responses:
- * 200:
- * description: The page
- * 401:
- * description: Unauthorized
- * 404:
- * description: No page were found
- * 500:
- * description: Bad Request
- */
-export async function DELETE(
- req: Request,
- { params }: { params: { id: string } },
-) {
- try {
- const workspaceId = Number(req.headers.get("x-workspace-id"));
- const id = Number(params.id);
- const _page = await db.select().from(page).where(eq(page.id, id)).get();
-
- if (!_page) {
- return new Response("Not Found", { status: 404 });
- }
-
- if (workspaceId !== _page.workspaceId) {
- return new Response("Unauthorized", { status: 401 });
- }
-
- await db.delete(page).where(eq(page.id, id)).run();
-
- return new Response("Deleted", { status: 200 });
- } catch (e) {
- console.error(e);
-
- return new Response("Internal Error", { status: 500 });
- }
-}
diff --git a/apps/api/src/app/v1/pages/route.ts b/apps/api/src/app/v1/pages/route.ts
deleted file mode 100644
index bd1ceb528..000000000
--- a/apps/api/src/app/v1/pages/route.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import { db } from "@openstatus/db";
-import { insertPageSchemaWithMonitors, page } from "@openstatus/db/src/schema";
-
-/**
- * @swagger
- * /v1/status-pages:
- * post:
- * summmary: Create a new status page
- * parameters:
- * - in: path
- * name: id
- * schema:
- * type: integer
- * required: true
- * description: ID of the monitors to get
- * tags:
- * - Status pages
- * security:
- * - ApiKeyAuth: []
- * requestBody:
- * description: Create a new booking related to one of your event-types
- * required: true
- * content:
- * application/json:
- * schema:
- * type: object
- * required:
- * - name
- * properties:
- * name:
- * type: string
- * example: "My Status Page"
- * responses:
- * 200:
- * description: The monitor
- * 404:
- * description: No monitors were found
- * 500:
- * description: Bad Request
- */
-export async function POST(req: Request) {
- try {
- const workspaceId = Number(req.headers.get("x-workspace-id"));
- const json = await req.json();
- const _valid = insertPageSchemaWithMonitors.safeParse({
- ...json,
- workspaceId,
- });
-
- if (!_valid.success) {
- return new Response(JSON.stringify(_valid.error), { status: 400 });
- }
-
- const { data } = _valid;
- const _page = await db.insert(page).values(data).returning().get();
-
- return new Response(JSON.stringify(_page), { status: 200 });
- } catch (e) {
- console.error(e);
-
- return new Response("Internal Error", { status: 500 });
- }
-}
diff --git a/apps/api/src/lib/schema.ts b/apps/api/src/lib/schema.ts
deleted file mode 100644
index 62af06590..000000000
--- a/apps/api/src/lib/schema.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import * as z from "zod";
-
-export const keySchema = z.object({
- valid: z.boolean(),
- ownerId: z.string(),
- // extend later with ratelimit,...
-});
diff --git a/apps/api/src/middleware.ts b/apps/api/src/middleware.ts
deleted file mode 100644
index 2123f6e65..000000000
--- a/apps/api/src/middleware.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import { NextResponse } from "next/server";
-import type { NextRequest } from "next/server";
-
-import { keySchema } from "./lib/schema";
-
-export async function middleware(request: NextRequest) {
- const auth = request.headers.get("x-openstatus-key");
-
- if (!auth) {
- return new Response("Unauthorized", { status: 401 });
- }
-
- const newHeaders = new Headers(request.headers);
-
- if (process.env.NODE_ENV === "production") {
- const res = await fetch("https://api.unkey.dev/v1/keys/verify", {
- method: "POST",
- headers: new Headers({
- "Content-Type": "application/json",
- }),
- body: JSON.stringify({ key: auth }),
- });
-
- const json = await res.json();
- const key = keySchema.safeParse(json);
-
- if (!key.success) {
- return new Response("Bad Request", { status: 400 });
- }
-
- if (!key.data.valid) {
- return new Response("Unauthorized", { status: 401 });
- }
-
- newHeaders.set("x-workspace-id", key.data.ownerId);
- } else {
- // REMINDER: change the id to your workspace id
- newHeaders.set("x-workspace-id", "1");
- }
-
- return NextResponse.next({ request: { headers: newHeaders } });
-}
-
-export const config = { matcher: ["/v1/(.*)"] };
diff --git a/apps/api/tailwind.config.ts b/apps/api/tailwind.config.ts
deleted file mode 100644
index b2c119e17..000000000
--- a/apps/api/tailwind.config.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-module.exports = {
- content: ["./src/**/*.{tsx,ts,mdx,md}"],
- theme: {
- extend: {},
- },
- plugins: [],
-};
diff --git a/apps/api/tsconfig.json b/apps/api/tsconfig.json
deleted file mode 100644
index 10f4589b3..000000000
--- a/apps/api/tsconfig.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "extends": "tsconfig/nextjs.json",
- "compilerOptions": {
- "baseUrl": ".",
- "paths": {
- "@/*": ["./src/*"]
- },
- "plugins": [{ "name": "next" }],
- "strictNullChecks": true,
- "strict": true
- },
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
- "exclude": ["node_modules"]
-}
diff --git a/apps/docs/package.json b/apps/docs/package.json
index fbec1a9e7..2c71afb8e 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -20,9 +20,9 @@
"swagger-ui-react": "5.6.2"
},
"devDependencies": {
+ "@openstatus/tsconfig": "workspace:*",
"@types/node": "18.11.10",
"@types/swagger-ui-react": "4.18.0",
- "tsconfig": "workspace:*",
"typescript": "5.1.6"
}
}
diff --git a/apps/docs/pages/rest-api/_meta.json b/apps/docs/pages/rest-api/_meta.json
index 0d40d49d2..d49132243 100644
--- a/apps/docs/pages/rest-api/_meta.json
+++ b/apps/docs/pages/rest-api/_meta.json
@@ -1,4 +1,4 @@
{
- "auth": "Auth",
- "openapi": "OpenAPI"
+ "auth": "Auth Token",
+ "openapi": "OpenAPI Specs"
}
\ No newline at end of file
diff --git a/apps/docs/pages/rest-api/auth.mdx b/apps/docs/pages/rest-api/auth.mdx
index 22b6d003f..5e5f7d16d 100644
--- a/apps/docs/pages/rest-api/auth.mdx
+++ b/apps/docs/pages/rest-api/auth.mdx
@@ -1,5 +1,27 @@
import { Callout } from "nextra/components";
-# Authentication
+# Auth Token
-<Callout emoji="🚧">Work in progress</Callout>
+In your Settings, you can create and later revoke your API token. Once created,
+it will be shown only once so keep it save.
+
+On every request to `https://api.openstatus.dev/v1`, you'll have to attach the
+token to the header.
+
+```ts
+const monitors = await fetch(`https://api.openstatus.dev/v1/monitors`, {
+ method: "GET",
+ headers: new Headers({
+ "x-openstatus-key": "os_xxxxxxxxx",
+ }),
+});
+```
+
+Use the above snippet to try it out.
+
+Learn more about [all the endpoints](/rest-api/openapi) we provide.
+
+We currently do not have an SDK to make the best out of it. Any contributions
+are welcome.
+
+The API infrastructure is powered by [Unkey](https://unkey.dev).
diff --git a/apps/docs/pages/rest-api/openapi.mdx b/apps/docs/pages/rest-api/openapi.mdx
index c38be832f..dc8938057 100644
--- a/apps/docs/pages/rest-api/openapi.mdx
+++ b/apps/docs/pages/rest-api/openapi.mdx
@@ -3,7 +3,7 @@ import { Callout } from "nextra/components";
import { useData } from "nextra/data";
export const getStaticProps = async ({ params }) => {
- const res = await fetch("https://api.openstatus.dev/swagger.json");
+ const res = await fetch("https://api.openstatus.dev/openapi");
const spec = await res.json();
return {
props: {
diff --git a/apps/docs/tsconfig.json b/apps/docs/tsconfig.json
index 7ae13fac3..e6bf5bc73 100644
--- a/apps/docs/tsconfig.json
+++ b/apps/docs/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "tsconfig/nextjs.json",
+ "extends": "@openstatus/tsconfig/nextjs.json",
"compilerOptions": {
"baseUrl": ".",
"plugins": [{ "name": "next" }],
diff --git a/apps/server/.env.example b/apps/server/.env.example
new file mode 100644
index 000000000..e6898ad0c
--- /dev/null
+++ b/apps/server/.env.example
@@ -0,0 +1,4 @@
+DATABASE_URL=http://127.0.0.1:8080
+DATABASE_AUTH_TOKEN=
+NODE_ENV=production
+UNKEY_TOKEN=
\ No newline at end of file
diff --git a/apps/server/.gitignore b/apps/server/.gitignore
new file mode 100644
index 000000000..3c3629e64
--- /dev/null
+++ b/apps/server/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/apps/server/Dockerfile b/apps/server/Dockerfile
new file mode 100644
index 000000000..b5fe8f82d
--- /dev/null
+++ b/apps/server/Dockerfile
@@ -0,0 +1,14 @@
+FROM oven/bun
+
+WORKDIR /app
+
+# Copy project
+COPY . .
+
+RUN bun install
+
+EXPOSE 3000
+
+WORKDIR /app/apps/server
+
+CMD ["bun", "start"]
\ No newline at end of file
diff --git a/apps/server/README.md b/apps/server/README.md
new file mode 100644
index 000000000..178a82f43
--- /dev/null
+++ b/apps/server/README.md
@@ -0,0 +1,14 @@
+# OpenStatus Server
+
+## Tech
+
+- Bun
+- HonoJS
+
+## Deploy
+
+From root
+
+```bash
+flyctl deploy --config apps/server/fly.toml --dockerfile apps/server/Dockerfile
+```
diff --git a/apps/server/fly.toml b/apps/server/fly.toml
new file mode 100644
index 000000000..3cdd772e9
--- /dev/null
+++ b/apps/server/fly.toml
@@ -0,0 +1,18 @@
+# fly.toml app configuration file generated for openstatus-api on 2023-09-13T17:29:05+02:00
+#
+# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
+#
+
+app = "openstatus-api"
+primary_region = "ams"
+
+[build]
+ dockerfile = "./Dockerfile"
+
+[http_service]
+ internal_port = 3000
+ force_https = true
+ auto_stop_machines = true
+ auto_start_machines = true
+ min_machines_running = 0
+ processes = ["app"]
diff --git a/apps/server/package.json b/apps/server/package.json
new file mode 100644
index 000000000..aadd02f9c
--- /dev/null
+++ b/apps/server/package.json
@@ -0,0 +1,21 @@
+{
+ "name": "@openstatus/server",
+ "version": "0.0.1",
+ "description": "",
+ "type": "module",
+ "main": "src/index.ts",
+ "scripts": {
+ "dev": "bun run --hot src/index.ts",
+ "start": "bun run src/index.ts"
+ },
+ "dependencies": {
+ "@hono/zod-openapi": "0.4.0",
+ "@openstatus/db": "*",
+ "@openstatus/tinybird": "*",
+ "@unkey/api": "0.6.22",
+ "hono": "3.6.1"
+ },
+ "devDependencies": {
+ "@openstatus/tsconfig": "workspace:*"
+ }
+}
diff --git a/apps/server/src/incident.ts b/apps/server/src/incident.ts
new file mode 100644
index 000000000..4c3650f55
--- /dev/null
+++ b/apps/server/src/incident.ts
@@ -0,0 +1,303 @@
+import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
+
+import { and, db, eq } from "@openstatus/db";
+import {
+ availableStatus,
+ incident,
+ incidentUpdate,
+} from "@openstatus/db/src/schema";
+
+import { ErrorSchema } from "./shared";
+
+const incidentApi = new OpenAPIHono();
+
+const ParamsSchema = z.object({
+ id: z
+ .string()
+ .min(1)
+ .openapi({
+ param: {
+ name: "id",
+ in: "path",
+ },
+ description: "The id of the incident",
+ example: "1",
+ }),
+});
+
+const incidentUpdateSchema = z.object({
+ status: z.enum(availableStatus).openapi({
+ description: "The status of the update",
+ }),
+ date: z.string().openapi({
+ description: "The date of the update in ISO 8601 format",
+ }),
+ message: z.string().openapi({
+ description: "The message of the update",
+ }),
+});
+
+const incidentSchema = z.object({
+ title: z.string().openapi({
+ example: "Documenso",
+ description: "The title of the incident",
+ }),
+ status: z.enum(availableStatus).openapi({
+ description: "The current status of the incident",
+ }),
+});
+
+const getAllRoute = createRoute({
+ method: "get",
+ path: "/",
+ request: {},
+ responses: {
+ 200: {
+ content: {
+ "application/json": {
+ schema: z.array(incidentSchema),
+ },
+ },
+ description: "Get all incidents",
+ },
+ 400: {
+ content: {
+ "application/json": {
+ schema: ErrorSchema,
+ },
+ },
+ description: "Returns an error",
+ },
+ },
+});
+incidentApi.openapi(getAllRoute, async (c) => {
+ const workspaceId = Number(c.req.header("x-workspace-id"));
+
+ const _incidents = await db
+ .select()
+ .from(incident)
+ .where(eq(incident.workspaceId, workspaceId))
+ .all();
+
+ if (!_incidents) return c.jsonT({ code: 404, message: "Not Found" });
+
+ const data = z.array(incidentSchema).parse(_incidents);
+
+ return c.jsonT(data);
+});
+
+const getRoute = createRoute({
+ method: "get",
+ path: "/:id",
+ request: {
+ params: ParamsSchema,
+ },
+ responses: {
+ 200: {
+ content: {
+ "application/json": {
+ schema: incidentSchema,
+ },
+ },
+ description: "Get all incidents",
+ },
+ 400: {
+ content: {
+ "application/json": {
+ schema: ErrorSchema,
+ },
+ },
+ description: "Returns an error",
+ },
+ },
+});
+incidentApi.openapi(getRoute, async (c) => {
+ const workspaceId = Number(c.req.header("x-workspace-id"));
+ const { id } = c.req.valid("param");
+
+ const incidentId = Number(id);
+ const _incident = await db
+ .select()
+ .from(incident)
+ .where(eq(incident.id, incidentId))
+ .get();
+
+ if (!_incident) return c.jsonT({ code: 404, message: "Not Found" });
+
+ if (workspaceId !== _incident.workspaceId)
+ return c.jsonT({ code: 401, message: "Unauthorized" });
+
+ const data = incidentSchema.parse(_incident);
+
+ return c.jsonT(data);
+});
+
+const postRoute = createRoute({
+ method: "post",
+ path: "/",
+ request: {
+ body: {
+ description: "The incident to create",
+ content: {
+ "application/json": {
+ schema: incidentSchema,
+ },
+ },
+ },
+ },
+ responses: {
+ 200: {
+ content: {
+ "application/json": {
+ schema: incidentSchema,
+ },
+ },
+ description: "Create a monitor",
+ },
+ 400: {
+ content: {
+ "application/json": {
+ schema: ErrorSchema,
+ },
+ },
+ description: "Returns an error",
+ },
+ },
+});
+
+incidentApi.openapi(postRoute, async (c) => {
+ const input = c.req.valid("json");
+ const workspaceId = Number(c.req.header("x-workspace-id"));
+
+ const _newIncident = await db
+ .insert(incident)
+ .values({
+ ...input,
+ workspaceId: workspaceId,
+ })
+ .returning()
+ .get();
+
+ const data = incidentSchema.parse(_newIncident);
+
+ return c.jsonT(data);
+});
+
+const deleteRoute = createRoute({
+ method: "delete",
+ path: "/:id",
+ request: {
+ params: ParamsSchema,
+ },
+ responses: {
+ 200: {
+ content: {
+ "application/json": {
+ schema: z.object({
+ message: z.string().openapi({
+ example: "Deleted",
+ }),
+ }),
+ },
+ },
+ description: "Delete the incident",
+ },
+ 400: {
+ content: {
+ "application/json": {
+ schema: ErrorSchema,
+ },
+ },
+ description: "Returns an error",
+ },
+ },
+});
+
+incidentApi.openapi(deleteRoute, async (c) => {
+ const workspaceId = Number(c.req.header("x-workspace-id"));
+ const { id } = c.req.valid("param");
+
+ const incidentId = Number(id);
+ const _incident = await db
+ .select()
+ .from(incident)
+ .where(eq(incident.id, incidentId))
+ .get();
+
+ if (!_incident) return c.jsonT({ code: 404, message: "Not Found" });
+
+ if (workspaceId !== _incident.workspaceId)
+ return c.jsonT({ code: 401, message: "Unauthorized" });
+
+ await db.delete(incident).where(eq(incident.id, incidentId)).run();
+ return c.jsonT({ message: "Deleted" });
+});
+
+const postRouteUpdate = createRoute({
+ method: "post",
+ path: "/:id/update",
+ request: {
+ params: ParamsSchema,
+ body: {
+ description: "The incident to create",
+ content: {
+ "application/json": {
+ schema: incidentUpdateSchema,
+ },
+ },
+ },
+ },
+ responses: {
+ 200: {
+ content: {
+ "application/json": {
+ schema: incidentUpdateSchema,
+ },
+ },
+ description: "Create a monitor",
+ },
+ 400: {
+ content: {
+ "application/json": {
+ schema: ErrorSchema,
+ },
+ },
+ description: "Returns an error",
+ },
+ },
+});
+
+incidentApi.openapi(postRouteUpdate, async (c) => {
+ const input = c.req.valid("json");
+ const { id } = c.req.valid("param");
+ const workspaceId = Number(c.req.header("x-workspace-id"));
+
+ const incidentId = Number(id);
+ const _incident = await db
+ .select()
+ .from(incident)
+ .where(
+ and(eq(incident.id, incidentId), eq(incident.workspaceId, workspaceId)),
+ )
+ .get();
+
+ if (!_incident) return c.jsonT({ code: 401, message: "Not authorized" });
+
+ const _incidentUpdate = await db
+ .insert(incidentUpdate)
+ .values({
+ ...input,
+ date: new Date(input.date),
+ incidentId: Number(id),
+ })
+ .returning()
+ .get();
+
+ const data = incidentUpdateSchema.parse(_incidentUpdate);
+
+ return c.jsonT({
+ ...data,
+ });
+});
+
+export { incidentApi };
diff --git a/apps/server/src/index.ts b/apps/server/src/index.ts
new file mode 100644
index 000000000..50507504d
--- /dev/null
+++ b/apps/server/src/index.ts
@@ -0,0 +1,36 @@
+import { OpenAPIHono } from "@hono/zod-openapi";
+
+import { incidentApi } from "./incident";
+import { middleware } from "./middleware";
+import { monitorApi } from "./monitor";
+import { VercelIngest } from "./vercel";
+
+/**
+ * Base Path "/v1" for our api
+ */
+const app = new OpenAPIHono();
+app.doc("/openapi", {
+ openapi: "3.0.0",
+ info: {
+ version: "1.0.0",
+ title: "OpenStatus API",
+ },
+});
+app.get("/ping", (c) => c.text("pong"));
+
+// Where we ingest data from Vercel
+app.post("/integration/vercel", VercelIngest);
+/**
+ * Authentification Middleware
+ */
+
+app.use("/v1/*", middleware);
+app.route("/v1/monitor", monitorApi);
+app.route("/v1/incident", incidentApi);
+
+if (process.env.NODE_ENV === "development") {
+ app.showRoutes();
+}
+console.log("Starting server on port 3000");
+
+export default app;
diff --git a/apps/server/src/middleware.ts b/apps/server/src/middleware.ts
new file mode 100644
index 000000000..f4d71b75d
--- /dev/null
+++ b/apps/server/src/middleware.ts
@@ -0,0 +1,22 @@
+import { Unkey } from "@unkey/api";
+import type { Context, Env, Next } from "hono";
+
+const unkey = new Unkey({ token: "test-key" });
+
+export async function middleware(c: Context<Env, "/v1/*", {}>, next: Next) {
+ const auth = c.req.header("x-openstatus-key");
+ if (!auth) return c.text("Unauthorized", 401);
+
+ if (process.env.NODE_ENV === "production") {
+ const { error, result } = await unkey.keys.verify({ key: auth });
+
+ if (error) return c.text("Bad Request", 400);
+
+ if (!result.valid) return c.text("Unauthorized", 401);
+
+ c.req.raw.headers.append("x-workspace-id", `${result.ownerId}`);
+ } else {
+ c.req.raw.headers.append("x-workspace-id", "1");
+ }
+ await next();
+}
diff --git a/apps/server/src/monitor.ts b/apps/server/src/monitor.ts
new file mode 100644
index 000000000..f12367bdd
--- /dev/null
+++ b/apps/server/src/monitor.ts
@@ -0,0 +1,407 @@
+import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
+
+import { db, eq } from "@openstatus/db";
+import {
+ availableRegions,
+ METHODS,
+ monitor,
+ periodicity,
+} from "@openstatus/db/src/schema/monitor";
+
+import { ErrorSchema } from "./shared";
+
+const ParamsSchema = z.object({
+ id: z
+ .string()
+ .min(1)
+ .openapi({
+ param: {
+ name: "id",
+ in: "path",
+ },
+ description: "The id of the monitor",
+ example: "1",
+ }),
+});
+
+export const periodicityEnum = z.enum(periodicity);
+export const regionEnum = z
+ .enum(availableRegions)
+ .or(z.literal(""))
+ .transform((val) => (val === "" ? "auto" : val));
+
+const MonitorSchema = z.object({
+ id: z.number().openapi({
+ example: 123,
+ description: "The id of the monitor",
+ }),
+ periodicity: periodicityEnum.openapi({
+ example: "1m",
+ description: "How often the monitor should run",
+ }),
+ url: z.string().url().openapi({
+ example: "https://www.documenso.co",
+ description: "The url to monitor",
+ }),
+ regions: regionEnum.openapi({
+ example: "arn1",
+ description: "The regions to use",
+ }),
+ name: z
+ .string()
+ .openapi({
+ example: "Documenso",
+ description: "The name of the monitor",
+ })
+ .nullable(),
+ description: z
+ .string()
+ .openapi({
+ example: "Documenso website",
+ description: "The description of your monitor",
+ })
+ .nullable(),
+ method: z.enum(METHODS).default("GET").openapi({ example: "GET" }),
+ body: z
+ .preprocess((val) => {
+ return String(val);
+ }, z.string())
+ .default("")
+ .openapi({
+ example: "Hello World",
+ description: "The body",
+ }),
+ headers: z
+ .preprocess(
+ (val) => {
+ if (String(val).length > 0) {
+ return JSON.parse(String(val));
+ } else {
+ return [];
+ }
+ },
+ z.array(z.object({ key: z.string(), value: z.string() })).default([]),
+ )
+ .openapi({
+ description: "The headers of your request",
+ example: [{ key: "x-apikey", value: "supersecrettoken" }],
+ }),
+ active: z
+ .boolean()
+ .default(false)
+ .openapi({ description: "If the monitor is active" }),
+});
+
+const monitorInput = z.object({
+ periodicity: periodicityEnum.openapi({
+ example: "1m",
+ description: "How often the monitor should run",
+ }),
+ url: z.string().url().openapi({
+ example: "https://www.documenso.co",
+ description: "The url to monitor",
+ }),
+ regions: regionEnum
+ .openapi({
+ example: "arn1",
+ description: "The regions to use",
+ })
+ .default("auto"),
+ name: z.string().openapi({
+ example: "Documenso",
+ description: "The name of the monitor",
+ }),
+ description: z.string().openapi({
+ example: "Documenso website",
+ description: "The description of your monitor",
+ }),
+ method: z.enum(METHODS).default("GET").openapi({ example: "GET" }),
+ body: z.string().openapi({
+ example: "Hello World",
+ description: "The body",
+ }),
+ headers: z
+ .preprocess(
+ (val) => {
+ if (String(val).length > 0) {
+ return JSON.parse(String(val));
+ } else {
+ return [];
+ }
+ },
+ z.array(z.object({ key: z.string(), value: z.string() })).default([]),
+ )
+ .openapi({
+ description: "The headers of your request",
+ example: [{ key: "x-apikey", value: "supersecrettoken" }],
+ }),
+});
+
+z.array(z.object({ key: z.string(), value: z.string() }))
+ .default([])
+ .openapi({
+ description: "The headers of your request",
+ example: [{ key: "x-apikey", value: "supersecrettoken" }],
+ })
+ .nullable()
+ .openapi({ description: "the monitor input" });
+
+const monitorApi = new OpenAPIHono();
+
+const getAllRoute = createRoute({
+ method: "get",
+ path: "/",
+ request: {},
+ responses: {
+ 200: {
+ content: {
+ "application/json": {
+ schema: z.array(MonitorSchema),
+ },
+ },
+ description: "Get the monitor",
+ },
+ 400: {
+ content: {
+ "application/json": {
+ schema: ErrorSchema,
+ },
+ },
+ description: "Returns an error",
+ },
+ },
+});
+monitorApi.openapi(getAllRoute, async (c) => {
+ const workspaceId = Number(c.req.header("x-workspace-id"));
+
+ const _monitor = await db
+ .select()
+ .from(monitor)
+ .where(eq(monitor.workspaceId, workspaceId))
+ .all();
+
+ if (!_monitor) return c.jsonT({ code: 404, message: "Not Found" });
+
+ const data = z.array(MonitorSchema).parse(_monitor);
+
+ return c.jsonT(data);
+});
+
+const getRoute = createRoute({
+ method: "get",
+ path: "/:id",
+ request: {
+ params: ParamsSchema,
+ },
+ responses: {
+ 200: {
+ content: {
+ "application/json": {
+ schema: MonitorSchema,
+ },
+ },
+ description: "Get the monitor",
+ },
+ 400: {
+ content: {
+ "application/json": {
+ schema: ErrorSchema,
+ },
+ },
+ description: "Returns an error",
+ },
+ },
+});
+
+monitorApi.openapi(getRoute, async (c) => {
+ const workspaceId = Number(c.req.header("x-workspace-id"));
+ const { id } = c.req.valid("param");
+
+ const monitorId = Number(id);
+ console.log({ monitorId, workspaceId });
+ const _monitor = await db
+ .select()
+ .from(monitor)
+ .where(eq(monitor.id, monitorId))
+ .get();
+
+ if (!_monitor) return c.jsonT({ code: 404, message: "Not Found" });
+
+ if (workspaceId !== _monitor.workspaceId)
+ return c.jsonT({ code: 401, message: "Unauthorized" });
+
+ const data = MonitorSchema.parse(_monitor);
+
+ return c.jsonT(data);
+});
+
+const postRoute = createRoute({
+ method: "post",
+ path: "/",
+ request: {
+ body: {
+ description: "The monitor to create",
+ content: {
+ "application/json": {
+ schema: monitorInput,
+ },
+ },
+ },
+ },
+ responses: {
+ 200: {
+ content: {
+ "application/json": {
+ schema: MonitorSchema,
+ },
+ },
+ description: "Create a monitor",
+ },
+ 400: {
+ content: {
+ "application/json": {
+ schema: ErrorSchema,
+ },
+ },
+ description: "Returns an error",
+ },
+ },
+});
+
+monitorApi.openapi(postRoute, async (c) => {
+ const input = c.req.valid("json");
+ const workspaceId = Number(c.req.header("x-workspace-id"));
+
+ const { headers, ...rest } = input;
+ const _newMonitor = await db
+ .insert(monitor)
+ .values({
+ ...rest,
+ workspaceId: workspaceId,
+ headers: input.headers ? JSON.stringify(input.headers) : undefined,
+ })
+ .returning()
+ .get();
+
+ const data = MonitorSchema.parse(_newMonitor);
+
+ return c.jsonT(data);
+});
+
+const putRoute = createRoute({
+ method: "put",
+ path: "/",
+ request: {
+ params: ParamsSchema,
+ body: {
+ description: "The monitor to update",
+ content: {
+ "application/json": {
+ schema: monitorInput,
+ },
+ },
+ },
+ },
+ responses: {
+ 200: {
+ content: {
+ "application/json": {
+ schema: MonitorSchema,
+ },
+ },
+ description: "Update a monitor",
+ },
+ 400: {
+ content: {
+ "application/json": {
+ schema: ErrorSchema,
+ },
+ },
+ description: "Returns an error",
+ },
+ },
+});
+
+monitorApi.openapi(putRoute, async (c) => {
+ const input = c.req.valid("json");
+ const workspaceId = Number(c.req.header("x-workspace-id"));
+ const { id } = c.req.valid("param");
+
+ if (!id) return c.jsonT({ code: 400, message: "Bad Request" });
+
+ const _monitor = await db
+ .select()
+ .from(monitor)
+ .where(eq(monitor.id, Number(id)))
+ .get();
+
+ if (!_monitor) return c.jsonT({ code: 404, message: "Not Found" });
+
+ if (workspaceId !== _monitor.workspaceId)
+ return c.jsonT({ code: 401, message: "Unauthorized" });
+
+ const { headers, ...rest } = input;
+ const _newMonitor = await db
+ .update(monitor)
+ .set({
+ ...rest,
+ headers: input.headers ? JSON.stringify(input.headers) : undefined,
+ })
+ .returning()
+ .get();
+
+ const data = MonitorSchema.parse(_newMonitor);
+
+ return c.jsonT(data);
+});
+
+const deleteRoute = createRoute({
+ method: "delete",
+ path: "/:id",
+ request: {
+ params: ParamsSchema,
+ },
+ responses: {
+ 200: {
+ content: {
+ "application/json": {
+ schema: z.object({
+ message: z.string().openapi({
+ example: "Deleted",
+ }),
+ }),
+ },
+ },
+ description: "Delete the monitor",
+ },
+ 400: {
+ content: {
+ "application/json": {
+ schema: ErrorSchema,
+ },
+ },
+ description: "Returns an error",
+ },
+ },
+});
+monitorApi.openapi(deleteRoute, async (c) => {
+ const workspaceId = Number(c.req.header("x-workspace-id"));
+ const { id } = c.req.valid("param");
+
+ const monitorId = Number(id);
+ const _monitor = await db
+ .select()
+ .from(monitor)
+ .where(eq(monitor.id, monitorId))
+ .get();
+
+ if (!_monitor) return c.jsonT({ code: 404, message: "Not Found" });
+
+ if (workspaceId !== _monitor.workspaceId)
+ return c.jsonT({ code: 401, message: "Unauthorized" });
+
+ await db.delete(monitor).where(eq(monitor.id, monitorId)).run();
+ return c.jsonT({ message: "Deleted" });
+});
+
+export { monitorApi };
diff --git a/apps/server/src/schema/vercel.ts b/apps/server/src/schema/vercel.ts
new file mode 100644
index 000000000..b1a19b61b
--- /dev/null
+++ b/apps/server/src/schema/vercel.ts
@@ -0,0 +1,46 @@
+import { z } from "zod";
+
+// https://vercel.com/docs/observability/log-drains-overview/log-drains-reference#json-log-drains
+export const logDrainSchema = z.object({
+ id: z.string().optional(),
+ timestamp: z.number().optional(),
+ type: z
+ .enum([
+ "middleware-invocation",
+ "stdout",
+ "stderr",
+ "edge-function-invocation",
+ "fatal",
+ ])
+ .optional(),
+ edgeType: z.enum(["edge-function", "middleware"]).optional(),
+ requestId: z.string().optional(),
+ statusCode: z.number().optional(),
+ message: z.string().optional(),
+ projectId: z.string().optional(),
+ deploymentId: z.string().optional(),
+ buildId: z.string().optional(),
+ source: z.enum(["external", "lambda", "edge", "static", "build"]),
+ host: z.string().optional(),
+ environment: z.string().optional(),
+ branch: z.string().optional(),
+ destination: z.string().optional(),
+ path: z.string().optional(),
+ entrypoint: z.string().optional(),
+ proxy: z
+ .object({
+ timestamp: z.number().optional(),
+ region: z.string().optional(), // TODO: use regions enum?
+ method: z.string().optional(), // TODO: use methods enum?
+ vercelCache: z.string().optional(), // TODO: use "HIT" / "MISS" enum?
+ statusCode: z.number().optional(),
+ path: z.string().optional(),
+ host: z.string().optional(),
+ scheme: z.string().optional(),
+ clientIp: z.string().optional(),
+ userAgent: z.array(z.string()).optional(),
+ })
+ .optional(),
+});
+
+export const logDrainSchemaArray = z.array(logDrainSchema);
diff --git a/apps/server/src/shared.ts b/apps/server/src/shared.ts
new file mode 100644
index 000000000..2177d559e
--- /dev/null
+++ b/apps/server/src/shared.ts
@@ -0,0 +1,10 @@
+import { z } from "@hono/zod-openapi";
+
+export const ErrorSchema = z.object({
+ code: z.number().openapi({
+ example: 400,
+ }),
+ message: z.string().openapi({
+ example: "Bad Request",
+ }),
+});
diff --git a/apps/server/src/vercel.ts b/apps/server/src/vercel.ts
new file mode 100644
index 000000000..9e99fe658
--- /dev/null
+++ b/apps/server/src/vercel.ts
@@ -0,0 +1,35 @@
+import type { Context, Env } from "hono";
+
+import { Tinybird } from "@openstatus/tinybird";
+
+import { logDrainSchema, logDrainSchemaArray } from "./schema/vercel";
+
+const tb = new Tinybird({ token: process.env.TINY_BIRD_API_KEY || "" }); // should we use t3-env?
+
+export function publishVercelLogDrain() {
+ return tb.buildIngestEndpoint({
+ datasource: "vercel_log_drain__v0",
+ event: logDrainSchema,
+ });
+}
+
+export const VercelIngest = async (
+ c: Context<Env, "/integration/vercel", {}>,
+) => {
+ const json = c.req.json();
+ const logDrains = logDrainSchemaArray.safeParse(json);
+
+ if (logDrains.success) {
+ // We are only pushing the logs that are not stdout or stderr
+ const data = logDrains.data.filter(
+ (log) => log.type !== "stdout" && log.type !== "stderr",
+ );
+
+ for (const event of data) {
+ // FIXME: Zod-bird is broken
+ await publishVercelLogDrain()(event);
+ }
+ }
+
+ c.json({ code: "ok" });
+};
diff --git a/apps/server/tsconfig.json b/apps/server/tsconfig.json
new file mode 100644
index 000000000..6d3f6d357
--- /dev/null
+++ b/apps/server/tsconfig.json
@@ -0,0 +1,4 @@
+{
+ "extends": "@openstatus/tsconfig/base.json",
+ "include": ["src", "*.ts", "**/*.ts"]
+}
diff --git a/apps/web/.env.example b/apps/web/.env.example
index 05586dcae..eeebdfd5f 100644
--- a/apps/web/.env.example
+++ b/apps/web/.env.example
@@ -61,4 +61,7 @@ LOG_DRAIN_SECRET=
VERCEL_CLIENT_ID=
VERCEL_CLIENT_SECRET=
VERCEL_REDIRECT_URI=
-AES_KEY=
\ No newline at end of file
+AES_KEY=
+# Unkey
+UNKEY_API_ID=
+UNKEY_TOKEN=
diff --git a/apps/web/package.json b/apps/web/package.json
index 5fae4b2a8..87d67d9cf 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -48,6 +48,7 @@
"@trpc/next": "10.37.1",
"@trpc/react-query": "10.37.1",
"@trpc/server": "10.37.1",
+ "@unkey/api": "0.6.22",
"@upstash/qstash": "0.3.6",
"@upstash/redis": "1.21.0",
"@vercel/analytics": "1.0.1",
@@ -86,6 +87,7 @@
},
"devDependencies": {
"@openstatus/eslint-config": "workspace:*",
+ "@openstatus/tsconfig": "workspace:*",
"@types/luxon": "^3.3.1",
"@types/node": "20.3.1",
"@types/react": "18.2.12",
@@ -96,7 +98,6 @@
"rehype-slug": "5.1.0",
"remark-gfm": "3.0.1",
"tailwindcss": "3.3.2",
- "tsconfig": "workspace:*",
"typescript": "5.1.6",
"unified": "10.1.2"
}
diff --git a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/actions.ts b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/actions.ts
new file mode 100644
index 000000000..109ac630f
--- /dev/null
+++ b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/actions.ts
@@ -0,0 +1,21 @@
+"use server";
+
+import { Unkey } from "@unkey/api";
+
+import { env } from "@/env";
+
+const unkey = new Unkey({ token: env.UNKEY_TOKEN });
+
+export async function create(ownerId: number) {
+ const key = await unkey.keys.create({
+ apiId: env.UNKEY_API_ID,
+ ownerId: String(ownerId),
+ prefix: "os",
+ });
+ return key;
+}
+
+export async function revoke(keyId: string) {
+ const res = await unkey.keys.revoke({ keyId });
+ return res;
+}
diff --git a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/card.tsx b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/card.tsx
new file mode 100644
index 000000000..ad43ed122
--- /dev/null
+++ b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/card.tsx
@@ -0,0 +1,51 @@
+"use server";
+
+import { Unkey } from "@unkey/api";
+
+import { Container } from "@/components/dashboard/container";
+import { env } from "@/env";
+import { formatDate } from "@/lib/utils";
+import { CreateForm } from "./create-form";
+import { RevokeButton } from "./revoke-button.tsx";
+
+const unkey = new Unkey({ token: env.UNKEY_TOKEN });
+
+export async function ApiKeys({ ownerId }: { ownerId: number }) {
+ const data = await unkey.apis.listKeys({
+ apiId: env.UNKEY_API_ID,
+ ownerId: String(ownerId),
+ });
+
+ if (data.error) {
+ return <div>Something went wrong. Please contact us.</div>;
+ }
+
+ return (
+ <Container
+ title="API Token"
+ description="Use our API endpoints to create your monitors programmatically."
+ actions={
+ <>
+ {data.result.keys.length === 1 ? (
+ <RevokeButton keyId={data.result.keys[0].id} />
+ ) : (
+ <CreateForm ownerId={ownerId} />
+ )}
+ </>
+ }
+ >
+ {data.result.keys.length === 1 ? (
+ <dl className="[&_dt]:text-muted-foreground grid gap-2 [&>*]:text-sm [&_dt]:font-light">
+ <div className="flex min-w-0 items-center justify-between gap-3">
+ <dt>Token</dt>
+ <dd className="font-mono">{data.result.keys[0].start}...</dd>
+ </div>
+ <div className="flex min-w-0 items-center justify-between gap-3">
+ <dt>Created At</dt>
+ <dd>{formatDate(new Date(data.result.keys[0].createdAt))}</dd>
+ </div>
+ </dl>
+ ) : null}
+ </Container>
+ );
+}
diff --git a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/create-form.tsx b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/create-form.tsx
new file mode 100644
index 000000000..6ca8a0bb8
--- /dev/null
+++ b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/create-form.tsx
@@ -0,0 +1,93 @@
+"use client";
+
+import * as React from "react";
+import { useRouter } from "next/navigation";
+
+import { Icons } from "@/components/icons";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+} from "@/components/ui/alert-dialog";
+import { useToastAction } from "@/hooks/use-toast-action";
+import { copyToClipboard } from "@/lib/utils";
+import { create } from "./actions";
+import { SubmitButton } from "./submit-button";
+
+export function CreateForm({ ownerId }: { ownerId: number }) {
+ const [rawKey, setRawKey] = React.useState<string | undefined>();
+ const router = useRouter();
+ const [hasCopied, setHasCopied] = React.useState(false);
+ const { toast } = useToastAction();
+
+ React.useEffect(() => {
+ if (hasCopied) {
+ setTimeout(() => {
+ setHasCopied(false);
+ }, 2000);
+ }
+ }, [hasCopied]);
+
+ async function onCreate() {
+ try {
+ const res = await create(ownerId);
+ if (res.result) {
+ setRawKey(res.result.key);
+ }
+ } catch {
+ toast("error");
+ }
+ }
+
+ return (
+ <>
+ <form action={onCreate}>
+ <SubmitButton>Create</SubmitButton>
+ </form>
+ <AlertDialog
+ open={Boolean(rawKey)}
+ onOpenChange={() => setRawKey(undefined)}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Api Key</AlertDialogTitle>
+ <AlertDialogDescription>
+ Please make sure to store the API key safely. You will only be
+ able to see it once. If you forgot to safe it, you will need to
+ revoke and recreate a key.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <div>
+ <button
+ className="group inline-flex items-center p-2"
+ onClick={() => {
+ copyToClipboard(String(rawKey));
+ setHasCopied(true);
+ }}
+ >
+ <span className="font-mono">{rawKey}</span>
+ {!hasCopied ? (
+ <Icons.copy className="ml-2 hidden h-4 w-4 group-hover:block" />
+ ) : (
+ <Icons.check className="ml-2 h-4 w-4" />
+ )}
+ </button>
+ </div>
+ <AlertDialogFooter>
+ <AlertDialogAction
+ onClick={() => {
+ router.refresh();
+ }}
+ >
+ Continue
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </>
+ );
+}
diff --git a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/revoke-button.tsx.tsx b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/revoke-button.tsx.tsx
new file mode 100644
index 000000000..834db367c
--- /dev/null
+++ b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/revoke-button.tsx.tsx
@@ -0,0 +1,70 @@
+"use client";
+
+import * as React from "react";
+import { useRouter } from "next/navigation";
+
+import { LoadingAnimation } from "@/components/loading-animation";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ AlertDialogTrigger,
+} from "@/components/ui/alert-dialog";
+import { Button } from "@/components/ui/button";
+import { useToastAction } from "@/hooks/use-toast-action";
+import { revoke } from "./actions";
+
+export function RevokeButton({ keyId }: { keyId: string }) {
+ const [open, setOpen] = React.useState(false);
+ const [isPending, startTransition] = React.useTransition();
+ const router = useRouter();
+ const { toast } = useToastAction();
+
+ async function onRevoke() {
+ startTransition(async () => {
+ try {
+ await revoke(keyId);
+ router.refresh();
+ setOpen(false);
+ toast("deleted");
+ } catch {
+ toast("error");
+ }
+ });
+ }
+
+ return (
+ <AlertDialog open={open} onOpenChange={(value) => setOpen(value)}>
+ <AlertDialogTrigger asChild>
+ <Button variant="destructive">Revoke</Button>
+ </AlertDialogTrigger>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
+ <AlertDialogDescription>
+ This action cannot be undone. This will permanently revoke the API
+ key.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction
+ onClick={async (e) => {
+ e.preventDefault();
+ await onRevoke();
+ }}
+ className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
+ disabled={isPending}
+ >
+ {!isPending ? "Delete" : <LoadingAnimation />}
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ );
+}
diff --git a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/submit-button.tsx b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/submit-button.tsx
new file mode 100644
index 000000000..514126554
--- /dev/null
+++ b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/api-keys/submit-button.tsx
@@ -0,0 +1,15 @@
+"use client";
+
+import { experimental_useFormStatus as useFormStatus } from "react-dom";
+
+import { LoadingAnimation } from "@/components/loading-animation";
+import { Button } from "@/components/ui/button";
+
+export function SubmitButton({ children }: { children?: React.ReactNode }) {
+ const { pending } = useFormStatus();
+ return (
+ <Button type="submit" disabled={pending} className="disabled:opacity-100">
+ {pending ? <LoadingAnimation /> : children}
+ </Button>
+ );
+}
diff --git a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/customer-portal-button.tsx b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/billing/customer-portal-button.tsx
similarity index 100%
rename from apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/customer-portal-button.tsx
rename to apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/billing/customer-portal-button.tsx
diff --git a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/plan.tsx b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/billing/plan.tsx
similarity index 100%
rename from apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/plan.tsx
rename to apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/_components/billing/plan.tsx
diff --git a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/page.tsx b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/page.tsx
index c083eb0aa..15775879d 100644
--- a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/page.tsx
+++ b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/settings/page.tsx
@@ -2,9 +2,11 @@ import * as React from "react";
import { Header } from "@/components/dashboard/header";
import { Badge } from "@/components/ui/badge";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { api } from "@/trpc/server";
-import { CustomerPortalButton } from "./_components/customer-portal-button";
-import { SettingsPlan } from "./_components/plan";
+import { ApiKeys } from "./_components/api-keys/card";
+import { CustomerPortalButton } from "./_components/billing/customer-portal-button";
+import { SettingsPlan } from "./_components/billing/plan";
export default async function Page({
params,
@@ -24,21 +26,42 @@ export default async function Page({
title="Settings"
description="Your OpenStatus workspace settings."
/>
- <div className="col-span-full grid gap-4">
- <h3 className="text-lg font-medium">Plans</h3>
- <div className="text-muted-foreground flex items-center space-x-2 text-sm">
- Your current plan is{" "}
- <Badge className="ml-2">{data?.plan || "free"}</Badge>
- </div>
- {data?.plan === "pro" ? (
- <div>
- <CustomerPortalButton workspaceSlug={params.workspaceSlug} />
- </div>
- ) : null}
- <SettingsPlan
- workspaceSlug={params.workspaceSlug}
- workspaceData={data}
- />
+ <div className="col-span-full">
+ <Tabs defaultValue="api-key" className="relative mr-auto w-full">
+ <TabsList className="h-9 w-full justify-start rounded-none border-b bg-transparent p-0">
+ <TabsTrigger
+ className="text-muted-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold shadow-none transition-none data-[state=active]:shadow-none"
+ value="api-key"
+ >
+ API Token
+ </TabsTrigger>
+ <TabsTrigger
+ className="text-muted-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold shadow-none transition-none data-[state=active]:shadow-none"
+ value="billing"
+ >
+ Billing
+ </TabsTrigger>
+ </TabsList>
+ <TabsContent value="api-key" className="pt-3">
+ <ApiKeys ownerId={data.id} />
+ </TabsContent>
+ <TabsContent value="billing" className="grid gap-4 pt-3">
+ <h3 className="text-lg font-medium">Plans</h3>
+ <div className="text-muted-foreground flex items-center space-x-2 text-sm">
+ Your current plan is{" "}
+ <Badge className="ml-2">{data?.plan || "free"}</Badge>
+ </div>
+ {data?.plan === "pro" ? (
+ <div>
+ <CustomerPortalButton workspaceSlug={params.workspaceSlug} />
+ </div>
+ ) : null}
+ <SettingsPlan
+ workspaceSlug={params.workspaceSlug}
+ workspaceData={data}
+ />
+ </TabsContent>
+ </Tabs>
</div>
</div>
);
diff --git a/apps/web/src/components/icons.tsx b/apps/web/src/components/icons.tsx
index 03bcaadd3..11da44eee 100644
--- a/apps/web/src/components/icons.tsx
+++ b/apps/web/src/components/icons.tsx
@@ -1,7 +1,9 @@
import {
Activity,
Calendar,
+ Check,
Cog,
+ Copy,
Fingerprint,
Globe,
LayoutDashboard,
@@ -44,6 +46,8 @@ export const Icons = {
twitter: TwitterIcon,
globe: Globe,
plug: Plug,
+ copy: Copy,
+ check: Check,
discord: ({ ...props }: LucideProps) => (
<svg viewBox="0 0 640 512" {...props}>
<path
diff --git a/apps/web/src/env.ts b/apps/web/src/env.ts
index 0550edb12..8e73f60fd 100644
--- a/apps/web/src/env.ts
+++ b/apps/web/src/env.ts
@@ -15,6 +15,8 @@ export const env = createEnv({
QSTASH_NEXT_SIGNING_KEY: z.string().min(1),
QSTASH_TOKEN: z.string().min(1),
STRIPE_WEBHOOK_SECRET_KEY: z.string(),
+ UNKEY_TOKEN: z.string(),
+ UNKEY_API_ID: z.string(),
},
client: {
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().min(1),
@@ -47,5 +49,7 @@ export const env = createEnv({
STRIPE_WEBHOOK_SECRET_KEY: process.env.STRIPE_WEBHOOK_SECRET_KEY,
NEXT_PUBLIC_URL: process.env.NEXT_PUBLIC_URL,
NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
+ UNKEY_TOKEN: process.env.UNKEY_TOKEN,
+ UNKEY_API_ID: process.env.UNKEY_API_ID,
},
});
diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts
index a1cc8a11c..63376a2a0 100644
--- a/apps/web/src/lib/utils.ts
+++ b/apps/web/src/lib/utils.ts
@@ -27,3 +27,7 @@ export const slugify = (str: string) => {
.replace(/ /g, "-")
.replace(/[^\w-]+/g, "");
};
+
+export async function copyToClipboard(value: string) {
+ navigator.clipboard.writeText(value);
+}
diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json
index 1f17f121e..0d85a9d8b 100644
--- a/apps/web/tsconfig.json
+++ b/apps/web/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "tsconfig/nextjs.json",
+ "extends": "@openstatus/tsconfig/nextjs.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
diff --git a/bun.lockb b/bun.lockb
new file mode 100755
index 000000000..87840e3e1
Binary files /dev/null and b/bun.lockb differ
diff --git a/fly.toml b/fly.toml
new file mode 100644
index 000000000..37c323b6c
--- /dev/null
+++ b/fly.toml
@@ -0,0 +1,18 @@
+# fly.toml app configuration file generated for openstatus-api on 2023-09-13T17:29:05+02:00
+#
+# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
+#
+
+app = "openstatus-api"
+primary_region = "ams"
+
+[build]
+ dockerfile = "apps/server/Dockerfile"
+
+[http_service]
+ internal_port = 3000
+ force_https = true
+ auto_stop_machines = true
+ auto_start_machines = true
+ min_machines_running = 0
+ processes = ["app"]
diff --git a/package.json b/package.json
index 238162189..694f63458 100644
--- a/package.json
+++ b/package.json
@@ -31,5 +31,11 @@
"typescript": "5.1.6"
},
"packageManager": "[email protected]",
- "name": "openstatus"
-}
\ No newline at end of file
+ "name": "openstatus",
+ "workspaces": [
+ "apps/*",
+ "packages/*",
+ "packages/config/*",
+ "packages/integrations/*"
+ ]
+}
diff --git a/packages/analytics/package.json b/packages/analytics/package.json
index 206edad43..acfde6841 100644
--- a/packages/analytics/package.json
+++ b/packages/analytics/package.json
@@ -11,7 +11,7 @@
"devDependencies": {
"@types/node": "20.3.1",
"ts-node": "10.9.1",
- "tsconfig": "workspace:^",
+ "@openstatus/tsconfig": "workspace:^",
"typescript": "5.1.6"
},
"scripts": {},
diff --git a/packages/analytics/tsconfig.json b/packages/analytics/tsconfig.json
index 93d5529b5..7f4d9b728 100644
--- a/packages/analytics/tsconfig.json
+++ b/packages/analytics/tsconfig.json
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
- "extends": "tsconfig/base.json",
+ "extends": "@openstatus/tsconfig/base.json",
"exclude": ["dist", "node_modules"],
"compilerOptions": {
"outDir": "dist",
diff --git a/packages/api/package.json b/packages/api/package.json
index 2b0386c37..894f8cd48 100644
--- a/packages/api/package.json
+++ b/packages/api/package.json
@@ -21,7 +21,7 @@
"zod": "3.21.4"
},
"devDependencies": {
- "tsconfig": "workspace:^",
+ "@openstatus/tsconfig": "workspace:^",
"typescript": "5.1.6",
"vitest": "0.34.3"
},
diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json
index b5bdcb868..a8a8c9309 100644
--- a/packages/api/tsconfig.json
+++ b/packages/api/tsconfig.json
@@ -1,4 +1,4 @@
{
- "extends": "tsconfig/nextjs.json",
+ "extends": "@openstatus/tsconfig/nextjs.json",
"include": ["src", "*.ts"]
}
diff --git a/packages/config/eslint/package.json b/packages/config/eslint/package.json
index e1bdd5b78..8477bb250 100644
--- a/packages/config/eslint/package.json
+++ b/packages/config/eslint/package.json
@@ -12,7 +12,6 @@
"eslint-config-turbo": "^1.10.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-react": "7.32.2"
-
},
"devDependencies": {
"eslint": "^8.42.0",
diff --git a/packages/db/package.json b/packages/db/package.json
index e6d59efde..1d8908410 100644
--- a/packages/db/package.json
+++ b/packages/db/package.json
@@ -11,7 +11,7 @@
"seed": "bun src/seed.mts"
},
"dependencies": {
- "@libsql/client": "0.3.1",
+ "@libsql/client": "0.3.4",
"@t3-oss/env-core": "0.6.0",
"dotenv": "16.3.1",
"drizzle-orm": "0.28.6",
@@ -21,7 +21,7 @@
"devDependencies": {
"@types/node": "20.3.1",
"drizzle-kit": "0.19.12",
- "tsconfig": "workspace:^",
+ "@openstatus/tsconfig": "workspace:^",
"typescript": "5.1.6",
"bufferutil": "4.0.7",
"utf-8-validate": "6.0.3",
diff --git a/packages/db/src/schema/monitor.ts b/packages/db/src/schema/monitor.ts
index c4696bc80..5b8264ffa 100644
--- a/packages/db/src/schema/monitor.ts
+++ b/packages/db/src/schema/monitor.ts
@@ -34,6 +34,7 @@ export const availableRegions = [
"syd1",
] as const;
+export const periodicity = ["1m", "5m", "10m", "30m", "1h", "other"] as const;
export const METHODS = ["GET", "POST"] as const;
export const RegionEnum = z.enum(availableRegions);
@@ -107,14 +108,7 @@ export const monitorsToPagesRelation = relations(
}),
);
-export const periodicityEnum = z.enum([
- "1m",
- "5m",
- "10m",
- "30m",
- "1h",
- "other",
-]);
+export const periodicityEnum = z.enum(periodicity);
// Schema for inserting a Monitor - can be used to validate API requests
export const insertMonitorSchema = createInsertSchema(monitor, {
periodicity: periodicityEnum,
diff --git a/packages/db/tsconfig.json b/packages/db/tsconfig.json
index b67b7c670..b5e190444 100644
--- a/packages/db/tsconfig.json
+++ b/packages/db/tsconfig.json
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
- "extends": "tsconfig/base.json",
+ "extends": "@openstatus/tsconfig/base.json",
"exclude": ["dist"],
"compilerOptions": {
"outDir": "dist",
diff --git a/packages/emails/package.json b/packages/emails/package.json
index 7fc04aae9..c9be41c41 100644
--- a/packages/emails/package.json
+++ b/packages/emails/package.json
@@ -24,7 +24,7 @@
"@types/node": "20.3.1",
"@types/react": "18.2.12",
"react": "18.2.0",
- "tsconfig": "workspace:*",
+ "@openstatus/tsconfig": "workspace:*",
"typescript": "5.1.6"
}
}
diff --git a/packages/emails/tsconfig.json b/packages/emails/tsconfig.json
index 778d3b809..30d9c9a84 100644
--- a/packages/emails/tsconfig.json
+++ b/packages/emails/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "tsconfig/react-library.json",
+ "extends": "@openstatus/tsconfig/react-library.json",
"include": [".", "env.ts"],
"exclude": ["dist", "build", "node_modules"]
}
diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json
index a6e475aca..a3de11cf0 100644
--- a/packages/integrations/vercel/package.json
+++ b/packages/integrations/vercel/package.json
@@ -15,7 +15,7 @@
"@types/react": "18.2.12",
"@types/react-dom": "18.2.5",
"next": "13.4.12",
- "tsconfig": "workspace:*",
+ "@openstatus/tsconfig": "workspace:*",
"typescript": "5.1.6"
}
}
diff --git a/packages/integrations/vercel/tsconfig.json b/packages/integrations/vercel/tsconfig.json
index b5bdcb868..a8a8c9309 100644
--- a/packages/integrations/vercel/tsconfig.json
+++ b/packages/integrations/vercel/tsconfig.json
@@ -1,4 +1,4 @@
{
- "extends": "tsconfig/nextjs.json",
+ "extends": "@openstatus/tsconfig/nextjs.json",
"include": ["src", "*.ts"]
}
diff --git a/packages/plans/package.json b/packages/plans/package.json
index 0040105de..0a4e04321 100644
--- a/packages/plans/package.json
+++ b/packages/plans/package.json
@@ -11,7 +11,7 @@
"zod": "3.21.4"
},
"devDependencies": {
- "tsconfig": "workspace:^",
+ "@openstatus/tsconfig": "workspace:^",
"typescript": "5.1.6"
},
"keywords": [],
diff --git a/packages/plans/tsconfig.json b/packages/plans/tsconfig.json
index ad13119bd..aed15c74a 100644
--- a/packages/plans/tsconfig.json
+++ b/packages/plans/tsconfig.json
@@ -1,4 +1,4 @@
{
- "extends": "tsconfig/base.json",
+ "extends": "@openstatus/tsconfig/base.json",
"include": ["src", "*.ts"]
}
diff --git a/packages/tinybird/package.json b/packages/tinybird/package.json
index 41669bcd3..157965edf 100644
--- a/packages/tinybird/package.json
+++ b/packages/tinybird/package.json
@@ -10,6 +10,6 @@
"devDependencies": {
"@types/node": "20.3.1",
"typescript": "5.1.6",
- "tsconfig": "workspace:*"
+ "@openstatus/tsconfig": "workspace:*"
}
}
diff --git a/packages/tinybird/src/client.ts b/packages/tinybird/src/client.ts
index 7ccb18070..6c88f64ee 100644
--- a/packages/tinybird/src/client.ts
+++ b/packages/tinybird/src/client.ts
@@ -1,4 +1,4 @@
-import type { Tinybird } from "@chronark/zod-bird";
+import { Tinybird } from "@chronark/zod-bird";
import {
tbBuildMonitorList,
@@ -9,7 +9,7 @@ import {
} from "./validation";
// REMINDER:
-// const tb = new Tinybird({ token: process.env.TINYBIRD_TOKEN! });
+const tb = new Tinybird({ token: process.env.TINYBIRD_TOKEN! });
export function publishPingResponse(tb: Tinybird) {
return tb.buildIngestEndpoint({
diff --git a/packages/tinybird/tsconfig.json b/packages/tinybird/tsconfig.json
index 520249593..7a576ad27 100644
--- a/packages/tinybird/tsconfig.json
+++ b/packages/tinybird/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "tsconfig/base.json",
+ "extends": "@openstatus/tsconfig/base.json",
"exclude": ["node_modules"],
"compilerOptions": {
"esModuleInterop": true,
diff --git a/packages/tsconfig/package.json b/packages/tsconfig/package.json
index 6efb83e14..f66782bc5 100644
--- a/packages/tsconfig/package.json
+++ b/packages/tsconfig/package.json
@@ -1,5 +1,5 @@
{
- "name": "tsconfig",
+ "name": "@openstatus/tsconfig",
"version": "0.0.0",
"private": true,
"license": "MIT",
diff --git a/packages/ui/package.json b/packages/ui/package.json
index f5aa3dd72..2cbaecc9e 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -14,7 +14,7 @@
"eslint": "8.45.0",
"@openstatus/eslint-config": "workspace:*",
"react": "18.2.0",
- "tsconfig": "workspace:*",
+ "@openstatus/tsconfig": "workspace:*",
"typescript": "5.1.6"
}
}
diff --git a/packages/ui/tsconfig.json b/packages/ui/tsconfig.json
index cd6c94d6e..b2d8b4bef 100644
--- a/packages/ui/tsconfig.json
+++ b/packages/ui/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "tsconfig/react-library.json",
+ "extends": "@openstatus/tsconfig/react-library.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}
diff --git a/packages/upstash/package.json b/packages/upstash/package.json
index 2980dd884..4d11f95e6 100644
--- a/packages/upstash/package.json
+++ b/packages/upstash/package.json
@@ -11,7 +11,7 @@
},
"devDependencies": {
"@types/node": "20.3.1",
- "tsconfig": "workspace:*",
+ "@openstatus/tsconfig": "workspace:*",
"tsup": "7.1.0",
"typescript": "5.1.6"
}
diff --git a/packages/upstash/tsconfig.json b/packages/upstash/tsconfig.json
index 520249593..7a576ad27 100644
--- a/packages/upstash/tsconfig.json
+++ b/packages/upstash/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "tsconfig/base.json",
+ "extends": "@openstatus/tsconfig/base.json",
"exclude": ["node_modules"],
"compilerOptions": {
"esModuleInterop": true,
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index fdbab364c..3cd33f19a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -25,7 +25,7 @@ importers:
version: link:packages/config/eslint
'@turbo/gen':
specifier: 1.10.9
- version: 1.10.9(@types/[email protected])([email protected])
+ version: 1.10.9(@types/[email protected])([email protected])
eslint:
specifier: 8.43.0
version: 8.43.0
@@ -42,43 +42,6 @@ importers:
specifier: 5.1.6
version: 5.1.6
- apps/api:
- dependencies:
- '@openstatus/db':
- specifier: workspace:^
- version: link:../../packages/db
- next:
- specifier: 13.4.12
- next-swagger-doc:
- specifier: 0.4.0
- react:
- specifier: 18.2.0
- version: 18.2.0
- react-dom:
- specifier: 18.2.0
- version: 18.2.0([email protected])
- zod:
- specifier: 3.21.4
- version: 3.21.4
- devDependencies:
- '@types/node':
- specifier: 20.5.9
- version: 20.5.9
- '@types/react':
- specifier: 18.2.12
- version: 18.2.12
- '@types/react-dom':
- specifier: 18.2.5
- version: 18.2.5
- tsconfig:
- specifier: workspace:*
- version: link:../../packages/tsconfig
- typescript:
- specifier: 5.1.6
- version: 5.1.6
-
apps/docs:
dependencies:
'@vercel/analytics':
@@ -103,19 +66,41 @@ importers:
specifier: 5.6.2
devDependencies:
+ '@openstatus/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
'@types/node':
specifier: 18.11.10
version: 18.11.10
'@types/swagger-ui-react':
specifier: 4.18.0
version: 4.18.0
- tsconfig:
- specifier: workspace:*
- version: link:../../packages/tsconfig
typescript:
specifier: 5.1.6
version: 5.1.6
+ apps/server:
+ dependencies:
+ '@hono/zod-openapi':
+ specifier: 0.4.0
+ '@openstatus/db':
+ specifier: '*'
+ version: link:../../packages/db
+ '@openstatus/tinybird':
+ specifier: '*'
+ version: link:../../packages/tinybird
+ '@unkey/api':
+ specifier: 0.6.22
+ version: 0.6.22
+ hono:
+ specifier: 3.6.1
+ version: 3.6.1
+ devDependencies:
+ '@openstatus/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+
apps/web:
dependencies:
'@clerk/nextjs':
@@ -232,6 +217,9 @@ importers:
'@trpc/server':
specifier: 10.37.1
version: 10.37.1
+ '@unkey/api':
+ specifier: 0.6.22
+ version: 0.6.22
'@upstash/qstash':
specifier: 0.3.6
version: 0.3.6
@@ -341,6 +329,9 @@ importers:
'@openstatus/eslint-config':
specifier: workspace:*
version: link:../../packages/config/eslint
+ '@openstatus/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
'@types/luxon':
specifier: ^3.3.1
version: 3.3.1
@@ -371,9 +362,6 @@ importers:
tailwindcss:
specifier: 3.3.2
version: 3.3.2
- tsconfig:
- specifier: workspace:*
- version: link:../../packages/tsconfig
typescript:
specifier: 5.1.6
version: 5.1.6
@@ -393,15 +381,15 @@ importers:
specifier: 3.21.4
version: 3.21.4
devDependencies:
+ '@openstatus/tsconfig':
+ specifier: workspace:^
+ version: link:../tsconfig
'@types/node':
specifier: 20.3.1
version: 20.3.1
ts-node:
specifier: 10.9.1
version: 10.9.1(@types/[email protected])([email protected])
- tsconfig:
- specifier: workspace:^
- version: link:../tsconfig
typescript:
specifier: 5.1.6
version: 5.1.6
@@ -445,7 +433,7 @@ importers:
specifier: 3.21.4
version: 3.21.4
devDependencies:
- tsconfig:
+ '@openstatus/tsconfig':
specifier: workspace:^
version: link:../tsconfig
typescript:
@@ -492,8 +480,8 @@ importers:
packages/db:
dependencies:
'@libsql/client':
- specifier: 0.3.1
+ specifier: 0.3.4
'@t3-oss/env-core':
specifier: 0.6.0
@@ -502,7 +490,7 @@ importers:
version: 16.3.1
drizzle-orm:
specifier: 0.28.6
- version: 0.28.6(@libsql/[email protected])
+ version: 0.28.6(@libsql/[email protected])
drizzle-zod:
specifier: 0.5.1
@@ -510,6 +498,9 @@ importers:
specifier: 3.21.4
version: 3.21.4
devDependencies:
+ '@openstatus/tsconfig':
+ specifier: workspace:^
+ version: link:../tsconfig
'@types/node':
specifier: 20.3.1
version: 20.3.1
@@ -525,9 +516,6 @@ importers:
ts-node:
specifier: 10.9.1
version: 10.9.1(@types/[email protected])([email protected])
- tsconfig:
- specifier: workspace:^
- version: link:../tsconfig
typescript:
specifier: 5.1.6
version: 5.1.6
@@ -565,6 +553,9 @@ importers:
specifier: 3.21.4
version: 3.21.4
devDependencies:
+ '@openstatus/tsconfig':
+ specifier: workspace:*
+ version: link:../tsconfig
'@types/node':
specifier: 20.3.1
version: 20.3.1
@@ -574,9 +565,6 @@ importers:
react:
specifier: 18.2.0
version: 18.2.0
- tsconfig:
- specifier: workspace:*
- version: link:../tsconfig
typescript:
specifier: 5.1.6
version: 5.1.6
@@ -599,6 +587,9 @@ importers:
specifier: ^3.21.4
version: 3.21.4
devDependencies:
+ '@openstatus/tsconfig':
+ specifier: workspace:*
+ version: link:../../tsconfig
'@types/node':
specifier: 20.3.1
version: 20.3.1
@@ -611,9 +602,6 @@ importers:
next:
specifier: 13.4.12
- tsconfig:
- specifier: workspace:*
- version: link:../../tsconfig
typescript:
specifier: 5.1.6
version: 5.1.6
@@ -627,7 +615,7 @@ importers:
specifier: 3.21.4
version: 3.21.4
devDependencies:
- tsconfig:
+ '@openstatus/tsconfig':
specifier: workspace:^
version: link:../tsconfig
typescript:
@@ -643,12 +631,12 @@ importers:
specifier: 3.21.4
version: 3.21.4
devDependencies:
+ '@openstatus/tsconfig':
+ specifier: workspace:*
+ version: link:../tsconfig
'@types/node':
specifier: 20.3.1
version: 20.3.1
- tsconfig:
- specifier: workspace:*
- version: link:../tsconfig
typescript:
specifier: 5.1.6
version: 5.1.6
@@ -660,6 +648,9 @@ importers:
'@openstatus/eslint-config':
specifier: workspace:*
version: link:../config/eslint
+ '@openstatus/tsconfig':
+ specifier: workspace:*
+ version: link:../tsconfig
'@types/react':
specifier: 18.2.16
version: 18.2.16
@@ -672,9 +663,6 @@ importers:
react:
specifier: 18.2.0
version: 18.2.0
- tsconfig:
- specifier: workspace:*
- version: link:../tsconfig
typescript:
specifier: 5.1.6
version: 5.1.6
@@ -694,12 +682,12 @@ importers:
specifier: 1.22.0
version: 1.22.0
devDependencies:
+ '@openstatus/tsconfig':
+ specifier: workspace:*
+ version: link:../tsconfig
'@types/node':
specifier: 20.3.1
version: 20.3.1
- tsconfig:
- specifier: workspace:*
- version: link:../tsconfig
tsup:
specifier: 7.1.0
version: 7.1.0([email protected])
@@ -772,36 +760,13 @@ packages:
resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==}
dev: false
- /@apidevtools/[email protected]:
- resolution: {integrity: sha512-r1w81DpR+KyRWd3f+rk6TNqMgedmAxZP5v5KWlXQWlgMUUtyEJch0DKEci1SorPMiSeM8XPl7MZ3miJ60JIpQg==}
- dependencies:
- '@jsdevtools/ono': 7.1.3
- '@types/json-schema': 7.0.12
- call-me-maybe: 1.0.2
- js-yaml: 4.1.0
- dev: false
-
- /@apidevtools/[email protected]:
- resolution: {integrity: sha512-Zc1AlqrJlX3SlpupFGpiLi2EbteyP7fXmUOGup6/DnkRgjP9bgMM/ag+n91rsv0U1Gpz0H3VILA/o3bW7Ua6BQ==}
- engines: {node: '>=10'}
- dev: false
-
- /@apidevtools/[email protected]:
- resolution: {integrity: sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==}
- dev: false
-
- resolution: {integrity: sha512-sNiLY51vZOmSPFZA5TF35KZ2HbgYklQnTSDnkghamzLb3EkNtcQnrBQEj5AOCxHpTtXpqMCRM1CrmV2rG6nw4g==}
+ resolution: {integrity: sha512-d5HwrvM6dOKr3XdeF+DmashGvfEc+1oiEfbscugsiwSTrFtuMa7ETpW9sTNnVgn+hJaz+PRxPQUYD7q9/5dUig==}
peerDependencies:
- openapi-types: '>=7'
+ zod: ^3.20.2
dependencies:
- '@apidevtools/json-schema-ref-parser': 9.1.2
- '@apidevtools/openapi-schemas': 2.1.0
- '@apidevtools/swagger-methods': 3.0.2
- '@jsdevtools/ono': 7.1.3
- call-me-maybe: 1.0.2
- openapi-types: 12.1.3
- z-schema: 5.0.5
+ openapi3-ts: 4.1.2
+ zod: 3.21.4
dev: false
@@ -2195,6 +2160,29 @@ packages:
react-dom: 18.2.0([email protected])
dev: false
+ resolution: {integrity: sha512-tyHXZMnfDAojLYeW+QxTaBGGkc/XaUvvfrJzuSPcCSu8LA+AjneGzzNYUKKB/rrJnrfBb+MkZYXlhb5/lmYxjQ==}
+ engines: {node: '>=16.0.0'}
+ peerDependencies:
+ hono: '*'
+ zod: 3.*
+ dependencies:
+ '@asteasolutions/zod-to-openapi': 5.5.0([email protected])
+ '@hono/zod-validator': 0.1.8([email protected])([email protected])
+ hono: 3.6.1
+ zod: 3.21.4
+ dev: false
+
+ resolution: {integrity: sha512-/Kd/p/dUVKM7/1TY3jafTV+ngwEh3fOLmXCJQKb9esWsCom5WOJaNmZYv8jeRhyipu1xBvmN5jceRA3Ev3rmQw==}
+ peerDependencies:
+ hono: 3.*
+ zod: ^3.19.1
+ dependencies:
+ hono: 3.6.1
+ zod: 3.21.4
+ dev: false
+
resolution: {integrity: sha512-tS16bAUkqjITNSvbJuO1x7MXbn7Oe8ZziDTJdA9mMvsoYthnOOiznOTGBYwbdlYBgU+tgpI/BtTU3paRbCuSlg==}
peerDependencies:
@@ -2336,15 +2324,11 @@ packages:
tslib: 2.6.1
dev: false
- /@jsdevtools/[email protected]:
- resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==}
- dev: false
-
- resolution: {integrity: sha512-43/zF8fJguXd6ENwYhddpbR05bDVx3BQQUZ/BsJ0b4zLJge+WFa2smC3ILVGqvVu4ZoixbC0sfLTdVPdd2NjDA==}
+ resolution: {integrity: sha512-b1rpCzm02oQuh1zM1UKdKxhClyMMlgyFagcmsuGTve/AQxubO/FaRgoKXTcGaOqoRjymE1qf0sQM2UoyPvu3lA==}
dependencies:
- '@libsql/hrana-client': 0.4.4([email protected])([email protected])([email protected])
- better-sqlite3: 8.5.0
+ '@libsql/hrana-client': 0.5.2([email protected])([email protected])([email protected])
+ better-sqlite3: 8.6.0
js-base64: 3.7.5
transitivePeerDependencies:
- bufferutil
@@ -2352,11 +2336,11 @@ packages:
- utf-8-validate
dev: false
- resolution: {integrity: sha512-BevUg0UBRLs5AEqn0fjrMcl49xCtwuFavgK4MzCb3PTtxpEbQ24oGXctspN9drBiUVmqSZr7go887aiLLzSO3A==}
+ resolution: {integrity: sha512-0hVKUClh29Pb0bIIwqssfDH1nrsKO5SaBTfclIZ1d0W/rBBDsV6mBKx3FhQuULYu/5u0/gJcHdmdiA1SFIOXdQ==}
dependencies:
- '@libsql/isomorphic-fetch': 0.1.6([email protected])
- '@libsql/isomorphic-ws': 0.1.3([email protected])([email protected])
+ '@libsql/isomorphic-fetch': 0.1.7([email protected])
+ '@libsql/isomorphic-ws': 0.1.5([email protected])([email protected])
js-base64: 3.7.5
transitivePeerDependencies:
- bufferutil
@@ -2364,8 +2348,8 @@ packages:
- utf-8-validate
dev: false
- resolution: {integrity: sha512-8qhxEDmVBDb54E9xdW1xqw3zLNShkMZpf5YQU3PvwjtKNLOPde59Oqez+RnZHsYkt9zQxxOF+7gSHVJeP/UWqg==}
+ resolution: {integrity: sha512-/lSsPe0WTHn2SDTPbgbjUY2iF0C3Adtcwu7cajTe+3YtcxsV36u7L37/hmJIQQG8vuM/TCUu4TWb+ym/299aOg==}
dependencies:
'@types/node-fetch': 2.6.4
node-fetch: 2.6.12([email protected])
@@ -2373,8 +2357,8 @@ packages:
- encoding
dev: false
- resolution: {integrity: sha512-54dZXgYwWDKsnfWv8GCVYvhn6RDlqFDGAc8EQMd941yvGMsGzo06Gn6Iyjw//nJ1iJO97FbXgoQ1apikoFD/WA==}
+ resolution: {integrity: sha512-DtLWIH29onUYR00i0GlQ3UdcTRC6EP4u9w/h9LxpUZJWRMARk6dQwZ6Jkd+QdwVpuAOrdxt18v0K2uIYR3fwFg==}
dependencies:
'@types/ws': 8.5.5
@@ -2453,7 +2437,7 @@ packages:
react: '>=16'
dependencies:
'@types/mdx': 2.0.5
- '@types/react': 18.2.16
+ '@types/react': 18.2.21
react: 18.2.0
dev: false
@@ -2575,6 +2559,7 @@ packages:
resolution: {integrity: sha512-RmHanbV21saP/6OEPBJ7yJMuys68cIf8OBBWd7+uj40LdpmswVAwe1uzeuFyUsd6SfeITWT3XnQfn6wULeKwDQ==}
+ dev: true
resolution: {integrity: sha512-FsAT5x0jF2kkhNkKkukhsyYOrRqtSxrEhfliniIq0bwWbuXLgyt3Gv0Ml+b91XwjwArmuP7NxCiGd++GGKdNMQ==}
@@ -2592,6 +2577,7 @@ packages:
cpu: [arm64]
os: [darwin]
requiresBuild: true
+ dev: true
optional: true
@@ -2609,6 +2595,7 @@ packages:
cpu: [x64]
os: [darwin]
requiresBuild: true
+ dev: true
optional: true
@@ -2626,6 +2613,7 @@ packages:
cpu: [arm64]
os: [linux]
requiresBuild: true
+ dev: true
optional: true
@@ -2643,6 +2631,7 @@ packages:
cpu: [arm64]
os: [linux]
requiresBuild: true
+ dev: true
optional: true
@@ -2660,6 +2649,7 @@ packages:
cpu: [x64]
os: [linux]
requiresBuild: true
+ dev: true
optional: true
@@ -2677,6 +2667,7 @@ packages:
cpu: [x64]
os: [linux]
requiresBuild: true
+ dev: true
optional: true
@@ -2694,6 +2685,7 @@ packages:
cpu: [arm64]
os: [win32]
requiresBuild: true
+ dev: true
optional: true
@@ -2711,6 +2703,7 @@ packages:
cpu: [ia32]
os: [win32]
requiresBuild: true
+ dev: true
optional: true
@@ -2728,6 +2721,7 @@ packages:
cpu: [x64]
os: [win32]
requiresBuild: true
+ dev: true
optional: true
@@ -5201,7 +5195,7 @@ packages:
resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==}
dev: true
resolution: {integrity: sha512-EQdg4NqN032+o2Wgj9lg49puijGc4tbgKjGjDOi8+rN/RqE9CUKxKtrfaTGdDjfdC1Uy8FaaKk7y1zYK3zIojg==}
hasBin: true
dependencies:
@@ -5212,7 +5206,7 @@ packages:
minimatch: 9.0.3
node-plop: 0.26.3
semver: 7.5.4
- ts-node: 10.9.1(@types/[email protected])([email protected])
+ ts-node: 10.9.1(@types/[email protected])([email protected])
update-check: 1.5.4
validate-npm-package-name: 5.0.0
transitivePeerDependencies:
@@ -5333,7 +5327,7 @@ packages:
resolution: {integrity: sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==}
dependencies:
- '@types/react': 18.2.16
+ '@types/react': 18.2.21
hoist-non-react-statics: 3.3.2
dev: false
@@ -5489,12 +5483,12 @@ packages:
resolution: {integrity: sha512-sRQsOS/sCLnpQhR4DSKGTtWFE3FZjpQa86KPVbhUqdYMRZ9FEFcfAytKhR/vUG2rH1oFbOOej6cuD7MFSobDRQ==}
dependencies:
- '@types/react': 18.2.16
+ '@types/react': 18.2.21
resolution: {integrity: sha512-GRaAEriuT4zp9N4p1i8BDBYmEyfo+xQ3yHjJU4eiK5NDa1RmUZG+unZABUTK4/Ox/M+GaHwb6Ow8rUITrtjszA==}
dependencies:
- '@types/react': 18.2.16
+ '@types/react': 18.2.21
dev: true
@@ -5510,6 +5504,14 @@ packages:
'@types/prop-types': 15.7.5
'@types/scheduler': 0.16.3
csstype: 3.1.2
+ dev: true
+
+ resolution: {integrity: sha512-neFKG/sBAwGxHgXiIxnbm3/AAVQ/cMRS93hvBpg8xYRbeQSPVABp9U2bRnPf0iI4+Ucdv3plSxKK+3CW2ENJxA==}
+ dependencies:
+ '@types/prop-types': 15.7.5
+ '@types/scheduler': 0.16.3
+ csstype: 3.1.2
resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
@@ -5541,14 +5543,10 @@ packages:
resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==}
dev: false
- resolution: {integrity: sha512-+MUpcbyxD528dECUBCEVm6abNuORdbuGjbrUdHDeAQ+rkPuo2a+L4N02WJHF3bonSSE6SJ3dUJwF2V6+cHnf0w==}
- dev: false
-
resolution: {integrity: sha512-XtvFXmj46Zibe89tFQwSQknrq1NxEtOep2rZuxth7K88tyPEP00FnoA6H7ATYhocAEA4XUWaNHNFWFRl1KX8aQ==}
dependencies:
- '@types/react': 18.2.16
+ '@types/react': 18.2.21
dev: true
@@ -5718,6 +5716,10 @@ packages:
eslint-visitor-keys: 3.4.1
dev: false
+ resolution: {integrity: sha512-RcWr1/BuTAobx0fhbvKLuYTIDgmu7pvYqABWKhwHYpkwQg6wy+pWo5CBMsN5L30E9cd0RlM9TYiHuAdb1tk1iw==}
+ dev: false
+
/@upstash/[email protected]:
resolution: {integrity: sha512-cpPSR0XJAJs4Ddz9nq3tINlPS5aLfWVCqhhtHnXt4p7qr5+/Znlt1Es736poB/9rnl1hAHrOsOvVj46NEXcVqA==}
engines: {node: '>=16.0.0'}
@@ -6161,8 +6163,8 @@ packages:
resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==}
dev: false
- resolution: {integrity: sha512-vbPcv/Hx5WYdyNg/NbcfyaBZyv9s/NVbxb7yCeC5Bq1pVocNxeL2tZmSu3Rlm4IEOTjYdGyzWQgyx0OSdORBzw==}
+ resolution: {integrity: sha512-jwAudeiTMTSyby+/SfbHDebShbmC2MCH8mU2+DXi0WJfv13ypEJm47cd3kljmy/H130CazEvkf2Li//ewcMJ1g==}
requiresBuild: true
dependencies:
bindings: 1.5.0
@@ -6308,10 +6310,6 @@ packages:
get-intrinsic: 1.2.1
dev: false
- resolution: {integrity: sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==}
- dev: false
-
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
engines: {node: '>=6'}
@@ -6521,13 +6519,6 @@ packages:
engines: {node: '>=6'}
dev: true
- resolution: {integrity: sha512-MngIC2izcCz07iRKr3Pe8Z6ZBv4zbKFl/YnQEN/aMHis6PpH+MxI2e6n0bMUAmSVlMoAyQkdBCSTbfDmtcSovQ==}
- dependencies:
- terminal-columns: 1.4.1
- type-flag: 3.0.0
- dev: false
-
resolution: {integrity: sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==}
engines: {node: '>=0.10'}
@@ -6654,11 +6645,6 @@ packages:
engines: {node: '>= 6'}
dev: false
- resolution: {integrity: sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==}
- engines: {node: '>= 6'}
- dev: false
-
resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==}
engines: {node: '>= 10'}
@@ -6677,6 +6663,7 @@ packages:
resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==}
engines: {node: ^12.20.0 || >=14}
+ dev: true
resolution: {integrity: sha512-SsxdiOf064DWoZLH799Ata6u7iV658A11PlWtZATDlXPpKGJnbJZ5Z24ybixAi+LUUqJ/GKowAejtC5GFUG7Tw==}
@@ -7491,7 +7478,7 @@ packages:
- supports-color
dev: true
resolution: {integrity: sha512-yBe+F9htrlYER7uXgDJUQsTHFoIrI5yMm5A0bg0GiZ/kY5jNXTWoEy4KQtg35cE27sw1VbgzoMWHAgCckUUUww==}
peerDependencies:
'@aws-sdk/client-rds-data': '>=3'
@@ -7553,7 +7540,7 @@ packages:
sqlite3:
optional: true
dependencies:
dev: false
@@ -7562,7 +7549,7 @@ packages:
drizzle-orm: '>=0.23.13'
zod: '*'
dependencies:
- drizzle-orm: 0.28.6(@libsql/[email protected])
+ drizzle-orm: 0.28.6(@libsql/[email protected])
zod: 3.21.4
dev: false
@@ -9159,6 +9146,11 @@ packages:
react-is: 16.13.1
dev: false
+ resolution: {integrity: sha512-FaWXh0MSc2Hv2IrGI4vFvZEK69NHfggEgHUlNMXp2zrpKh23j7wS0Ku316Do9CFAl07OBNozBelcvruiBT8crQ==}
+ engines: {node: '>=16.0.0'}
+ dev: false
+
resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==}
dev: false
@@ -10084,10 +10076,6 @@ packages:
resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==}
- resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==}
- dev: false
-
resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==}
dev: false
@@ -10095,10 +10083,6 @@ packages:
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
- resolution: {integrity: sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==}
- dev: false
-
resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==}
dev: true
@@ -11053,22 +11037,6 @@ packages:
react-dom: 18.2.0([email protected])
dev: false
- resolution: {integrity: sha512-5Wt19Av4tOHVdXPJ7xTVvDJuiWuP5OYnY13BSq5SIjMtktFfhX4/9yZyaMCXImbUECu26PALn9CpRQRplIXJ3w==}
- engines: {node: '>=12'}
- hasBin: true
- peerDependencies:
- next: '>=9'
- dependencies:
- '@types/swagger-jsdoc': 6.0.1
- cleye: 1.3.2
- isarray: 2.0.5
- swagger-jsdoc: 6.2.8([email protected])
- transitivePeerDependencies:
- - openapi-types
- dev: false
-
resolution: {integrity: sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==}
peerDependencies:
@@ -11126,6 +11094,7 @@ packages:
transitivePeerDependencies:
- '@babel/core'
- babel-plugin-macros
+ dev: true
resolution: {integrity: sha512-HuPSzzAbJ1T4BD8e0bs6B9C1kWQ6gv8ykZoRWs5AQoiIuqbGHHdQO7Ljuvg05Q0Z24E2ABozHe6FxDvI6HfyAw==}
@@ -11470,8 +11439,10 @@ packages:
is-wsl: 2.2.0
dev: false
- resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==}
+ resolution: {integrity: sha512-B7gOkwsYMZO7BZXwJzXCuVagym2xhqsrilVvV0dnq2Di4+iLUXKVX9gOK23ZqaAHZOwABXN0QTdW8QnkUTX6DA==}
+ dependencies:
+ yaml: 2.3.1
dev: false
@@ -13465,30 +13436,6 @@ packages:
- encoding
dev: false
- resolution: {integrity: sha512-VPvil1+JRpmJ55CgAtn8DIcpBs0bL5L3q5bVQvF4tAW/k/9JYSj7dCpaYCAv5rufe0vcCbBRQXGvzpkWjvLklQ==}
- engines: {node: '>=12.0.0'}
- hasBin: true
- dependencies:
- commander: 6.2.0
- doctrine: 3.0.0
- glob: 7.1.6
- lodash.mergewith: 4.6.2
- swagger-parser: 10.0.3([email protected])
- yaml: 2.0.0-1
- transitivePeerDependencies:
- - openapi-types
- dev: false
-
- resolution: {integrity: sha512-nF7oMeL4KypldrQhac8RyHerJeGPD1p2xDh900GPvc+Nk7nWP6jX2FcC7WmkinMoAmoO774+AFXcWsW8gMWEIg==}
- engines: {node: '>=10'}
- dependencies:
- '@apidevtools/swagger-parser': 10.0.3([email protected])
- transitivePeerDependencies:
- - openapi-types
- dev: false
-
resolution: {integrity: sha512-UBjk84s+bu7KZ0vt4sU/R6Ej43Kf4prt9RRKFG+Bu1R4JQTNDXwlKz/+fsC2G98kxZDTkOrZKWnlJrHTSKGq7Q==}
peerDependencies:
@@ -13669,10 +13616,6 @@ packages:
readable-stream: 3.6.2
dev: false
- resolution: {integrity: sha512-IKVL/itiMy947XWVv4IHV7a0KQXvKjj4ptbi7Ew9MPMcOLzkiQeyx3Gyvh62hKrfJ0RZc4M1nbhzjNM39Kyujw==}
- dev: false
-
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
@@ -13904,37 +13847,6 @@ packages:
yn: 3.1.1
dev: true
- resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
- hasBin: true
- peerDependencies:
- '@swc/core': '>=1.2.50'
- '@swc/wasm': '>=1.2.50'
- '@types/node': '*'
- typescript: '>=2.7'
- peerDependenciesMeta:
- '@swc/core':
- optional: true
- '@swc/wasm':
- optional: true
- dependencies:
- '@cspotcode/source-map-support': 0.8.1
- '@tsconfig/node10': 1.0.9
- '@tsconfig/node12': 1.0.11
- '@tsconfig/node14': 1.0.3
- '@tsconfig/node16': 1.0.4
- '@types/node': 20.5.9
- acorn: 8.10.0
- acorn-walk: 8.2.0
- arg: 4.1.3
- create-require: 1.1.1
- diff: 4.0.2
- make-error: 1.3.6
- typescript: 5.1.6
- v8-compile-cache-lib: 3.0.1
- yn: 3.1.1
- dev: true
-
resolution: {integrity: sha512-pefrkcd4lmIVR0LA49Imjf9DYLK8vtWhqBPA3Ya1ir8xCW0O2yjL9dsCVvI7pCodLC5q7smNpEtDR2yVulQxOg==}
dev: false
@@ -14134,10 +14046,6 @@ packages:
engines: {node: '>=14.16'}
dev: false
- resolution: {integrity: sha512-3YaYwMseXCAhBB14RXW5cRQfJQlEknS6i4C8fCfeUdS3ihG9EdccdR9kt3vP73ZdeTGmPb4bZtkDn5XMIn1DLA==}
- dev: false
-
resolution: {integrity: sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==}
dev: true
@@ -14527,11 +14435,6 @@ packages:
builtins: 5.0.1
dev: true
- resolution: {integrity: sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==}
- engines: {node: '>= 0.10'}
- dev: false
-
resolution: {integrity: sha512-YF23YMyASIIJXpktBa4vIGLJ5Gs88UB/XePgqPmTa7cDA+JeO3yclbpheQYCHjVHBn/yePzrXuygIL+xbvRYHw==}
dependencies:
@@ -14921,11 +14824,6 @@ packages:
engines: {node: '>= 6'}
dev: false
- resolution: {integrity: sha512-W7h5dEhywMKenDJh2iX/LABkbFnBxasD27oyXWDS/feDsxiw0dD5ncXdYXgkvAsXIY2MpW/ZKkr9IU30DBdMNQ==}
- engines: {node: '>= 6'}
- dev: false
-
resolution: {integrity: sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==}
engines: {node: '>= 14'}
@@ -14962,18 +14860,6 @@ packages:
engines: {node: '>=12.20'}
dev: true
- resolution: {integrity: sha512-D7eujBWkLa3p2sIpJA0d1pr7es+a7m0vFAnZLlCEKq/Ij2k0MLi9Br2UPxoxdYystm5K1yeBGzub0FlYUEWj2Q==}
- engines: {node: '>=8.0.0'}
- hasBin: true
- dependencies:
- lodash.get: 4.4.2
- lodash.isequal: 4.5.0
- validator: 13.11.0
- optionalDependencies:
- commander: 9.5.0
- dev: false
-
resolution: {integrity: sha512-jEA1znR7b4C/NnaycInCU6h/d15ZzCd1jmsruqOKnZP6WXQSMH3W2GL+OXbkruslU4h+Tzuos0HdswzRUk/Vgg==}
dev: false