@openfin/workspace-platform 22.2.18 → 22.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-api/src/integrations/microsoft.utils.d.ts +6 -6
- package/client-api-platform/src/api/app-directory.d.ts +1 -1
- package/client-api-platform/src/api/controllers/theme-storage-controller.d.ts +2 -2
- package/client-api-platform/src/api/pages/open-pages.d.ts +2 -2
- package/client-api-platform/src/api/performance.d.ts +7 -0
- package/client-api-platform/src/api/workspaces/index.d.ts +2 -2
- package/client-api-platform/src/index.d.ts +2 -1
- package/client-api-platform/src/init/index.d.ts +1 -2
- package/client-api-platform/src/init/override-callback/page-defaults.d.ts +1 -1
- package/client-api-platform/src/init/override-callback/view-options.d.ts +1 -1
- package/client-api-platform/src/init/utils.d.ts +1 -0
- package/client-api-platform/src/shapes.d.ts +57 -12
- package/common/src/api/pages/idb.d.ts +4 -2
- package/common/src/api/protocol/browser.d.ts +4 -4
- package/common/src/api/protocol/workspace-platform.d.ts +24 -23
- package/common/src/api/provider.d.ts +1 -1
- package/common/src/api/storefront.d.ts +5 -5
- package/common/src/api/theming.d.ts +1 -1
- package/common/src/utils/defer-show.d.ts +1 -1
- package/common/src/utils/global-context-menu.d.ts +1 -1
- package/common/src/utils/indicators/browser.d.ts +1 -1
- package/common/src/utils/layout.d.ts +2 -1
- package/common/src/utils/menu-window-provider.d.ts +6 -6
- package/common/src/utils/modal-bounds.d.ts +1 -1
- package/common/src/utils/namespaced-local-storage.d.ts +2 -2
- package/common/src/utils/page-tab-context-menu.d.ts +1 -1
- package/common/src/utils/pick.d.ts +7 -0
- package/common/src/utils/promise-with-resolvers.d.ts +9 -0
- package/common/src/utils/shared-emitter.d.ts +4 -4
- package/common/src/utils/types.d.ts +23 -0
- package/common/src/utils/workspace-modals.d.ts +1 -1
- package/{common/src/utils/enterprise-dock.d.ts → dock3/src/api/constants.d.ts} +2 -0
- package/dock3/src/api/idb.d.ts +3 -0
- package/dock3/src/api/index.d.ts +14 -0
- package/dock3/src/api/launch.d.ts +3 -0
- package/dock3/src/api/protocol.d.ts +1 -0
- package/dock3/src/api/provider.d.ts +89 -0
- package/dock3/src/shapes/enterprise.d.ts +1 -0
- package/dock3/src/shapes/index.d.ts +2 -0
- package/dock3/src/shapes/shapes.d.ts +63 -0
- package/dock3/src/utils.d.ts +2 -0
- package/externals.report.json +6 -0
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/search-api/src/provider/remote/info.d.ts +1 -1
- package/workspace_platform.zip +0 -0
- package/client-api-platform/src/api/perfomance.d.ts +0 -3
|
@@ -36,9 +36,9 @@ export declare const MICROSOFT_365_SEARCH_RESULT_ACTIONS: {
|
|
|
36
36
|
* @param req The user input request object from which to extract the selected filters.
|
|
37
37
|
* @returns An array of CLIFilter objects representing the validated filters.
|
|
38
38
|
*/
|
|
39
|
-
export declare const getValidFilters: (req: Parameters<HomeProvider[
|
|
40
|
-
export declare const getValidContactFilters: (users: MicrosoftGraphTypes.User[], req: Parameters<HomeProvider[
|
|
41
|
-
export declare const getContactFiltersFromRequest: (req: Parameters<HomeProvider[
|
|
39
|
+
export declare const getValidFilters: (req: Parameters<HomeProvider['onUserInput']>[0], searchTypePossibleFilters: Set<Microsoft365DocumentType>) => CLIFilter[];
|
|
40
|
+
export declare const getValidContactFilters: (users: MicrosoftGraphTypes.User[], req: Parameters<HomeProvider['onUserInput']>[0]) => CLIFilter[];
|
|
41
|
+
export declare const getContactFiltersFromRequest: (req: Parameters<HomeProvider['onUserInput']>[0]) => {
|
|
42
42
|
department: string[];
|
|
43
43
|
jobTitle: string[];
|
|
44
44
|
};
|
|
@@ -58,7 +58,7 @@ export declare const filterContactFromRequest: (items: MicrosoftGraphTypes.User[
|
|
|
58
58
|
* If no types are selected or all types are deselected, the function marks all types to be shown.
|
|
59
59
|
* Otherwise, it marks only the selected types to be shown.
|
|
60
60
|
*/
|
|
61
|
-
export declare const getTypeFiltersFromRequest: (req: Parameters<HomeProvider[
|
|
61
|
+
export declare const getTypeFiltersFromRequest: (req: Parameters<HomeProvider['onUserInput']>[0], searchTypePossibleFilters: Set<Microsoft365DocumentType>) => {
|
|
62
62
|
readonly showDocuments: boolean;
|
|
63
63
|
readonly showContacts: boolean;
|
|
64
64
|
/** Teams Messages */
|
|
@@ -70,7 +70,7 @@ export declare const getTypeFiltersFromRequest: (req: Parameters<HomeProvider["o
|
|
|
70
70
|
/** SharePoint Lists */
|
|
71
71
|
readonly showLists: boolean;
|
|
72
72
|
};
|
|
73
|
-
export declare const getDocumentFiltersFromRequest: (req: Parameters<HomeProvider[
|
|
73
|
+
export declare const getDocumentFiltersFromRequest: (req: Parameters<HomeProvider['onUserInput']>[0]) => {
|
|
74
74
|
readonly filterFiles: boolean;
|
|
75
75
|
readonly showWord: boolean;
|
|
76
76
|
readonly showExcel: boolean;
|
|
@@ -81,6 +81,6 @@ export declare const getDocumentFiltersFromRequest: (req: Parameters<HomeProvide
|
|
|
81
81
|
export declare const filterDocumentsFromRequest: (items: MicrosoftGraphTypes.DriveItem[], filter: ReturnType<typeof getDocumentFiltersFromRequest>) => MicrosoftGraphTypes.DriveItem[];
|
|
82
82
|
export declare const getFileType: (fileName?: string) => string;
|
|
83
83
|
export declare const getFileIcon: (fileName?: string) => string;
|
|
84
|
-
export declare const mapMicrosoftAvailabilityToPresence: (availability: Presence) => CLISearchResultContact[
|
|
84
|
+
export declare const mapMicrosoftAvailabilityToPresence: (availability: Presence) => CLISearchResultContact['templateContent']['onlineStatus'] | undefined;
|
|
85
85
|
/** base64IdToUrl converts a base64 encoded id to a url safe id */
|
|
86
86
|
export declare const base64IdToUrl: (b64Id: string) => string;
|
|
@@ -7,7 +7,7 @@ import type { LaunchAppRequest, SearchSitesRequest, SearchSitesResponse, Site }
|
|
|
7
7
|
* @param app the app directory entry.
|
|
8
8
|
* @param opts launch options.
|
|
9
9
|
*/
|
|
10
|
-
export declare function launchApp({ app, target }: LaunchAppRequest): Promise<void | OpenFin.
|
|
10
|
+
export declare function launchApp({ app, target }: LaunchAppRequest): Promise<void | OpenFin.Identity | OpenFin.Application | OpenFin.View | OpenFin.Platform>;
|
|
11
11
|
export declare const enterpriseAppDirectoryChannelClient: () => Promise<OpenFin.ChannelClient>;
|
|
12
12
|
export declare function getResults(payload: {
|
|
13
13
|
req: SearchSitesRequest;
|
|
@@ -4,7 +4,7 @@ import { ColorSchemeOptionType, CustomPaletteSet } from '../../../../client-api-
|
|
|
4
4
|
*
|
|
5
5
|
* This is particularly useful if a value uses a different palette constant depending on scheme.
|
|
6
6
|
*/
|
|
7
|
-
export declare const getPaletteExtensions: (palette: CustomPaletteSet, paletteScheme:
|
|
7
|
+
export declare const getPaletteExtensions: (palette: CustomPaletteSet, paletteScheme: 'light' | 'dark', isWindows: boolean) => {
|
|
8
8
|
dockExpandedContainerBorderColor: string;
|
|
9
9
|
dockExpandedContainerBorderRadius: string;
|
|
10
10
|
dockExpandedContainerBackground: string;
|
|
@@ -46,7 +46,7 @@ export declare class ThemeStorageController {
|
|
|
46
46
|
* A workaround that can be leveraged in cross origin scenarios (which is the majority of the workspace use case) is available in this commit: 233e843cda6cd68968fd5831fb20597e0d5bb7cc
|
|
47
47
|
* `git revert 233e843cda6cd68968fd5831fb20597e0d5bb7cc --no-commit`
|
|
48
48
|
*/
|
|
49
|
-
setWorkspaceStorage: (proxy: Pick<Storage,
|
|
49
|
+
setWorkspaceStorage: (proxy: Pick<Storage, 'setItem'>) => void;
|
|
50
50
|
/**
|
|
51
51
|
* Synchronize the current palette and scheme with workspace's storage instance if
|
|
52
52
|
* storage based theming is enabled
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnalyticsEventInternal } from '../../../../common/src/utils/usage-register';
|
|
2
2
|
import { Page } from '../../../../client-api-platform/src/shapes';
|
|
3
3
|
export declare const getOpenPages: () => Map<string, AnalyticsEventInternal>;
|
|
4
|
-
export declare const addOpenPageToCache: (pageId: Page[
|
|
5
|
-
export declare const removeOpenPageFromCache: (pageId: Page[
|
|
4
|
+
export declare const addOpenPageToCache: (pageId: Page['pageId'], event: AnalyticsEventInternal) => void;
|
|
5
|
+
export declare const removeOpenPageFromCache: (pageId: Page['pageId']) => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const browserWindowPerformanceMarkStart: () => string;
|
|
2
|
+
export declare const browserWindowPerformanceMarkAPIReturn: (performanceMarkTitle: string) => void;
|
|
3
|
+
export declare const setupBrowserWindowShownPerformanceMark: (performanceMarkTitle: string) => void;
|
|
4
|
+
export declare const contextMenuPerformanceMarkStart: () => string;
|
|
5
|
+
export declare const contextMenuPerformanceMarkEnd: (performanceMarkTitle: string) => void;
|
|
6
|
+
export declare const contextMenuPerformanceMarkAPIReturn: (performanceMarkTitle: string) => void;
|
|
7
|
+
export declare const setupContextMenuPerformanceMark: (performanceMarkTitle: string) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApplyWorkspacePayload, CreateSavedWorkspaceRequest, RestoreLastSavedWorkspacePayload, RestoreLastSavedWorkspaceResult, Workspace } from '../../../../client-api-platform/src/shapes';
|
|
1
|
+
import type { ApplyWorkspacePayload, CreateSavedWorkspaceRequest, GetCurrentWorkspaceOptions, RestoreLastSavedWorkspacePayload, RestoreLastSavedWorkspaceResult, Workspace } from '../../../../client-api-platform/src/shapes';
|
|
2
2
|
/**
|
|
3
3
|
* Apply the given workspace and set it as active.
|
|
4
4
|
* @param payload, the workspace to apply and the options to apply it with.
|
|
@@ -20,7 +20,7 @@ export declare function getInitialWorkspace(): Promise<Workspace>;
|
|
|
20
20
|
* Get a workspace data structure that represents the users current desktop.
|
|
21
21
|
* @returns the current active workspace.
|
|
22
22
|
*/
|
|
23
|
-
export declare function getCurrentWorkspace(): Promise<Workspace>;
|
|
23
|
+
export declare function getCurrentWorkspace(options?: GetCurrentWorkspaceOptions): Promise<Workspace>;
|
|
24
24
|
export declare function getLastSavedWorkspace(): Promise<Workspace | undefined>;
|
|
25
25
|
export declare const createWorkspaceInStorage: (req: CreateSavedWorkspaceRequest) => Promise<any>;
|
|
26
26
|
export declare const getWorkspacesInStorage: () => Promise<Workspace[]>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import OpenFin from '@openfin/core';
|
|
2
|
-
import {
|
|
3
|
-
export declare function initDockCompanion(config: CompanionDockConfig, platform: OpenFin.Platform): Promise<void>;
|
|
2
|
+
import { WorkspacePlatformInitConfig } from '../../../client-api-platform/src/shapes';
|
|
4
3
|
/**
|
|
5
4
|
* Initilaize a Workspace Platform.
|
|
6
5
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import OpenFin from '@openfin/core';
|
|
2
2
|
import type { AttachedPage, AttachedPageInternal } from '../../../../common/src/api/pages/shapes';
|
|
3
3
|
import { BrowserInitConfig } from '../..';
|
|
4
|
-
export declare const applyPageDefaults: (pages: AttachedPage[], initOptions?: Pick<BrowserInitConfig,
|
|
4
|
+
export declare const applyPageDefaults: (pages: AttachedPage[], initOptions?: Pick<BrowserInitConfig, 'defaultPageOptions' | 'defaultViewOptions' | 'defaultWindowOptions'>, overrideOptions?: OpenFin.PlatformWindowCreationOptions) => Promise<AttachedPageInternal[]>;
|
|
@@ -7,5 +7,5 @@ type ViewStateBase = Pick<BrowserViewState, '_internalWorkspaceData' | 'workspac
|
|
|
7
7
|
export declare const mapInternalWorkspaceDataToWorkspacePlatform: <T extends ViewStateBase>(viewState: T) => T;
|
|
8
8
|
export declare const mapWorkspacePlatformToInternalWorkspaceData: <T extends ViewStateBase>(viewState: T) => T;
|
|
9
9
|
export declare const setHotkeysIfNavigationButtonsEnabled: (options: BrowserCreateViewRequest) => Promise<BrowserCreateViewRequest>;
|
|
10
|
-
export declare const registerHotkeyListenersIfEnabled: (viewIdentity: OpenFin.Identity, buttonOptions?: BrowserWorkspacePlatformViewOptions[
|
|
10
|
+
export declare const registerHotkeyListenersIfEnabled: (viewIdentity: OpenFin.Identity, buttonOptions?: BrowserWorkspacePlatformViewOptions['browserNavigationButtons']) => void;
|
|
11
11
|
export {};
|
|
@@ -34,4 +34,5 @@ export type WindowType = 'browser' | 'platform' | 'classic' | 'mixed' | 'enterpr
|
|
|
34
34
|
*/
|
|
35
35
|
export declare function checkHasBrowserWindows(snapshot: BrowserSnapshot): boolean;
|
|
36
36
|
export declare const copyObject: <T>(obj: T) => T;
|
|
37
|
+
export declare function validateTabDimensionsIfAny(overrideOptions: OpenFin.PlatformWindowCreationOptions): void;
|
|
37
38
|
export {};
|
|
@@ -6,8 +6,9 @@ import { AddDefaultPagePayload, AttachedPage, BookmarkNode, CopyPagePayload, Han
|
|
|
6
6
|
import { SetActivePageForWindowPayload } from '../../common/src/api/pages/shapes';
|
|
7
7
|
import { NotificationsCustomManifestOptions } from '../../common/src/api/shapes/notifications';
|
|
8
8
|
import type { CustomThemes } from '../../common/src/api/theming';
|
|
9
|
-
import { App, DockProviderConfigWithIdentity, StoreButtonConfig
|
|
9
|
+
import { App, DockProviderConfigWithIdentity, StoreButtonConfig } from '../../client-api/src/shapes';
|
|
10
10
|
import type { WorkflowIntegration } from '../../client-api/src/shapes/integrations';
|
|
11
|
+
export * from '../../dock3/src/shapes';
|
|
11
12
|
export { AppManifestType } from '../../client-api/src/shapes';
|
|
12
13
|
export type { App, AppIntent, Image } from '../../client-api/src/shapes';
|
|
13
14
|
export type { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
|
|
@@ -153,15 +154,15 @@ export declare enum PageTabContextMenuOptionType {
|
|
|
153
154
|
Save = "Save",
|
|
154
155
|
SaveAs = "Save As",
|
|
155
156
|
NewPage = "New Page",
|
|
156
|
-
DeletePage = "Delete Page"
|
|
157
|
-
SaveWorkspaceAs = "SaveWorkspaceAs"
|
|
158
|
-
Refresh = "Refresh"
|
|
159
|
-
CloseOthers = "Close others"
|
|
160
|
-
Delete = "Delete"
|
|
161
|
-
Print = "Print"
|
|
162
|
-
PrintAll = "PrintAll"
|
|
163
|
-
PrintScreen = "PrintScreen"
|
|
164
|
-
AddToChannel = "AddToChannel"
|
|
157
|
+
DeletePage = "Delete Page",
|
|
158
|
+
SaveWorkspaceAs = "SaveWorkspaceAs",
|
|
159
|
+
Refresh = "Refresh",
|
|
160
|
+
CloseOthers = "Close others",
|
|
161
|
+
Delete = "Delete",
|
|
162
|
+
Print = "Print",
|
|
163
|
+
PrintAll = "PrintAll",
|
|
164
|
+
PrintScreen = "PrintScreen",
|
|
165
|
+
AddToChannel = "AddToChannel",
|
|
165
166
|
Custom = "Custom"
|
|
166
167
|
}
|
|
167
168
|
/**Shape of the data property of a global context menu template item */
|
|
@@ -604,6 +605,28 @@ export interface BrowserWorkspacePlatformWindowOptions {
|
|
|
604
605
|
newPageUrl?: string;
|
|
605
606
|
toolbarOptions?: ToolbarOptions;
|
|
606
607
|
windowStateButtonOptions?: WindowStateButtonOptions;
|
|
608
|
+
/** Specifies the min and max sizes for page tabs.
|
|
609
|
+
* Page tabs will expand to take all available space up to the specified maximum size.
|
|
610
|
+
* Similarly, they will collapse down to the specified minimum size.
|
|
611
|
+
* When there is not enough room to fit the tabs, the tabstrip will become scrollable.
|
|
612
|
+
* Sizes can be specified as pixels (e.g. "100px") or as percentage of tab strip width (e.g. "20%").
|
|
613
|
+
* The default value for both min and max is "120px". To maintain usability, minimum values below 28px will be ignored and 28px will be used as the minimum.
|
|
614
|
+
*/
|
|
615
|
+
pageTabDimensions?: {
|
|
616
|
+
minWidth?: string;
|
|
617
|
+
maxWidth?: string;
|
|
618
|
+
};
|
|
619
|
+
/** Specifies the min and max sizes for view tabs in a layout.
|
|
620
|
+
* View tabs will expand to take all available space up to the specified maximum size.
|
|
621
|
+
* Similarly, they will collapse down to the specified minimum size.
|
|
622
|
+
* When there is not enough room to fit the tabs, the tabstrip will become scrollable.
|
|
623
|
+
* Sizes can be specified as pixels (e.g. "100px") or as percentage of tab strip width (e.g. "20%").
|
|
624
|
+
* The default value for both min and max is "120px". To maintain usability, minimum values below 28px will be ignored and 28px will be used as the minimum.
|
|
625
|
+
*/
|
|
626
|
+
viewTabDimensions?: {
|
|
627
|
+
minWidth?: string;
|
|
628
|
+
maxWidth?: string;
|
|
629
|
+
};
|
|
607
630
|
/**
|
|
608
631
|
* Use when you want to display navigation buttons in Browser toolbar. Disabled by default.
|
|
609
632
|
*
|
|
@@ -1315,6 +1338,17 @@ export interface WorkspacePlatformStorage {
|
|
|
1315
1338
|
* ```
|
|
1316
1339
|
*/
|
|
1317
1340
|
getWorkspaces(): Promise<Workspace[]>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Get all workspaces metadata including the workspaceId and title that are saved in persistent storage.
|
|
1343
|
+
*
|
|
1344
|
+
* ```ts
|
|
1345
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
1346
|
+
*
|
|
1347
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
1348
|
+
* const workspacesMetadata = await workspacePlatform.Storage.getWorkspacesMetadata();
|
|
1349
|
+
* ```
|
|
1350
|
+
*/
|
|
1351
|
+
getWorkspacesMetadata(): Promise<Pick<Workspace, 'workspaceId' | 'title'>[]>;
|
|
1318
1352
|
/**
|
|
1319
1353
|
* Get a specific workspace in persistent storage.
|
|
1320
1354
|
*
|
|
@@ -1485,8 +1519,9 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
|
|
|
1485
1519
|
launchApp(req: LaunchAppRequest): Promise<void>;
|
|
1486
1520
|
/**
|
|
1487
1521
|
* Gets a workspace data structure that represents the current state of the user's desktop.
|
|
1522
|
+
* @param options Options for getting the current workspace.
|
|
1488
1523
|
*/
|
|
1489
|
-
getCurrentWorkspace(): Promise<Workspace>;
|
|
1524
|
+
getCurrentWorkspace(options?: GetCurrentWorkspaceOptions): Promise<Workspace>;
|
|
1490
1525
|
/**
|
|
1491
1526
|
* Sets the workspace as the current active workspace. Does not apply the workspace to the user's desktop.
|
|
1492
1527
|
* @param workspace the workspace to set as current active workspace.
|
|
@@ -1608,6 +1643,11 @@ export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
|
|
|
1608
1643
|
* @param query an optional query.
|
|
1609
1644
|
*/
|
|
1610
1645
|
getSavedWorkspaces(query?: string): Promise<Workspace[]>;
|
|
1646
|
+
/**
|
|
1647
|
+
* Implementation for getting a list of saved workspaces metadata from persistent storage.
|
|
1648
|
+
* @param query an optional query.
|
|
1649
|
+
*/
|
|
1650
|
+
getSavedWorkspacesMetadata(query?: string): Promise<Pick<Workspace, 'workspaceId' | 'title'>[]>;
|
|
1611
1651
|
/**
|
|
1612
1652
|
* Implementation for getting a single workspace in persistent storage.
|
|
1613
1653
|
* @param id
|
|
@@ -1813,6 +1853,9 @@ export declare enum CustomActionCallerType {
|
|
|
1813
1853
|
export type CustomActionPayload = {
|
|
1814
1854
|
callerType: CustomActionCallerType.API;
|
|
1815
1855
|
} | CustomButtonActionPayload | StoreCustomButtonActionPayload | CustomDropdownItemActionPayload | GlobalContextMenuOptionActionPayload | ViewTabCustomActionPayload | PageTabContextMenuOptionActionPayload | OpenSaveContextMenuOptionActionPayload;
|
|
1856
|
+
export interface GetCurrentWorkspaceOptions {
|
|
1857
|
+
skipSnapshotUpdate?: boolean;
|
|
1858
|
+
}
|
|
1816
1859
|
/**
|
|
1817
1860
|
* Options for the {@link WorkspacePlatformModule.applyWorkspace applyWorkspace} method.
|
|
1818
1861
|
*
|
|
@@ -2183,11 +2226,13 @@ export type WorkspacePlatformOverrideCallback = OpenFin.OverrideCallback<Workspa
|
|
|
2183
2226
|
* @deprecated
|
|
2184
2227
|
*/
|
|
2185
2228
|
export type BrowserOverrideCallback = WorkspacePlatformOverrideCallback;
|
|
2186
|
-
export type DockCompanionButton = Exclude<WorkspaceButton, 'store'> | 'contentMenu' | 'bookmarks' | 'searchShortcut';
|
|
2187
2229
|
export type LaunchDockEntryPayload = {
|
|
2188
2230
|
entry: DockEntry;
|
|
2189
2231
|
sourceEvent?: Pick<MouseEvent, 'ctrlKey' | 'metaKey' | 'shiftKey'>;
|
|
2190
2232
|
};
|
|
2233
|
+
export type BookmarkDockEntryPayload = {
|
|
2234
|
+
entry: DockEntry;
|
|
2235
|
+
};
|
|
2191
2236
|
/**
|
|
2192
2237
|
* Configuration options for Browser window's icons.
|
|
2193
2238
|
*/
|
|
@@ -14,8 +14,10 @@ export declare function updatePage({ pageId, page }: {
|
|
|
14
14
|
export declare const addRemovedTab: (payload: TrackedTab) => Promise<void>;
|
|
15
15
|
export declare const popLastRemovedTab: () => Promise<TrackedTab | undefined>;
|
|
16
16
|
export declare const trackVisitedSite: (payload: Site) => Promise<void>;
|
|
17
|
-
export declare const getRecentVisitedSites: (numOfSites?: number) => Promise<TrackedSite[] | [
|
|
18
|
-
|
|
17
|
+
export declare const getRecentVisitedSites: (numOfSites?: number) => Promise<TrackedSite[] | [
|
|
18
|
+
]>;
|
|
19
|
+
export declare const getFrequentlyVisitedSites: () => Promise<TrackedSite[] | [
|
|
20
|
+
]>;
|
|
19
21
|
export declare const searchSites: (payload: {
|
|
20
22
|
req: SearchSitesRequest;
|
|
21
23
|
} & {
|
|
@@ -34,8 +34,8 @@ declare enum GeneralBrowserChannelActions {
|
|
|
34
34
|
SetSelectedScheme = "set-selected-scheme",
|
|
35
35
|
ShowBrowserIndicator = "show-browser-indicator",
|
|
36
36
|
SetSelectedLanguage = "set-selected-language",
|
|
37
|
-
RefreshBookmarksInternal = "refresh-bookmarks"
|
|
38
|
-
GetLayoutsWithSelectedViewsInternal = "get-layouts-with-selected-views"
|
|
37
|
+
RefreshBookmarksInternal = "refresh-bookmarks",
|
|
38
|
+
GetLayoutsWithSelectedViewsInternal = "get-layouts-with-selected-views",
|
|
39
39
|
FocusAndExpandSearchInternal = "focus-and-expand-search"
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -56,8 +56,8 @@ export declare enum PageChannelAction {
|
|
|
56
56
|
IsActivePageChanging = "is-active-page-changing"
|
|
57
57
|
}
|
|
58
58
|
export declare enum CompanionDockChannelAction {
|
|
59
|
-
UpdateFavoriteEntries = "update-favorite-entries"
|
|
60
|
-
UpdateContentMenu = "update-content-menu"
|
|
59
|
+
UpdateFavoriteEntries = "update-favorite-entries",
|
|
60
|
+
UpdateContentMenu = "update-content-menu",
|
|
61
61
|
NavigateContentMenu = "navigate-content-menu"
|
|
62
62
|
}
|
|
63
63
|
export declare const BrowserChannelAction: {
|
|
@@ -48,6 +48,7 @@ export declare enum WorkspacePlatformChannelAction {
|
|
|
48
48
|
UpdateSavedWorkspace = "updateSavedWorkspace",
|
|
49
49
|
DeleteSavedWorkspace = "deleteSavedWorkspace",
|
|
50
50
|
GetSavedWorkspaces = "getSavedWorkspaces",
|
|
51
|
+
GetSavedWorkspacesMetadata = "getSavedWorkspacesMetadata",
|
|
51
52
|
SaveWorkspace = "saveWorkspace",
|
|
52
53
|
GetCurrentWorkspace = "getCurrentWorkspace",
|
|
53
54
|
ApplyWorkspace = "applyWorkspace",
|
|
@@ -66,30 +67,30 @@ export declare enum WorkspacePlatformChannelAction {
|
|
|
66
67
|
CopyPage = "copyPage",
|
|
67
68
|
HandlePageChanges = "handlePageChanges",
|
|
68
69
|
MarkUnsavedPagesAsSavedInternal = "markUnsavedPagesAsSavedInternal",
|
|
69
|
-
TrackRemovedTabInternal = "trackRemovedTabInternal"
|
|
70
|
-
RestoreRemovedTabInternal = "restoreRemovedTabInternal"
|
|
71
|
-
TrackVisitedSiteInternal = "trackVisitedSiteInternal"
|
|
72
|
-
GetRecentlyVisitedSitesInternal = "getRecentlyVisitedSitesInternal"
|
|
73
|
-
GetFrequentlyVisitedSitesInternal = "getFrequentlyVisitedSitesInternal"
|
|
74
|
-
SearchSitesInternal = "searchSitesInternal"
|
|
75
|
-
GetSearchProvidersInternal = "getSearchProvidersInternal"
|
|
76
|
-
GetCuratedContentInternal = "getCuratedContentInternal"
|
|
77
|
-
HandleRequestNavigationInternal = "handleRequestNavigationInternal"
|
|
78
|
-
RefreshBookmarksInternal = "refreshBookmarksInternal"
|
|
79
|
-
LaunchBookmarkInternal = "launchBookmarkInternal"
|
|
70
|
+
TrackRemovedTabInternal = "trackRemovedTabInternal",
|
|
71
|
+
RestoreRemovedTabInternal = "restoreRemovedTabInternal",
|
|
72
|
+
TrackVisitedSiteInternal = "trackVisitedSiteInternal",
|
|
73
|
+
GetRecentlyVisitedSitesInternal = "getRecentlyVisitedSitesInternal",
|
|
74
|
+
GetFrequentlyVisitedSitesInternal = "getFrequentlyVisitedSitesInternal",
|
|
75
|
+
SearchSitesInternal = "searchSitesInternal",
|
|
76
|
+
GetSearchProvidersInternal = "getSearchProvidersInternal",
|
|
77
|
+
GetCuratedContentInternal = "getCuratedContentInternal",
|
|
78
|
+
HandleRequestNavigationInternal = "handleRequestNavigationInternal",
|
|
79
|
+
RefreshBookmarksInternal = "refreshBookmarksInternal",
|
|
80
|
+
LaunchBookmarkInternal = "launchBookmarkInternal",
|
|
80
81
|
GetNotificationsConfig = "getNotificationsConfig",
|
|
81
|
-
UpdateDockFavoritesInternal = "updateDockFavoritesInternal"
|
|
82
|
-
UpdateContentMenuInternal = "updateContentMenuInternal"
|
|
83
|
-
LaunchDockEntryInternal = "launchDockEntryInternal"
|
|
84
|
-
SetDockFavoritesOrderInternal = "setDockFavoritesOrderInternal"
|
|
85
|
-
NavigateContentMenuInternal = "navigateContentMenuInternal"
|
|
86
|
-
SetDefaultDockButtonsOrderInternal = "setDefaultDockButtonsOrderInternal"
|
|
87
|
-
GetDockWorkspacesContextMenuInternal = "getDockWorkspacesContextMenuInternal"
|
|
88
|
-
HandleDockWorkspacesMenuResponseInternal = "handleDockWorkspacesMenuResponseInternal"
|
|
89
|
-
RemoveDockFavoriteInternal = "removeDockFavoriteInternal"
|
|
90
|
-
AddDockFavoriteInternal = "addDockFavoriteInternal"
|
|
91
|
-
FocusAndExpandSearchInternal = "focusAndExpandSearchInternal"
|
|
92
|
-
SendUpdateVersionModalResponseInternal = "sendUpdateVersionModalResponseInternal"
|
|
82
|
+
UpdateDockFavoritesInternal = "updateDockFavoritesInternal",
|
|
83
|
+
UpdateContentMenuInternal = "updateContentMenuInternal",
|
|
84
|
+
LaunchDockEntryInternal = "launchDockEntryInternal",
|
|
85
|
+
SetDockFavoritesOrderInternal = "setDockFavoritesOrderInternal",
|
|
86
|
+
NavigateContentMenuInternal = "navigateContentMenuInternal",
|
|
87
|
+
SetDefaultDockButtonsOrderInternal = "setDefaultDockButtonsOrderInternal",
|
|
88
|
+
GetDockWorkspacesContextMenuInternal = "getDockWorkspacesContextMenuInternal",
|
|
89
|
+
HandleDockWorkspacesMenuResponseInternal = "handleDockWorkspacesMenuResponseInternal",
|
|
90
|
+
RemoveDockFavoriteInternal = "removeDockFavoriteInternal",
|
|
91
|
+
AddDockFavoriteInternal = "addDockFavoriteInternal",
|
|
92
|
+
FocusAndExpandSearchInternal = "focusAndExpandSearchInternal",
|
|
93
|
+
SendUpdateVersionModalResponseInternal = "sendUpdateVersionModalResponseInternal",
|
|
93
94
|
ShowUpdateVersionModalInternal = "showUpdateVersionModalInternal"
|
|
94
95
|
}
|
|
95
96
|
export type PlatFormSupportedFeatures = boolean | {
|
|
@@ -98,7 +98,7 @@ export interface ProviderUpdateEventPayload {
|
|
|
98
98
|
*
|
|
99
99
|
* This allows for different providers to be registered with the same id.
|
|
100
100
|
*/
|
|
101
|
-
export declare const getUniqueProviderIdentifier: ({ platformIdentity, id }: Pick<ProviderInfoInternal,
|
|
101
|
+
export declare const getUniqueProviderIdentifier: ({ platformIdentity, id }: Pick<ProviderInfoInternal, 'platformIdentity' | 'id'>) => string;
|
|
102
102
|
/**
|
|
103
103
|
* Get a list of all providers that have registered with the provider API.
|
|
104
104
|
*/
|
|
@@ -30,29 +30,29 @@ export declare const launchStorefrontApp: (req: LaunchStorefrontProviderAppReque
|
|
|
30
30
|
* @param identity of the platform to get the apps from.
|
|
31
31
|
* @returns the list of Storefront apps for the platform.
|
|
32
32
|
*/
|
|
33
|
-
export declare const getStorefrontApps: (provider: ProviderInfoInternal<
|
|
33
|
+
export declare const getStorefrontApps: (provider: ProviderInfoInternal<'storefront'>) => Promise<App[]>;
|
|
34
34
|
/**
|
|
35
35
|
* Get the platform's landing page for Storefront.
|
|
36
36
|
* @param identity of the platform to get the landing page of.
|
|
37
37
|
* @returns the platform's landing page.
|
|
38
38
|
*/
|
|
39
|
-
export declare const getStorefrontLandingPage: (provider: ProviderInfoInternal<
|
|
39
|
+
export declare const getStorefrontLandingPage: (provider: ProviderInfoInternal<'storefront'>) => Promise<StorefrontLandingPage | undefined>;
|
|
40
40
|
/**
|
|
41
41
|
* Get the platform's footer for Storefront.
|
|
42
42
|
* @param identity of the platform to get the footer of.
|
|
43
43
|
* @returns the platform's footer.
|
|
44
44
|
*/
|
|
45
|
-
export declare const getStorefrontFooter: (provider: ProviderInfoInternal<
|
|
45
|
+
export declare const getStorefrontFooter: (provider: ProviderInfoInternal<'storefront'>) => Promise<StorefrontFooter>;
|
|
46
46
|
/**
|
|
47
47
|
* Get the platform's navigation for Storefront.
|
|
48
48
|
* @param identity of the platform to get the navigation of.
|
|
49
49
|
* @returns the platform's navigation.
|
|
50
50
|
*/
|
|
51
|
-
export declare const getStorefrontNavigation: (provider: ProviderInfoInternal<
|
|
51
|
+
export declare const getStorefrontNavigation: (provider: ProviderInfoInternal<'storefront'>) => Promise<[StorefrontNavigationSection?, StorefrontNavigationSection?]>;
|
|
52
52
|
/**
|
|
53
53
|
* A helper method that gets a Storefront navigation item by ID.
|
|
54
54
|
* @param navigationItemId the id of the Storefront navigation item.
|
|
55
55
|
* @param identity of the platform.
|
|
56
56
|
* @returns the navigation item with the ID.
|
|
57
57
|
*/
|
|
58
|
-
export declare const getStorefrontNavigationItemAppGrid: (navigationItemId: string, provider: ProviderInfoInternal<
|
|
58
|
+
export declare const getStorefrontNavigationItemAppGrid: (navigationItemId: string, provider: ProviderInfoInternal<'storefront'>) => Promise<StorefrontNavigationItemAppGrid | undefined>;
|
|
@@ -276,5 +276,5 @@ export declare const getComputedPaletteSets: (customTheme: CustomThemeOptions |
|
|
|
276
276
|
export declare const computeThemes: (customThemes: CustomThemes, storedScheme?: ColorSchemeOptionType) => ComputedThemes;
|
|
277
277
|
export declare const getComputedPlatformTheme: (platformIdentity: OpenFin.Identity) => Promise<ComputedTheme>;
|
|
278
278
|
export declare const setSelectedScheme: (ctx: ColorSchemeOptionType) => Promise<void>;
|
|
279
|
-
export declare const getComputedScheme: (identity?: OpenFin.Identity) => Promise<Exclude<ColorSchemeType,
|
|
279
|
+
export declare const getComputedScheme: (identity?: OpenFin.Identity) => Promise<Exclude<ColorSchemeType, 'system'>>;
|
|
280
280
|
export declare const getComputedBackgroundColor: (paletteKey: keyof typeof Palette, defaultColor?: string) => Promise<string>;
|
|
@@ -24,7 +24,7 @@ interface InternalWindowOptions extends OpenFin.PlatformWindowCreationOptions {
|
|
|
24
24
|
* @param setAsForeground the option to focus the window when it is shown
|
|
25
25
|
* @returns the modified options.
|
|
26
26
|
*/
|
|
27
|
-
export declare const applyDeferShowOptions: (opts:
|
|
27
|
+
export declare const applyDeferShowOptions: <T>(opts: T, setAsForeground?: boolean) => InternalWindowOptions & T;
|
|
28
28
|
/**
|
|
29
29
|
* This function is a middleware that can be applied to a platform's `createWindow` function.
|
|
30
30
|
* If the defer show API has been enabled in window options using the `applyDeferShowOptions` function
|
|
@@ -86,7 +86,7 @@ export declare const downloads: () => {
|
|
|
86
86
|
export declare const appearance: () => {
|
|
87
87
|
label: string;
|
|
88
88
|
};
|
|
89
|
-
export declare const getSavedWorkspaceContextMenuOptions: (activeWorkspace: Workspace, savedWorkspaces: Workspace[], contextMenuOptionType: GlobalContextMenuOptionType) => {
|
|
89
|
+
export declare const getSavedWorkspaceContextMenuOptions: (activeWorkspace: Workspace, savedWorkspaces: Pick<Workspace, 'workspaceId' | 'title'>[], contextMenuOptionType: GlobalContextMenuOptionType) => {
|
|
90
90
|
label: string;
|
|
91
91
|
type: MenuItemType;
|
|
92
92
|
enabled: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type OpenFin from '@openfin/core';
|
|
2
2
|
import { IconType } from '@openfin/ui-library';
|
|
3
3
|
import { IndicatorType } from '../../../../common/src/components/Indicator/Indicator.constants';
|
|
4
|
-
export type BrowserIndicatorIcon = Extract<IconType, 'LockClosedIcon' | 'LockOpen1Icon' | 'PageIcon' | 'BlockedIcon' | 'SupertabIcon'>;
|
|
4
|
+
export type BrowserIndicatorIcon = Extract<IconType, 'LockClosedIcon' | 'LockOpen1Icon' | 'PageIcon' | 'BlockedIcon' | 'SupertabIcon' | 'BookmarkFilled'>;
|
|
5
5
|
export interface ShowBrowserIndicatorPayload {
|
|
6
6
|
type: IndicatorType;
|
|
7
7
|
message: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
1
2
|
import type OpenFin from '@openfin/core';
|
|
2
3
|
import { WindowIdentity } from '../../../common/src/utils/window';
|
|
3
4
|
import { AttachedPageInternal } from '../../../common/src/api/pages/shapes';
|
|
@@ -78,7 +79,7 @@ export declare const cloneLayoutAndRemoveNames: (layout: PageLayout) => any;
|
|
|
78
79
|
* @returns A copy of the layout with generated names removed
|
|
79
80
|
*/
|
|
80
81
|
export declare const cloneLayoutAndRemoveGeneratedNames: (layout: PageLayout) => any;
|
|
81
|
-
export declare const mapContentComponentState: (content: OpenFin.LayoutContent) => OpenFin.LayoutComponent[
|
|
82
|
+
export declare const mapContentComponentState: (content: OpenFin.LayoutContent) => OpenFin.LayoutComponent['componentState'][];
|
|
82
83
|
export declare const getLayoutWithSingleView: (title: string, url: string, winIdentity?: OpenFin.Identity) => Promise<any>;
|
|
83
84
|
export declare const layoutNameInitializedMap: Map<string, boolean>;
|
|
84
85
|
export declare const isLayoutTabActive: (tabSelector: string) => boolean;
|
|
@@ -17,12 +17,12 @@ export interface ModalResponseEvent {
|
|
|
17
17
|
}
|
|
18
18
|
export declare const menuEvents: {
|
|
19
19
|
emit: <EventKey extends keyof MenuEventTypes>(event: EventKey, ...payload: MenuEventTypes[EventKey]) => Promise<void>;
|
|
20
|
-
addListener: <
|
|
21
|
-
addListenerWithUUID: (uuid: string) => <
|
|
22
|
-
removeListener: <
|
|
23
|
-
once: <
|
|
20
|
+
addListener: <EventKey_1 extends keyof MenuEventTypes>(event: EventKey_1, listener: (...payload: MenuEventTypes[EventKey_1]) => void) => void;
|
|
21
|
+
addListenerWithUUID: (uuid: string) => <EventKey_1 extends keyof MenuEventTypes>(event: EventKey_1, listener: (...payload: MenuEventTypes[EventKey_1]) => void) => void;
|
|
22
|
+
removeListener: <EventKey_2 extends keyof MenuEventTypes>(event: EventKey_2, listener: (...payload: MenuEventTypes[EventKey_2]) => void) => void;
|
|
23
|
+
once: <EventKey_3 extends keyof MenuEventTypes>(event: EventKey_3, listener: (...payload: MenuEventTypes[EventKey_3]) => void) => void;
|
|
24
24
|
};
|
|
25
|
-
export declare const emitMenuResponse: (data: ModalResponseEvent[
|
|
25
|
+
export declare const emitMenuResponse: (data: ModalResponseEvent['data']) => Promise<void>;
|
|
26
26
|
type WindowOptionsWithBounds = OptionalExceptFor<OpenFin.WindowOptions, 'name' | 'url'> & {
|
|
27
27
|
top: number;
|
|
28
28
|
left: number;
|
|
@@ -49,6 +49,6 @@ export declare function createMenuPosition(windowOptions: OptionalExceptFor<Open
|
|
|
49
49
|
}>;
|
|
50
50
|
export declare function showChildWindow({ options, parameters }: ShowChildOptions): Promise<OpenFin.Window>;
|
|
51
51
|
export declare const waitForModalResponse: ({ options, content, parameters }: ResponseModalOptions) => Promise<{
|
|
52
|
-
data: ModalResponseEvent[
|
|
52
|
+
data: ModalResponseEvent['data'];
|
|
53
53
|
}>;
|
|
54
54
|
export {};
|
|
@@ -16,7 +16,7 @@ export declare const getCenterOfParentWindowMonitor: (parentWindowIdentity?: Ope
|
|
|
16
16
|
* @param centerOnMonitor whether the modal should be centered on the monitor
|
|
17
17
|
* @returns the bounds for where the modal is to be displayed
|
|
18
18
|
*/
|
|
19
|
-
export declare const getResponseModalBounds: (modalOptions: ResponseModalConfig[
|
|
19
|
+
export declare const getResponseModalBounds: (modalOptions: ResponseModalConfig['windowOptions'], parentWindowIdentity?: OpenFin.Identity, centerOnMonitor?: boolean) => Promise<OpenFin.Bounds>;
|
|
20
20
|
export declare function getResponseModalBoundsAndCenterParentIfModalOffScreen(modalOptions: ResponseModalConfig['windowOptions'], parentWindowIdentity?: OpenFin.Identity, centerOnMonitor?: boolean): Promise<OpenFin.Bounds>;
|
|
21
21
|
/**
|
|
22
22
|
* Adjusts the given bounds to be within the closest monitor's available bounds if they are offscreen.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const createNamespacedLocalStorage: <TKey extends string>(namespace: string) => Pick<Storage,
|
|
1
|
+
export declare const createNamespacedLocalStorage: <TKey extends string>(namespace: string) => Pick<Storage, 'setItem' | 'getItem' | 'removeItem'>;
|
|
2
2
|
export declare const setItem: (key: string, value: string) => void;
|
|
3
|
-
export declare const getItem: (key: string) => string
|
|
3
|
+
export declare const getItem: (key: string) => string;
|
|
4
4
|
export declare const removeItem: (key: string) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type OpenFin from '@openfin/core';
|
|
2
2
|
import { PageTabContextMenuItemTemplate } from '../../../client-api-platform/src/shapes';
|
|
3
|
-
export declare const getPageTabMenuTemplate: (pageId: string, winIdentity: OpenFin.Identity) => Promise<PageTabContextMenuItemTemplate[]>;
|
|
3
|
+
export declare const getPageTabMenuTemplate: (pageId: string, winIdentity: OpenFin.Identity, isEnterprise: boolean) => Promise<PageTabContextMenuItemTemplate[]>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pick specific keys from an object.
|
|
3
|
+
* lodash.pick is deprecated and says to use destructuring instead, but that has one key flaw, it adds undefined properties to the result if the key is not present in the object.
|
|
4
|
+
* ie `const { a, b } = obj; return {a,b};` will result in `{ a: undefined, b: undefined }` if `a` or `b` are not present in `obj`.
|
|
5
|
+
* pick({}, ['a', 'b']) will result in `{}` if `a` or `b` are not present in the object.
|
|
6
|
+
*/
|
|
7
|
+
export declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polyfill for `Promise.withResolvers` which is not available in this typescript version.
|
|
3
|
+
*/
|
|
4
|
+
export declare function withResolvers<T>(): PromiseWithResolvers<T>;
|
|
5
|
+
export type PromiseWithResolvers<T> = {
|
|
6
|
+
promise: Promise<T>;
|
|
7
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
8
|
+
reject: (reason?: any) => void;
|
|
9
|
+
};
|
|
@@ -5,12 +5,12 @@ export default function makeSharedEmitter<EventMap extends {
|
|
|
5
5
|
[key: string | number]: any[];
|
|
6
6
|
}>(id: string): {
|
|
7
7
|
emit: <EventKey extends keyof EventMap>(event: EventKey, ...payload: EventMap[EventKey]) => Promise<void>;
|
|
8
|
-
addListener: <
|
|
8
|
+
addListener: <EventKey_1 extends keyof EventMap>(event: EventKey_1, listener: (...payload: EventMap[EventKey_1]) => void) => void;
|
|
9
9
|
/**
|
|
10
10
|
* Creates a listener for a particular UUID instead of ApplicationUUID.Workspace.
|
|
11
11
|
* @param uuid The UUID of the application to subscribe to.
|
|
12
12
|
*/
|
|
13
|
-
addListenerWithUUID: (uuid: string) => <
|
|
14
|
-
removeListener: <
|
|
15
|
-
once: <
|
|
13
|
+
addListenerWithUUID: (uuid: string) => <EventKey_1 extends keyof EventMap>(event: EventKey_1, listener: (...payload: EventMap[EventKey_1]) => void) => void;
|
|
14
|
+
removeListener: <EventKey_2 extends keyof EventMap>(event: EventKey_2, listener: (...payload: EventMap[EventKey_2]) => void) => void;
|
|
15
|
+
once: <EventKey_3 extends keyof EventMap>(event: EventKey_3, listener: (...payload: EventMap[EventKey_3]) => void) => void;
|
|
16
16
|
};
|
|
@@ -33,3 +33,26 @@ export type Awaitable<T> = Awaited<T> | Promise<Awaited<T>>;
|
|
|
33
33
|
export type RemoveFunctions<T> = Pick<T, {
|
|
34
34
|
[K in keyof T]: T[K] extends Function ? never : K;
|
|
35
35
|
}[keyof T]>;
|
|
36
|
+
type MissingKeys<T, U> = Exclude<keyof T, U>;
|
|
37
|
+
/**
|
|
38
|
+
* A utility function that checks if the provided keys are valid for the given type T.
|
|
39
|
+
* The key thing it does is to ensure that all keys in T are present in the array, typescript can check for extra keys but not missing keys.
|
|
40
|
+
* While it is a function, it is really just a type check. The function is needed to encapsulate the type logic.
|
|
41
|
+
* It will throw a type error if any of the keys are not present in T.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* type Foo = {
|
|
46
|
+
* bar: string;
|
|
47
|
+
* qux?: string;
|
|
48
|
+
* };
|
|
49
|
+
*
|
|
50
|
+
* const fooChecker = makeKeyChecker<Foo>();
|
|
51
|
+
* const allFooKeys = fooChecker(['bar', 'qux']); // Valid
|
|
52
|
+
* fooChecker(['bar']); // Error: Missing keys: qux
|
|
53
|
+
* fooChecker(['qux']); // Error: Missing keys: bar
|
|
54
|
+
* fooChecker(['bar', 'qux', 'baz']); // 'baz' is not assignable to type keyof Foo;
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare const makeKeyChecker: <T extends object>() => <const K extends (keyof T)[]>(arr: K & (Exclude<keyof T, K[number]> extends never ? unknown : `Error: Missing keys: ${string & Exclude<keyof T, K[number]>}`)) => K;
|
|
58
|
+
export {};
|