Skip to content

Commit

Permalink
Various Fixes: Websocket heartbeat, historical request sorting, et al (
Browse files Browse the repository at this point in the history
…#400)

* Add honc-telegram-bot example

* Create canary

* Try removing possibly erroneous code

* Revert "Try removing possibly erroneous code"

This reverts commit 4bfb9fb.

* Fix heartbeat responses for realtime service

* Fix issue where body was not set properly for history entries with non-matching-routes

* Bump api/package.json

* Fix sorting of proxiedRequestResponse records, fix db updated_at fields, and implement a response for telegram bot

* Improve date normalizer

* Add migration to fix timestamps

* Remove mizulogs from db

* Update timestamps to be iso8601

* Update telegram bot readme

* Explicitly specify biome verison in honc-code-gen to prevent ci issues

* Update honc-code-gen to have a specific verison of biome

* Update canary changelog

* Remove unused webhonc utility

* Update api/package.json

* Refactor api db schema to use common timestamps definition

* Format

* Slim down telegram example

* Avoid runtime errors when sorting ProxiedRequestResponse items

* Warn when unrecognized timestamps
  • Loading branch information
brettimus authored Dec 11, 2024
1 parent 07c4a09 commit 43684e9
Show file tree
Hide file tree
Showing 25 changed files with 1,888 additions and 76 deletions.
18 changes: 18 additions & 0 deletions api/drizzle/0019_charming_hulk.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_app_requests` (
`id` integer PRIMARY KEY NOT NULL,
`request_method` text NOT NULL,
`request_url` text NOT NULL,
`request_headers` text,
`request_query_params` text,
`request_path_params` text,
`request_body` text,
`request_route` text,
`created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
`updated_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL
);
--> statement-breakpoint
INSERT INTO `__new_app_requests`("id", "request_method", "request_url", "request_headers", "request_query_params", "request_path_params", "request_body", "request_route", "created_at", "updated_at") SELECT "id", "request_method", "request_url", "request_headers", "request_query_params", "request_path_params", "request_body", "request_route", "created_at", "updated_at" FROM `app_requests`;--> statement-breakpoint
DROP TABLE `app_requests`;--> statement-breakpoint
ALTER TABLE `__new_app_requests` RENAME TO `app_requests`;--> statement-breakpoint
PRAGMA foreign_keys=ON;
22 changes: 22 additions & 0 deletions api/drizzle/0020_misty_siren.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
DROP TABLE `mizu_logs`;--> statement-breakpoint
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_app_responses` (
`id` integer PRIMARY KEY NOT NULL,
`trace_id` text NOT NULL,
`response_status_code` integer,
`response_time` integer,
`response_headers` text,
`response_body` text,
`failure_reason` text,
`failure_details` text,
`is_failure` integer DEFAULT false,
`created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
`updated_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
`request_id` integer,
FOREIGN KEY (`request_id`) REFERENCES `app_requests`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
INSERT INTO `__new_app_responses`("id", "trace_id", "response_status_code", "response_time", "response_headers", "response_body", "failure_reason", "failure_details", "is_failure", "created_at", "updated_at", "request_id") SELECT "id", "trace_id", "response_status_code", "response_time", "response_headers", "response_body", "failure_reason", "failure_details", "is_failure", "created_at", "updated_at", "request_id" FROM `app_responses`;--> statement-breakpoint
DROP TABLE `app_responses`;--> statement-breakpoint
ALTER TABLE `__new_app_responses` RENAME TO `app_responses`;--> statement-breakpoint
PRAGMA foreign_keys=ON;
35 changes: 35 additions & 0 deletions api/drizzle/0021_woozy_inhumans.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_ai_request_logs` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`log` text NOT NULL,
`created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL
);
--> statement-breakpoint
INSERT INTO `__new_ai_request_logs`("id", "log", "created_at") SELECT "id", "log", "created_at" FROM `ai_request_logs`;--> statement-breakpoint
DROP TABLE `ai_request_logs`;--> statement-breakpoint
ALTER TABLE `__new_ai_request_logs` RENAME TO `ai_request_logs`;--> statement-breakpoint
PRAGMA foreign_keys=ON;--> statement-breakpoint
CREATE TABLE `__new_settings` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`key` text NOT NULL,
`value` text DEFAULT '' NOT NULL,
`created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
`updated_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL
);
--> statement-breakpoint
INSERT INTO `__new_settings`("id", "key", "value", "created_at", "updated_at") SELECT "id", "key", "value", "created_at", "updated_at" FROM `settings`;--> statement-breakpoint
DROP TABLE `settings`;--> statement-breakpoint
ALTER TABLE `__new_settings` RENAME TO `settings`;--> statement-breakpoint
CREATE UNIQUE INDEX `settings_key_unique` ON `settings` (`key`);--> statement-breakpoint
CREATE TABLE `__new_tokens` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`value` text NOT NULL,
`expires_at` text,
`created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
`updated_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL
);
--> statement-breakpoint
INSERT INTO `__new_tokens`("id", "value", "expires_at", "created_at", "updated_at") SELECT "id", "value", "expires_at", "created_at", "updated_at" FROM `tokens`;--> statement-breakpoint
DROP TABLE `tokens`;--> statement-breakpoint
ALTER TABLE `__new_tokens` RENAME TO `tokens`;--> statement-breakpoint
CREATE UNIQUE INDEX `tokens_value_unique` ON `tokens` (`value`);
Loading

0 comments on commit 43684e9

Please sign in to comment.