fix: simplify custom widget package workbench
This commit is contained in:
1 parent
9a52a035aa
commit
48042a08ff
37 files changed
+1155
-608
No files matched your search
@@ -87,10 +87,19 @@ export function getWidgetServerContext<TOptions extends Record<string, unknown>
|
||||
options: TOptions;
|
||||
installationId: string;
|
||||
bindingNames: string[];
|
||||
bindingLabels: Record<string, string>;
|
||||
isPreview: boolean;
|
||||
}>;
|
||||
}
|
||||
|
||||
/** Enumerate every member of a repeatable connection requirement, including its original named binding. */
|
||||
export async function getWidgetConnectionGroup(context: WidgetServerContext, name: string) {
|
||||
const { bindingNames, bindingLabels } = await getWidgetServerContext(context);
|
||||
return bindingNames
|
||||
.filter((binding) => binding === name || binding.startsWith(`${name}:`))
|
||||
.map((connection) => ({ connection, label: bindingLabels[connection] ?? connection }));
|
||||
}
|
||||
|
||||
export function callWidgetIntegration<T = unknown>(context: WidgetServerContext, input: WidgetIntegrationInput) {
|
||||
return context.sdk.invoke("integration.call", input) as Promise<T>;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user