fix: resolve widget platform CI lint and formatting failures
This commit is contained in:
1 parent
9ff1019a3d
commit
a29ec26c27
12 files changed
+248
-100
No files matched your search
@@ -8,7 +8,11 @@ import type {
|
||||
WidgetCollectionContents,
|
||||
WidgetCollectionManifest,
|
||||
} from "@homarr/custom-widgets/package";
|
||||
import { getWidgetConnectionBindingNames, getWidgetConnectionRequirement, isWidgetConnectionCompatible } from "@homarr/custom-widgets/package";
|
||||
import {
|
||||
getWidgetConnectionBindingNames,
|
||||
getWidgetConnectionRequirement,
|
||||
isWidgetConnectionCompatible,
|
||||
} from "@homarr/custom-widgets/package";
|
||||
import { createWidgetCollectionArchive, validateWidgetCollectionArchive } from "@homarr/custom-widgets/package/server";
|
||||
|
||||
import { withWidgetArtifactReferenceLock } from "./artifact-references";
|
||||
@@ -145,8 +149,16 @@ export async function exportWidgetCollection(ctx: PackageContext, manifest: Widg
|
||||
const bindings = parseBindings(row.bindings);
|
||||
const mapping: Record<string, string> = {};
|
||||
for (const [name, requirement] of Object.entries(source.connections)) {
|
||||
const members = getWidgetConnectionBindingNames(name, requirement, bindings).map((key) => bindings[key]).toSorted();
|
||||
const identity = JSON.stringify([requirement.kind, requirement.serviceType, requirement.integrationKind, requirement.multiple, members.length ? members : [id, name]]);
|
||||
const members = getWidgetConnectionBindingNames(name, requirement, bindings)
|
||||
.map((key) => bindings[key])
|
||||
.toSorted();
|
||||
const identity = JSON.stringify([
|
||||
requirement.kind,
|
||||
requirement.serviceType,
|
||||
requirement.integrationKind,
|
||||
requirement.multiple,
|
||||
members.length ? members : [id, name],
|
||||
]);
|
||||
let slot = shared.get(identity);
|
||||
if (!slot) {
|
||||
slot = `connection${shared.size + 1}`;
|
||||
|
||||
@@ -6,7 +6,13 @@ import { constructIntegrationPermissions } from "@homarr/auth/shared";
|
||||
import { decryptSecret } from "@homarr/common/server";
|
||||
import { createId } from "@homarr/common";
|
||||
import { eq, inArray } from "@homarr/db";
|
||||
import { customWidgetConnections, groupMembers, integrationGroupPermissions, integrations, integrationUserPermissions } from "@homarr/db/schema";
|
||||
import {
|
||||
customWidgetConnections,
|
||||
groupMembers,
|
||||
integrationGroupPermissions,
|
||||
integrations,
|
||||
integrationUserPermissions,
|
||||
} from "@homarr/db/schema";
|
||||
import type { WidgetSdkInvocation } from "@homarr/custom-widgets/package/server";
|
||||
|
||||
import { readPackageHistory, widgetHistoryInputSchema } from "./history";
|
||||
@@ -69,7 +75,9 @@ export function createWidgetSdkBridge(
|
||||
return {
|
||||
options: resolved.configuration,
|
||||
bindingNames: Object.keys(resolved.bindings),
|
||||
bindingLabels: Object.fromEntries(Object.entries(resolved.bindings).map(([name, id]) => [name, labels.get(id) ?? name])),
|
||||
bindingLabels: Object.fromEntries(
|
||||
Object.entries(resolved.bindings).map(([name, id]) => [name, labels.get(id) ?? name]),
|
||||
),
|
||||
installationId: resolved.installation.id,
|
||||
isPreview: Boolean(resolved.preview),
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user