feat(custom-widgets): add extensible widget platform

This commit is contained in:
ajnart committed 2026-09-12 13:54:05 +02:00
1 parent 6cca757493
commit 8f152f1929
317 files changed
+32326 -1788

No files matched your search

@@ -0,0 +1,75 @@
CREATE TABLE `custom_widget_activity` (
`id` varchar(128) NOT NULL,
`installation_id` varchar(128) NOT NULL,
`item_id` varchar(128),
`user_id` varchar(128),
`handler` varchar(128) NOT NULL,
`status` varchar(128) NOT NULL,
`created_at` timestamp NOT NULL,
CONSTRAINT `custom_widget_activity_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `custom_widget_artifact` (
`id` varchar(128) NOT NULL,
`package_id` varchar(128) NOT NULL,
`version` varchar(128) NOT NULL,
`source` longtext NOT NULL,
`artifact` longtext NOT NULL,
`created_at` timestamp NOT NULL,
CONSTRAINT `custom_widget_artifact_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `custom_widget_connection` (
`id` varchar(128) NOT NULL,
`name` varchar(128) NOT NULL,
`integration_id` varchar(128),
`configuration` longtext NOT NULL,
`encrypted_secrets` longtext NOT NULL,
`created_at` timestamp NOT NULL,
`updated_at` timestamp NOT NULL,
CONSTRAINT `custom_widget_connection_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `custom_widget_guest_grant` (
`id` varchar(128) NOT NULL,
`item_id` varchar(128) NOT NULL,
`handler` varchar(128) NOT NULL,
`artifact_digest` varchar(128) NOT NULL,
`bindings_digest` varchar(128) NOT NULL,
`allowed_inputs` longtext NOT NULL,
`created_at` timestamp NOT NULL,
CONSTRAINT `custom_widget_guest_grant_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `custom_widget_installation` (
`id` varchar(128) NOT NULL,
`name` varchar(128) NOT NULL,
`draft` longtext NOT NULL,
`active_artifact_id` varchar(128),
`previous_artifact_id` varchar(128),
`previous_snapshot` longtext,
`bindings` longtext NOT NULL,
`origin` longtext,
`enabled` boolean NOT NULL DEFAULT false,
`creator_id` varchar(128),
`created_at` timestamp NOT NULL,
`updated_at` timestamp NOT NULL,
CONSTRAINT `custom_widget_installation_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `custom_widget_storage` (
`id` varchar(128) NOT NULL,
`installation_id` varchar(128) NOT NULL,
`scope` varchar(128) NOT NULL,
`owner_key` varchar(128) NOT NULL,
`key` varchar(128) NOT NULL,
`value` longtext NOT NULL,
`updated_at` timestamp NOT NULL,
CONSTRAINT `custom_widget_storage_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
ALTER TABLE `custom_widget_activity` ADD CONSTRAINT `custom_widget_activity_installation_fk` FOREIGN KEY (`installation_id`) REFERENCES `custom_widget_installation`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE `custom_widget_connection` ADD CONSTRAINT `custom_widget_connection_integration_id_integration_id_fk` FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE `custom_widget_guest_grant` ADD CONSTRAINT `custom_widget_guest_grant_item_id_item_id_fk` FOREIGN KEY (`item_id`) REFERENCES `item`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE `custom_widget_installation` ADD CONSTRAINT `custom_widget_installation_creator_id_user_id_fk` FOREIGN KEY (`creator_id`) REFERENCES `user`(`id`) ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE `custom_widget_storage` ADD CONSTRAINT `custom_widget_storage_installation_fk` FOREIGN KEY (`installation_id`) REFERENCES `custom_widget_installation`(`id`) ON DELETE cascade ON UPDATE no action;
File diff suppressed because it is too large. Load diff
@@ -351,6 +351,13 @@
"when": 1788763848931,
"tag": "0049_add_byte_unit_system",
"breakpoints": true
},
{
"idx": 50,
"version": "5",
"when": 1789201372182,
"tag": "0050_custom_widget_platform",
"breakpoints": true
}
]
}
}
@@ -0,0 +1,69 @@
CREATE TABLE "custom_widget_activity" (
"id" varchar(128) PRIMARY KEY NOT NULL,
"installation_id" varchar(128) NOT NULL,
"item_id" varchar(128),
"user_id" varchar(128),
"handler" varchar(128) NOT NULL,
"status" varchar(128) NOT NULL,
"created_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "custom_widget_artifact" (
"id" varchar(128) PRIMARY KEY NOT NULL,
"package_id" varchar(128) NOT NULL,
"version" varchar(128) NOT NULL,
"source" text NOT NULL,
"artifact" text NOT NULL,
"created_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "custom_widget_connection" (
"id" varchar(128) PRIMARY KEY NOT NULL,
"name" varchar(128) NOT NULL,
"integration_id" varchar(128),
"configuration" text NOT NULL,
"encrypted_secrets" text NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "custom_widget_guest_grant" (
"id" varchar(128) PRIMARY KEY NOT NULL,
"item_id" varchar(128) NOT NULL,
"handler" varchar(128) NOT NULL,
"artifact_digest" varchar(128) NOT NULL,
"bindings_digest" varchar(128) NOT NULL,
"allowed_inputs" text NOT NULL,
"created_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "custom_widget_installation" (
"id" varchar(128) PRIMARY KEY NOT NULL,
"name" varchar(128) NOT NULL,
"draft" text NOT NULL,
"active_artifact_id" varchar(128),
"previous_artifact_id" varchar(128),
"previous_snapshot" text,
"bindings" text NOT NULL,
"origin" text,
"enabled" boolean DEFAULT false NOT NULL,
"creator_id" varchar(128),
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "custom_widget_storage" (
"id" varchar(128) PRIMARY KEY NOT NULL,
"installation_id" varchar(128) NOT NULL,
"scope" varchar(128) NOT NULL,
"owner_key" varchar(128) NOT NULL,
"key" varchar(128) NOT NULL,
"value" text NOT NULL,
"updated_at" timestamp NOT NULL
);
--> statement-breakpoint
ALTER TABLE "custom_widget_activity" ADD CONSTRAINT "custom_widget_activity_installation_fk" FOREIGN KEY ("installation_id") REFERENCES "public"."custom_widget_installation"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "custom_widget_connection" ADD CONSTRAINT "custom_widget_connection_integration_id_integration_id_fk" FOREIGN KEY ("integration_id") REFERENCES "public"."integration"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "custom_widget_guest_grant" ADD CONSTRAINT "custom_widget_guest_grant_item_id_item_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."item"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "custom_widget_installation" ADD CONSTRAINT "custom_widget_installation_creator_id_user_id_fk" FOREIGN KEY ("creator_id") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "custom_widget_storage" ADD CONSTRAINT "custom_widget_storage_installation_fk" FOREIGN KEY ("installation_id") REFERENCES "public"."custom_widget_installation"("id") ON DELETE cascade ON UPDATE no action;
File diff suppressed because it is too large. Load diff
@@ -113,6 +113,13 @@
"when": 1788763848932,
"tag": "0015_add_byte_unit_system",
"breakpoints": true
},
{
"idx": 16,
"version": "7",
"when": 1789201372200,
"tag": "0016_custom_widget_platform",
"breakpoints": true
}
]
}
}
@@ -0,0 +1,68 @@
CREATE TABLE `custom_widget_activity` (
`id` text PRIMARY KEY NOT NULL,
`installation_id` text NOT NULL,
`item_id` text,
`user_id` text,
`handler` text NOT NULL,
`status` text NOT NULL,
`created_at` integer NOT NULL,
FOREIGN KEY (`installation_id`) REFERENCES `custom_widget_installation`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `custom_widget_artifact` (
`id` text PRIMARY KEY NOT NULL,
`package_id` text NOT NULL,
`version` text NOT NULL,
`source` text NOT NULL,
`artifact` text NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE `custom_widget_connection` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`integration_id` text,
`configuration` text NOT NULL,
`encrypted_secrets` text NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
CREATE TABLE `custom_widget_guest_grant` (
`id` text PRIMARY KEY NOT NULL,
`item_id` text NOT NULL,
`handler` text NOT NULL,
`artifact_digest` text NOT NULL,
`bindings_digest` text NOT NULL,
`allowed_inputs` text NOT NULL,
`created_at` integer NOT NULL,
FOREIGN KEY (`item_id`) REFERENCES `item`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `custom_widget_installation` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`draft` text NOT NULL,
`active_artifact_id` text,
`previous_artifact_id` text,
`previous_snapshot` text,
`bindings` text NOT NULL,
`origin` text,
`enabled` integer DEFAULT false NOT NULL,
`creator_id` text,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`creator_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
CREATE TABLE `custom_widget_storage` (
`id` text PRIMARY KEY NOT NULL,
`installation_id` text NOT NULL,
`scope` text NOT NULL,
`owner_key` text NOT NULL,
`key` text NOT NULL,
`value` text NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`installation_id`) REFERENCES `custom_widget_installation`(`id`) ON UPDATE no action ON DELETE cascade
);
File diff suppressed because it is too large. Load diff
@@ -337,6 +337,13 @@
"when": 1788763848930,
"tag": "0047_add_byte_unit_system",
"breakpoints": true
},
{
"idx": 48,
"version": "6",
"when": 1789201372190,
"tag": "0048_custom_widget_platform",
"breakpoints": true
}
]
}
}
+6
View File
@@ -53,6 +53,12 @@ export const {
trustedCertificateHostnames,
cronJobConfigurations,
customWidgetDefinitions,
customWidgetArtifacts,
customWidgetInstallations,
customWidgetConnections,
customWidgetStorage,
customWidgetGuestGrants,
customWidgetActivity,
customWidgetSecrets,
legacyCustomWidgetDefinitions,
legacyCustomWidgetSecrets,
+87
View File
@@ -10,6 +10,7 @@ import {
index,
int,
mediumtext,
longtext,
mysqlTable,
primaryKey,
smallint,
@@ -628,6 +629,92 @@ export const legacyCustomWidgetSecrets = mysqlTable(
}),
);
export const customWidgetArtifacts = mysqlTable("custom_widget_artifact", {
id: varchar({ length: 128 }).notNull().primaryKey(),
packageId: varchar({ length: 128 }).notNull(),
version: varchar({ length: 128 }).notNull(),
source: longtext().notNull(),
artifact: longtext().notNull(),
createdAt: timestamp().notNull(),
});
export const customWidgetInstallations = mysqlTable("custom_widget_installation", {
id: varchar({ length: 128 }).notNull().primaryKey(),
name: varchar({ length: 128 }).notNull(),
draft: longtext().notNull(),
activeArtifactId: varchar({ length: 128 }),
previousArtifactId: varchar({ length: 128 }),
previousSnapshot: longtext(),
bindings: longtext().notNull(),
origin: longtext(),
enabled: boolean().notNull().default(false),
creatorId: varchar({ length: 128 }).references(() => users.id, { onDelete: "set null" }),
createdAt: timestamp().notNull(),
updatedAt: timestamp().notNull(),
});
export const customWidgetConnections = mysqlTable("custom_widget_connection", {
id: varchar({ length: 128 }).notNull().primaryKey(),
name: varchar({ length: 128 }).notNull(),
integrationId: varchar({ length: 128 }).references(() => integrations.id, { onDelete: "set null" }),
configuration: longtext().notNull(),
encryptedSecrets: longtext().notNull(),
createdAt: timestamp().notNull(),
updatedAt: timestamp().notNull(),
});
export const customWidgetStorage = mysqlTable(
"custom_widget_storage",
{
id: varchar({ length: 128 }).notNull().primaryKey(),
installationId: varchar({ length: 128 }).notNull(),
scope: varchar({ length: 128 }).notNull(),
ownerKey: varchar({ length: 128 }).notNull(),
key: varchar({ length: 128 }).notNull(),
value: longtext().notNull(),
updatedAt: timestamp().notNull(),
},
(table) => ({
installationFk: foreignKey({
columns: [table.installationId],
foreignColumns: [customWidgetInstallations.id],
name: "custom_widget_storage_installation_fk",
}).onDelete("cascade"),
}),
);
export const customWidgetGuestGrants = mysqlTable("custom_widget_guest_grant", {
id: varchar({ length: 128 }).notNull().primaryKey(),
itemId: varchar({ length: 128 })
.notNull()
.references(() => items.id, { onDelete: "cascade" }),
handler: varchar({ length: 128 }).notNull(),
artifactDigest: varchar({ length: 128 }).notNull(),
bindingsDigest: varchar({ length: 128 }).notNull(),
allowedInputs: longtext().notNull(),
createdAt: timestamp().notNull(),
});
export const customWidgetActivity = mysqlTable(
"custom_widget_activity",
{
id: varchar({ length: 128 }).notNull().primaryKey(),
installationId: varchar({ length: 128 }).notNull(),
itemId: varchar({ length: 128 }),
userId: varchar({ length: 128 }),
handler: varchar({ length: 128 }).notNull(),
status: varchar({ length: 128 }).notNull(),
createdAt: timestamp().notNull(),
},
(table) => ({
installationFk: foreignKey({
columns: [table.installationId],
foreignColumns: [customWidgetInstallations.id],
name: "custom_widget_activity_installation_fk",
}).onDelete("cascade"),
}),
);
export const customWidgetDefinitions = mysqlTable("custom_widget_v2_definition", {
id: varchar({ length: 64 }).notNull().primaryKey(),
name: varchar({ length: 256 }).notNull(),
+86
View File
@@ -624,6 +624,92 @@ export const legacyCustomWidgetSecrets = pgTable(
}),
);
export const customWidgetArtifacts = pgTable("custom_widget_artifact", {
id: varchar({ length: 128 }).notNull().primaryKey(),
packageId: varchar({ length: 128 }).notNull(),
version: varchar({ length: 128 }).notNull(),
source: text().notNull(),
artifact: text().notNull(),
createdAt: timestamp().notNull(),
});
export const customWidgetInstallations = pgTable("custom_widget_installation", {
id: varchar({ length: 128 }).notNull().primaryKey(),
name: varchar({ length: 128 }).notNull(),
draft: text().notNull(),
activeArtifactId: varchar({ length: 128 }),
previousArtifactId: varchar({ length: 128 }),
previousSnapshot: text(),
bindings: text().notNull(),
origin: text(),
enabled: boolean().notNull().default(false),
creatorId: varchar({ length: 128 }).references(() => users.id, { onDelete: "set null" }),
createdAt: timestamp().notNull(),
updatedAt: timestamp().notNull(),
});
export const customWidgetConnections = pgTable("custom_widget_connection", {
id: varchar({ length: 128 }).notNull().primaryKey(),
name: varchar({ length: 128 }).notNull(),
integrationId: varchar({ length: 128 }).references(() => integrations.id, { onDelete: "set null" }),
configuration: text().notNull(),
encryptedSecrets: text().notNull(),
createdAt: timestamp().notNull(),
updatedAt: timestamp().notNull(),
});
export const customWidgetStorage = pgTable(
"custom_widget_storage",
{
id: varchar({ length: 128 }).notNull().primaryKey(),
installationId: varchar({ length: 128 }).notNull(),
scope: varchar({ length: 128 }).notNull(),
ownerKey: varchar({ length: 128 }).notNull(),
key: varchar({ length: 128 }).notNull(),
value: text().notNull(),
updatedAt: timestamp().notNull(),
},
(table) => ({
installationFk: foreignKey({
columns: [table.installationId],
foreignColumns: [customWidgetInstallations.id],
name: "custom_widget_storage_installation_fk",
}).onDelete("cascade"),
}),
);
export const customWidgetGuestGrants = pgTable("custom_widget_guest_grant", {
id: varchar({ length: 128 }).notNull().primaryKey(),
itemId: varchar({ length: 128 })
.notNull()
.references(() => items.id, { onDelete: "cascade" }),
handler: varchar({ length: 128 }).notNull(),
artifactDigest: varchar({ length: 128 }).notNull(),
bindingsDigest: varchar({ length: 128 }).notNull(),
allowedInputs: text().notNull(),
createdAt: timestamp().notNull(),
});
export const customWidgetActivity = pgTable(
"custom_widget_activity",
{
id: varchar({ length: 128 }).notNull().primaryKey(),
installationId: varchar({ length: 128 }).notNull(),
itemId: varchar({ length: 128 }),
userId: varchar({ length: 128 }),
handler: varchar({ length: 128 }).notNull(),
status: varchar({ length: 128 }).notNull(),
createdAt: timestamp().notNull(),
},
(table) => ({
installationFk: foreignKey({
columns: [table.installationId],
foreignColumns: [customWidgetInstallations.id],
name: "custom_widget_activity_installation_fk",
}).onDelete("cascade"),
}),
);
export const customWidgetDefinitions = pgTable("custom_widget_v2_definition", {
id: varchar({ length: 64 }).notNull().primaryKey(),
name: varchar({ length: 256 }).notNull(),
+64
View File
@@ -621,6 +621,70 @@ export const legacyCustomWidgetSecrets = sqliteTable(
}),
);
export const customWidgetArtifacts = sqliteTable("custom_widget_artifact", {
id: text().notNull().primaryKey(),
packageId: text().notNull(),
version: text().notNull(),
source: text().notNull(),
artifact: text().notNull(),
createdAt: int({ mode: "timestamp" }).notNull(),
});
export const customWidgetInstallations = sqliteTable("custom_widget_installation", {
id: text().notNull().primaryKey(),
name: text().notNull(),
draft: text().notNull(),
activeArtifactId: text(),
previousArtifactId: text(),
previousSnapshot: text(),
bindings: text().notNull(),
origin: text(),
enabled: int({ mode: "boolean" }).notNull().default(false),
creatorId: text().references(() => users.id, { onDelete: "set null" }),
createdAt: int({ mode: "timestamp" }).notNull(),
updatedAt: int({ mode: "timestamp" }).notNull(),
});
export const customWidgetConnections = sqliteTable("custom_widget_connection", {
id: text().notNull().primaryKey(),
name: text().notNull(),
integrationId: text().references(() => integrations.id, { onDelete: "set null" }),
configuration: text().notNull(),
encryptedSecrets: text().notNull(),
createdAt: int({ mode: "timestamp" }).notNull(),
updatedAt: int({ mode: "timestamp" }).notNull(),
});
export const customWidgetStorage = sqliteTable("custom_widget_storage", {
id: text().notNull().primaryKey(),
installationId: text().notNull().references(() => customWidgetInstallations.id, { onDelete: "cascade" }),
scope: text().notNull(),
ownerKey: text().notNull(),
key: text().notNull(),
value: text().notNull(),
updatedAt: int({ mode: "timestamp" }).notNull(),
});
export const customWidgetGuestGrants = sqliteTable("custom_widget_guest_grant", {
id: text().notNull().primaryKey(),
itemId: text().notNull().references(() => items.id, { onDelete: "cascade" }),
handler: text().notNull(),
artifactDigest: text().notNull(),
bindingsDigest: text().notNull(),
allowedInputs: text().notNull(),
createdAt: int({ mode: "timestamp" }).notNull(),
});
export const customWidgetActivity = sqliteTable("custom_widget_activity", {
id: text().notNull().primaryKey(),
installationId: text().notNull().references(() => customWidgetInstallations.id, { onDelete: "cascade" }),
itemId: text(),
userId: text(),
handler: text().notNull(),
status: text().notNull(),
createdAt: int({ mode: "timestamp" }).notNull(),
});
export const customWidgetDefinitions = sqliteTable("custom_widget_v2_definition", {
id: text().notNull().primaryKey(),
name: text().notNull(),