@redhat-cloud-services/types 0.0.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/index.d.ts +134 -0
- package/package.json +23 -0
- package/tsconfig.json +18 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { QuickStartCatalogPage } from '@patternfly/quickstarts';
|
|
2
|
+
import { History } from 'history';
|
|
3
|
+
import { Access } from '@redhat-cloud-services/rbac-client';
|
|
4
|
+
|
|
5
|
+
declare type ChromeUser = {
|
|
6
|
+
entitlements: {
|
|
7
|
+
[key: string]: {
|
|
8
|
+
is_entitled: boolean;
|
|
9
|
+
is_trial: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
identity: {
|
|
13
|
+
account_number: string;
|
|
14
|
+
internal?: {
|
|
15
|
+
org_id: string;
|
|
16
|
+
account_id: string;
|
|
17
|
+
};
|
|
18
|
+
type: string;
|
|
19
|
+
user?: {
|
|
20
|
+
username: string;
|
|
21
|
+
email: string;
|
|
22
|
+
first_name: string;
|
|
23
|
+
last_name: string;
|
|
24
|
+
is_active: boolean;
|
|
25
|
+
is_internal: boolean;
|
|
26
|
+
is_org_admin: boolean;
|
|
27
|
+
locale: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
declare type VisibilityFunctions = {
|
|
33
|
+
isOrgAdmin: () => Promise<boolean>;
|
|
34
|
+
isActive: () => Promise<boolean>;
|
|
35
|
+
isInternal: () => Promise<boolean>;
|
|
36
|
+
isEntitled: () => Promise<boolean>;
|
|
37
|
+
isProd: () => boolean;
|
|
38
|
+
isBeta: () => boolean;
|
|
39
|
+
isHidden: () => true;
|
|
40
|
+
withemai: (toHave: string) => Promise<boolean>;
|
|
41
|
+
loosePermissions: (permissions: string[]) => boolean;
|
|
42
|
+
hasPermissions: (permissions: string[]) => boolean;
|
|
43
|
+
hasLocalStorage: (key: string, value: any) => boolean;
|
|
44
|
+
hasCookie: (key: string, value: any) => boolean;
|
|
45
|
+
/** TODO: Extends FEC axios instance config */
|
|
46
|
+
apiRequest: (config: {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
url: string;
|
|
49
|
+
method?: 'string';
|
|
50
|
+
accessor?: string;
|
|
51
|
+
matcher?: 'isEmpty' | 'isNotEmpty';
|
|
52
|
+
}) => Promise<boolean>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* TODO: Once chrome is migrated to TS, sychronize with chrome typings
|
|
57
|
+
*/
|
|
58
|
+
export interface ChromeAPI {
|
|
59
|
+
/** @deprecated will be removed from useChrome hook */
|
|
60
|
+
$internal: any;
|
|
61
|
+
initialized: boolean;
|
|
62
|
+
experimentalApi: boolean;
|
|
63
|
+
/** Return true if current environment is fedramp */
|
|
64
|
+
isFedramp: () => boolean;
|
|
65
|
+
usePendoFeedback: () => void;
|
|
66
|
+
toggleFeedbackModal: (isOpen: boolean) => void;
|
|
67
|
+
quickstarts: {
|
|
68
|
+
version: number;
|
|
69
|
+
set: (key: string, qs: any[]) => void;
|
|
70
|
+
toogle: (quickstartId: string) => void;
|
|
71
|
+
Catalog: typeof QuickStartCatalogPage;
|
|
72
|
+
};
|
|
73
|
+
chromeHistory: History;
|
|
74
|
+
isProd: boolean;
|
|
75
|
+
appAction: (action: string) => void;
|
|
76
|
+
appNavClick: (payload: any) => void;
|
|
77
|
+
appObjectId: (objectId: string) => void;
|
|
78
|
+
auth: {
|
|
79
|
+
doOffline: () => void;
|
|
80
|
+
getOfflineToken: () => Promise<any>;
|
|
81
|
+
getToken: () => Promise<string>;
|
|
82
|
+
getUser: () => Promise<ChromeUser>;
|
|
83
|
+
login: () => Promise<any>;
|
|
84
|
+
logout: () => void;
|
|
85
|
+
/** @deprecated will be removed from useChrome hook */
|
|
86
|
+
qe: any;
|
|
87
|
+
};
|
|
88
|
+
createCase: (fields: Record<string, unknown>) => void;
|
|
89
|
+
enable: {
|
|
90
|
+
iqe: () => void;
|
|
91
|
+
remediationsDebug: () => void;
|
|
92
|
+
invTags: () => void;
|
|
93
|
+
shortSession: () => void;
|
|
94
|
+
jwtDebug: () => void;
|
|
95
|
+
reduxDebug: () => void;
|
|
96
|
+
forcePendo: () => void;
|
|
97
|
+
allDetails: () => void;
|
|
98
|
+
inventoryDrawer: () => void;
|
|
99
|
+
globalFilter: () => void;
|
|
100
|
+
appFilter: () => void;
|
|
101
|
+
contextSwitcher: () => void;
|
|
102
|
+
quickstartsDebug: () => void;
|
|
103
|
+
};
|
|
104
|
+
forceDemo: () => void;
|
|
105
|
+
getApp: () => string;
|
|
106
|
+
getBundle: () => string;
|
|
107
|
+
getEnvironment: () => string;
|
|
108
|
+
getEnvironmentDetails: () => {
|
|
109
|
+
url: string[];
|
|
110
|
+
sso: string;
|
|
111
|
+
portal: string;
|
|
112
|
+
};
|
|
113
|
+
getUserPermissions: (applicationName?: string, disableCache?: boolean) => Promise<Access[]>;
|
|
114
|
+
globalFilterScope: (scope?: string) => void;
|
|
115
|
+
hideGlobalFilter: (hide?: boolean) => void;
|
|
116
|
+
/** @deprecated This function server no purpse. For document title update use "updateDocumentTitle" function instead. */
|
|
117
|
+
identifyApp: (data: any, appTitle?: string) => Promise<undefined>;
|
|
118
|
+
init: () => void;
|
|
119
|
+
isbeta: () => boolean;
|
|
120
|
+
isChrome2: boolean;
|
|
121
|
+
isDemo: () => boolean;
|
|
122
|
+
isPenTest: () => boolean;
|
|
123
|
+
/** TODO: create function typings */
|
|
124
|
+
mapGlobalFilter: (...args: any[]) => any;
|
|
125
|
+
/** @deprecated this function has no effect. */
|
|
126
|
+
navigation: () => void;
|
|
127
|
+
/** TODO: Deprecate this function */
|
|
128
|
+
on: (...args: any[]) => any;
|
|
129
|
+
registerModule: (module: string, manifest: string) => void;
|
|
130
|
+
/** @duplicate of "hideGlobalFilter" TODO: deprecate this function */
|
|
131
|
+
removeGlobalFilter: (isHidden?: boolean) => void;
|
|
132
|
+
updateDocumentTitle: (title: string) => void;
|
|
133
|
+
visibilityFunctions: VisibilityFunctions;
|
|
134
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@redhat-cloud-services/types",
|
|
3
|
+
"description": "TypeScript definitions for @redhat-cloud-services common typings",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"main": "",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/RedHatInsights/frontend-components.git",
|
|
13
|
+
"directory": "packages/types"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@patternfly/quickstarts": "^1.4.1-rc.1",
|
|
18
|
+
"@redhat-cloud-services/rbac-client": "^1.0.104",
|
|
19
|
+
"history": "^4.0.0"
|
|
20
|
+
},
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "Apache-2.0"
|
|
23
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": [
|
|
5
|
+
"es6"
|
|
6
|
+
],
|
|
7
|
+
"noImplicitAny": false,
|
|
8
|
+
"noImplicitThis": true,
|
|
9
|
+
"strictNullChecks": true,
|
|
10
|
+
"strictFunctionTypes": true,
|
|
11
|
+
"types": [],
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"index.d.ts",
|
|
17
|
+
]
|
|
18
|
+
}
|