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

+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(),