@redhat-cloud-services/types 3.0.1 → 3.2.0

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.
Files changed (2) hide show
  1. package/index.d.ts +25 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -108,6 +108,10 @@ export type EnableTopicsArgs = [{
108
108
  names: string[];
109
109
  append?: boolean;
110
110
  }] | string[];
111
+ type SearchNavItemPermission<T extends keyof VisibilityFunctions = 'isOrgAdmin'> = {
112
+ method: T;
113
+ args: Parameters<VisibilityFunctions[T]>;
114
+ };
111
115
  export type ChromeWsEventTypes = 'com.redhat.console.notifications.drawer';
112
116
  export type ChromeWsPayload<T> = {
113
117
  data: T;
@@ -120,6 +124,26 @@ export type ChromeWsPayload<T> = {
120
124
  export type ChromeWsEventListener<T> = (event: ChromeWsPayload<T>) => void;
121
125
  export type UnSubscribeFromChromeWsEvent = () => void;
122
126
  export type AddChromeWsEventListener = <T>(type: ChromeWsEventTypes, listener: ChromeWsEventListener<T>) => UnSubscribeFromChromeWsEvent;
127
+ export type SearchDataType = 'legacy' | 'generated';
128
+ export interface SearchEntry {
129
+ id: string;
130
+ title: string;
131
+ description: string;
132
+ uri: string;
133
+ pathname: string;
134
+ bundleTitle: string;
135
+ altTitle?: string[];
136
+ icon?: string;
137
+ type: SearchDataType;
138
+ permissions?: SearchNavItemPermission[];
139
+ }
140
+ export interface ChromeSearchAPI {
141
+ fillStore: (type: SearchDataType, data: SearchEntry[]) => Promise<void>;
142
+ query: (term: string, type?: SearchDataType, env?: string, limit?: number) => Promise<SearchEntry[]>;
143
+ getAvailableTypes: () => SearchDataType[];
144
+ clearType: (type: SearchDataType) => Promise<void>;
145
+ getCachedData: (type: SearchDataType) => SearchEntry[] | undefined;
146
+ }
123
147
  export type DrawerPanelActions = {
124
148
  setDrawerPanelContent: (data: {
125
149
  scope: string;
@@ -255,6 +279,7 @@ export interface ChromeAPI {
255
279
  enablePackagesDebug: () => void;
256
280
  requestPdf: (options: PDFRequestOptions) => Promise<void>;
257
281
  drawerActions: DrawerPanelActions;
282
+ search?: ChromeSearchAPI;
258
283
  }
259
284
  declare global {
260
285
  interface Window {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@redhat-cloud-services/types",
3
3
  "description": "TypeScript definitions for @redhat-cloud-services common typings.",
4
- "version": "3.0.1",
4
+ "version": "3.2.0",
5
5
  "main": "index.d.ts",
6
6
  "types": "index.d.ts",
7
7
  "publishConfig": {