@cortezaproject/corteza-vue 2024.9.1 → 2024.9.2-dev.2
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/dist/components/c3/Controls/index.d.ts +22 -22
- package/dist/components/c3/helpers.d.ts +28 -28
- package/dist/components/c3/index.d.ts +7 -7
- package/dist/components/chart/index.d.ts +1 -1
- package/dist/components/corredor/index.d.ts +1 -1
- package/dist/components/filePreview/index.d.ts +3 -3
- package/dist/components/hint/index.d.ts +1 -1
- package/dist/components/index.d.ts +22 -22
- package/dist/components/input/CInputDateTime/lib/index.d.ts +4 -4
- package/dist/components/input/button/index.d.ts +1 -1
- package/dist/components/input/index.d.ts +13 -14
- package/dist/components/itemPicker/index.d.ts +2 -2
- package/dist/components/lightbox/index.d.ts +1 -1
- package/dist/components/loader/index.d.ts +1 -1
- package/dist/components/map/index.d.ts +1 -1
- package/dist/components/navigation/index.d.ts +3 -3
- package/dist/components/permissions/def.d.ts +14 -14
- package/dist/components/permissions/index.d.ts +2 -2
- package/dist/components/privacy/index.d.ts +1 -1
- package/dist/components/progress/index.d.ts +1 -1
- package/dist/components/prompts/definitions.d.ts +2 -2
- package/dist/components/prompts/index.d.ts +4 -4
- package/dist/components/prompts/kinds/index.d.ts +22 -22
- package/dist/components/prompts/utils.d.ts +3 -3
- package/dist/components/reminders/index.d.ts +1 -1
- package/dist/components/reporter/index.d.ts +4 -4
- package/dist/components/resourceList/index.d.ts +1 -1
- package/dist/components/toaster/index.d.ts +2 -2
- package/dist/components/toolbar/index.d.ts +1 -1
- package/dist/components/webcam/index.d.ts +1 -1
- package/dist/components/wrapper/index.d.ts +1 -1
- package/dist/corredor/compose-ctx.d.ts +32 -32
- package/dist/corredor/compose-ui.d.ts +105 -105
- package/dist/corredor/index.d.ts +3 -3
- package/dist/corredor/webapp-ctx.d.ts +11 -11
- package/dist/filters/date.d.ts +2 -2
- package/dist/filters/index.d.ts +2 -2
- package/dist/filters/url.d.ts +1 -1
- package/dist/i18n.d.ts +40 -40
- package/dist/index.d.ts +12 -12
- package/dist/index.es.js +26148 -92742
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +26224 -92803
- package/dist/index.js.map +1 -1
- package/dist/libs/filter.d.ts +3 -3
- package/dist/libs/handle.d.ts +4 -4
- package/dist/libs/url.d.ts +12 -12
- package/dist/libs/websocket.d.ts +23 -23
- package/dist/mixins/index.d.ts +3 -3
- package/dist/plugins/auth.d.ts +214 -214
- package/dist/plugins/corteza-api.d.ts +15 -15
- package/dist/plugins/eventbus.d.ts +3 -3
- package/dist/plugins/index.d.ts +7 -7
- package/dist/plugins/ui-hooks.d.ts +74 -74
- package/dist/store/RBAC.d.ts +15 -15
- package/dist/store/index.d.ts +2 -2
- package/dist/store/wf-prompts/index.d.ts +21 -21
- package/package.json +80 -112
- package/dist/components/Tour/index.d.ts +0 -2
- package/dist/components/c3/C3.d.ts +0 -5
- package/dist/components/filePreview/common/index.d.ts +0 -2
- package/dist/components/filePreview/common/types/PDF/helpers.d.ts +0 -53
- package/dist/components/filePreview/common/types/index.d.ts +0 -3
- package/dist/components/input/CRichTextInput/RToolbar/TMark/loader.d.ts +0 -10
- package/dist/components/input/CRichTextInput/RToolbar/TNode/loader.d.ts +0 -6
- package/dist/components/input/CRichTextInput/RToolbar/TNodeAttr/loader.d.ts +0 -8
- package/dist/components/input/CRichTextInput/RToolbar/loader.d.ts +0 -9
- package/dist/components/input/CRichTextInput/extensions/heading.d.ts +0 -12
- package/dist/components/input/CRichTextInput/extensions/htmlPaster.d.ts +0 -4
- package/dist/components/input/CRichTextInput/extensions/index.d.ts +0 -6
- package/dist/components/input/CRichTextInput/extensions/link.d.ts +0 -6
- package/dist/components/input/CRichTextInput/extensions/paragraph.d.ts +0 -9
- package/dist/components/input/CRichTextInput/extensions/textBackground.d.ts +0 -23
- package/dist/components/input/CRichTextInput/extensions/textColor.d.ts +0 -23
- package/dist/components/input/CRichTextInput/extensions/utils.d.ts +0 -15
- package/dist/components/input/CRichTextInput/lib/formats.d.ts +0 -107
- package/dist/components/input/CRichTextInput/lib/index.d.ts +0 -1
- package/dist/components/itemPicker/C3.d.ts +0 -1
- package/dist/components/itemPicker/CItemPicker.c3.d.ts +0 -32
- package/dist/components/toaster/actions/index.d.ts +0 -3
- package/dist/mixins/corredor.d.ts +0 -49
- package/dist/mixins/files.d.ts +0 -19
- package/dist/mixins/vue-select-position.d.ts +0 -11
- package/dist/plugins/reminder.d.ts +0 -66
- package/dist/plugins/settings.d.ts +0 -27
package/dist/libs/filter.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function AssertStrict(obj: any, query: string, field?: string, ...fields: Array<string>): boolean;
|
|
2
|
-
export declare function AssertFuzzy(obj: any, query: string, field?: string, ...fields: Array<string>): boolean;
|
|
3
|
-
export declare function Assert(obj: any, query: string, field?: string, ...fields: Array<string>): boolean;
|
|
1
|
+
export declare function AssertStrict(obj: any, query: string, field?: string, ...fields: Array<string>): boolean;
|
|
2
|
+
export declare function AssertFuzzy(obj: any, query: string, field?: string, ...fields: Array<string>): boolean;
|
|
3
|
+
export declare function Assert(obj: any, query: string, field?: string, ...fields: Array<string>): boolean;
|
package/dist/libs/handle.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const isValid: (h: string) => boolean;
|
|
2
|
-
export declare function handleState(h: string): false | null | undefined;
|
|
3
|
-
export declare const classNamePattern: RegExp;
|
|
4
|
-
export declare function classState(str: string): false | null | undefined;
|
|
1
|
+
export declare const isValid: (h: string) => boolean;
|
|
2
|
+
export declare function handleState(h: string): false | null | undefined;
|
|
3
|
+
export declare const classNamePattern: RegExp;
|
|
4
|
+
export declare function classState(str: string): false | null | undefined;
|
package/dist/libs/url.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Little URL helper
|
|
3
|
-
*
|
|
4
|
-
* We need it to handle relative URLs, especially ones w/o schema
|
|
5
|
-
*/
|
|
6
|
-
export declare function Make({ url, query, hash, ref, config }: {
|
|
7
|
-
url?: string | undefined;
|
|
8
|
-
query?: {} | undefined;
|
|
9
|
-
hash?: string | undefined;
|
|
10
|
-
ref?: string | undefined;
|
|
11
|
-
config?: {} | undefined;
|
|
12
|
-
}): string;
|
|
1
|
+
/**
|
|
2
|
+
* Little URL helper
|
|
3
|
+
*
|
|
4
|
+
* We need it to handle relative URLs, especially ones w/o schema
|
|
5
|
+
*/
|
|
6
|
+
export declare function Make({ url, query, hash, ref, config }: {
|
|
7
|
+
url?: string | undefined;
|
|
8
|
+
query?: {} | undefined;
|
|
9
|
+
hash?: string | undefined;
|
|
10
|
+
ref?: string | undefined;
|
|
11
|
+
config?: {} | undefined;
|
|
12
|
+
}): string;
|
package/dist/libs/websocket.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default websocket configuration
|
|
3
|
-
*/
|
|
4
|
-
import { Vue } from 'vue/types/vue';
|
|
5
|
-
export declare const config: {
|
|
6
|
-
format: string;
|
|
7
|
-
reconnection: boolean;
|
|
8
|
-
reconnectionAttempts: number;
|
|
9
|
-
reconnectionDelay: number;
|
|
10
|
-
connectManually: boolean;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Extract websocket endpoint from window props (set via config.js)
|
|
14
|
-
*/
|
|
15
|
-
export declare function endpoint(): string;
|
|
16
|
-
/**
|
|
17
|
-
* Binds auth and websocket events so that we can pass current access token
|
|
18
|
-
* - when ws connection opens
|
|
19
|
-
* - when auth token in fetched/renewed
|
|
20
|
-
*
|
|
21
|
-
* @todo get rid of ts-ignore lines
|
|
22
|
-
*/
|
|
23
|
-
export declare function init(vue: Vue): void;
|
|
1
|
+
/**
|
|
2
|
+
* Default websocket configuration
|
|
3
|
+
*/
|
|
4
|
+
import { Vue } from 'vue/types/vue';
|
|
5
|
+
export declare const config: {
|
|
6
|
+
format: string;
|
|
7
|
+
reconnection: boolean;
|
|
8
|
+
reconnectionAttempts: number;
|
|
9
|
+
reconnectionDelay: number;
|
|
10
|
+
connectManually: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Extract websocket endpoint from window props (set via config.js)
|
|
14
|
+
*/
|
|
15
|
+
export declare function endpoint(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Binds auth and websocket events so that we can pass current access token
|
|
18
|
+
* - when ws connection opens
|
|
19
|
+
* - when auth token in fetched/renewed
|
|
20
|
+
*
|
|
21
|
+
* @todo get rid of ts-ignore lines
|
|
22
|
+
*/
|
|
23
|
+
export declare function init(vue: Vue): void;
|
package/dist/mixins/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as corredor } from './corredor';
|
|
2
|
-
export { default as files } from './files';
|
|
3
|
-
export { default as vueSelectPosition } from './vue-select-position';
|
|
1
|
+
export { default as corredor } from './corredor';
|
|
2
|
+
export { default as files } from './files';
|
|
3
|
+
export { default as vueSelectPosition } from './vue-select-position';
|
package/dist/plugins/auth.d.ts
CHANGED
|
@@ -1,214 +1,214 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { system } from '@cortezaproject/corteza-js';
|
|
3
|
-
import { PluginFunction } from 'vue';
|
|
4
|
-
declare const accessToken: unique symbol;
|
|
5
|
-
declare const user: unique symbol;
|
|
6
|
-
|
|
7
|
-
interface AuthInfo {
|
|
8
|
-
accessTokenFn: () => string | undefined;
|
|
9
|
-
user: system.User;
|
|
10
|
-
}
|
|
11
|
-
interface PluginOpts {
|
|
12
|
-
cortezaAuthURL: string;
|
|
13
|
-
callbackURL: string;
|
|
14
|
-
}
|
|
15
|
-
interface AuthCtor {
|
|
16
|
-
app: string;
|
|
17
|
-
/**
|
|
18
|
-
* when true, use console as a logger, no-op otherwise.
|
|
19
|
-
*/
|
|
20
|
-
verbose: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* where the authe backend is
|
|
23
|
-
*/
|
|
24
|
-
cortezaAuthURL: string;
|
|
25
|
-
/**
|
|
26
|
-
* URL we'll be listening to for callbacksa
|
|
27
|
-
*/
|
|
28
|
-
callbackURL: string;
|
|
29
|
-
/**
|
|
30
|
-
* used for redirection
|
|
31
|
-
*/
|
|
32
|
-
location: Location;
|
|
33
|
-
/**
|
|
34
|
-
* used for storing
|
|
35
|
-
*/
|
|
36
|
-
sessionStorage: Storage;
|
|
37
|
-
/**
|
|
38
|
-
* used for event listeners
|
|
39
|
-
*/
|
|
40
|
-
registerEventListener: eventListenerSignature;
|
|
41
|
-
/**
|
|
42
|
-
* Static string with entry-point URL stored at app init
|
|
43
|
-
* so that there is no risk of changes when Vue router gets it's hands on it
|
|
44
|
-
*/
|
|
45
|
-
entrypointURL: string;
|
|
46
|
-
/**
|
|
47
|
-
* multiply factor for token expiration
|
|
48
|
-
* this will tell internal refresh system how much
|
|
49
|
-
* before the token expiration we'll refresh the access toke
|
|
50
|
-
*
|
|
51
|
-
* keep in mind that access token is exchanged on every app load
|
|
52
|
-
*/
|
|
53
|
-
refreshFactor: number;
|
|
54
|
-
}
|
|
55
|
-
interface Logger {
|
|
56
|
-
debug(...data: unknown[]): void;
|
|
57
|
-
info(...data: unknown[]): void;
|
|
58
|
-
error(...data: unknown[]): void;
|
|
59
|
-
}
|
|
60
|
-
export declare class Auth {
|
|
61
|
-
/**
|
|
62
|
-
* Access token is only stored here (in-memory)!
|
|
63
|
-
* we do not want to keep it in the local store
|
|
64
|
-
*/
|
|
65
|
-
private [accessToken]?;
|
|
66
|
-
/**
|
|
67
|
-
* Access token is only stored here (in-memory)!
|
|
68
|
-
* we do not want to keep it in the local store
|
|
69
|
-
*/
|
|
70
|
-
private [user]?;
|
|
71
|
-
/**
|
|
72
|
-
* Name of the app that is using the auth plugin
|
|
73
|
-
*/
|
|
74
|
-
readonly app: string;
|
|
75
|
-
readonly refreshFactor: number;
|
|
76
|
-
readonly verbose: boolean;
|
|
77
|
-
readonly cortezaAuthURL: string;
|
|
78
|
-
readonly callbackURL: string;
|
|
79
|
-
readonly location: Location;
|
|
80
|
-
readonly sessionStorage: Storage;
|
|
81
|
-
readonly registerEventListener: eventListenerSignature;
|
|
82
|
-
/**
|
|
83
|
-
* Application entrypoint URL
|
|
84
|
-
*/
|
|
85
|
-
readonly entrypointURL: string;
|
|
86
|
-
/**
|
|
87
|
-
* Keeps track of timeout callback in case we re-run it before it timesout
|
|
88
|
-
* @private
|
|
89
|
-
*/
|
|
90
|
-
private refreshTimeout?;
|
|
91
|
-
private $emit?;
|
|
92
|
-
constructor({ app, verbose, cortezaAuthURL, callbackURL, entrypointURL, location, sessionStorage, refreshFactor, registerEventListener }: AuthCtor);
|
|
93
|
-
vue(vue: Vue): Auth;
|
|
94
|
-
get axios(): AxiosInstance;
|
|
95
|
-
/**
|
|
96
|
-
* wrapper for console (when in debug mode) or a simple no-op obj
|
|
97
|
-
*/
|
|
98
|
-
get log(): Logger;
|
|
99
|
-
/**
|
|
100
|
-
* Returns function that returns current access token
|
|
101
|
-
*/
|
|
102
|
-
get accessTokenFn(): () => string | undefined;
|
|
103
|
-
/**
|
|
104
|
-
* Handles initial authentication check
|
|
105
|
-
*
|
|
106
|
-
* handle function should be called immediately when application is created
|
|
107
|
-
* it checks whether app was requested on an URL with /auth/callback at the end
|
|
108
|
-
* if there is an error or code passed and handles that request appropriately:
|
|
109
|
-
*
|
|
110
|
-
* .../auth/callback?code=... exchanged authorization code for access token
|
|
111
|
-
* .../auth/callback?error=... renders an error that we got from the oauth2 provider
|
|
112
|
-
*
|
|
113
|
-
* If handle was called without /auth/callback or without params mentioned above:
|
|
114
|
-
* if user is not authorized, redirect to the configured path to start oauth2 flow
|
|
115
|
-
* if user is authorized, continue with execution
|
|
116
|
-
*/
|
|
117
|
-
handle(req?: URL): Promise<AuthInfo | null>;
|
|
118
|
-
/**
|
|
119
|
-
* Flagging session storage
|
|
120
|
-
*
|
|
121
|
-
* Challenge with sessions and browser tabs:
|
|
122
|
-
* Each browser tab & window interacts with an isolated session. When user clicks on a link to and wants to open
|
|
123
|
-
* it in a new window or a tab, or when tab is duplicated, session contents are copied!
|
|
124
|
-
*
|
|
125
|
-
* Consequences of that are that two (or more) tabs end up with the same session
|
|
126
|
-
* and the same refresh token, and we need to detect if we're dealing with refresh token in an old or new session.
|
|
127
|
-
*
|
|
128
|
-
* With this function we start the final state and flag the session. This way we'll
|
|
129
|
-
* know, after the redirection to the final location, if this is a final stage or not and if the refresh token
|
|
130
|
-
* belongs to this session or not.
|
|
131
|
-
*/
|
|
132
|
-
handleStateManagement(): boolean;
|
|
133
|
-
bindListeners(): void;
|
|
134
|
-
cleanFlags(): void;
|
|
135
|
-
/**
|
|
136
|
-
* Called when refresh token is re-fetched.
|
|
137
|
-
*
|
|
138
|
-
* Cleanup aux items in the session store
|
|
139
|
-
*/
|
|
140
|
-
completeFinalState(): void;
|
|
141
|
-
/**
|
|
142
|
-
* Exchanges the auth parameters for access & refresh token.
|
|
143
|
-
*
|
|
144
|
-
* If the parameters are correct and exchange is successful, the refresh token
|
|
145
|
-
* gets stored in localStorage for further use, the access token and current user get stored
|
|
146
|
-
* in-memory.
|
|
147
|
-
*
|
|
148
|
-
* Function will throw null when user is unauthenticated
|
|
149
|
-
*/
|
|
150
|
-
handleCallbackRoute(state: string | null, code: string): Promise<AuthInfo | null>;
|
|
151
|
-
/**
|
|
152
|
-
* Checks current auth state; is access token loaded OR do we have a refresh token we can use
|
|
153
|
-
*
|
|
154
|
-
* check uses system API client verify given/current JWT
|
|
155
|
-
*
|
|
156
|
-
* If JWT is valid, it is stored into local storage alongside
|
|
157
|
-
* loaded user.
|
|
158
|
-
*
|
|
159
|
-
* We're explicitly passing systemAPI to minimize plugin initialization complexity
|
|
160
|
-
*
|
|
161
|
-
* Function will throw null when user is unauthenticated
|
|
162
|
-
*/
|
|
163
|
-
handleState(): Promise<AuthInfo | null>;
|
|
164
|
-
logout(): void;
|
|
165
|
-
/**
|
|
166
|
-
* Starts new authentication flow
|
|
167
|
-
*
|
|
168
|
-
* It generates simple rand state to harden security and to
|
|
169
|
-
* keep track of before-flow-start location of the user
|
|
170
|
-
*/
|
|
171
|
-
startAuthenticationFlow(): void;
|
|
172
|
-
getRedirect(url: string): string;
|
|
173
|
-
isCallback(url: string): boolean;
|
|
174
|
-
/**
|
|
175
|
-
* protects against too many tries when we try to auto-fix the "state does not match" error
|
|
176
|
-
* by restarting the aut flow.
|
|
177
|
-
*/
|
|
178
|
-
private incFlowCounter;
|
|
179
|
-
/**
|
|
180
|
-
* Exchanges authorization code for access and refresh tokens
|
|
181
|
-
*/
|
|
182
|
-
private exchangeCode;
|
|
183
|
-
/**
|
|
184
|
-
* Exchanges refresh token for new access and new refresh token
|
|
185
|
-
*
|
|
186
|
-
* After successful token exchange, we call response processing function
|
|
187
|
-
* to update internals & stored values
|
|
188
|
-
*
|
|
189
|
-
* @param refreshToken
|
|
190
|
-
*/
|
|
191
|
-
private exchangeRefresh;
|
|
192
|
-
/**
|
|
193
|
-
* Processes fetched token and stores it
|
|
194
|
-
*
|
|
195
|
-
* Access token is stored only to instance of this object
|
|
196
|
-
* Refresh token is stored only to local store
|
|
197
|
-
*
|
|
198
|
-
* @param oa2tkn OAuth2 token response
|
|
199
|
-
* @private
|
|
200
|
-
*/
|
|
201
|
-
private procTokenResponse;
|
|
202
|
-
/**
|
|
203
|
-
* oauth2token exchanges authorization code or refresh token for (new) access token
|
|
204
|
-
*
|
|
205
|
-
* @param payload
|
|
206
|
-
* @private
|
|
207
|
-
*/
|
|
208
|
-
private oauth2token;
|
|
209
|
-
private pruneStore;
|
|
210
|
-
get accessToken(): string | undefined;
|
|
211
|
-
get user(): system.User | undefined;
|
|
212
|
-
}
|
|
213
|
-
export default function (): PluginFunction<PluginOpts>;
|
|
214
|
-
export {};
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { system } from '@cortezaproject/corteza-js';
|
|
3
|
+
import { PluginFunction } from 'vue';
|
|
4
|
+
declare const accessToken: unique symbol;
|
|
5
|
+
declare const user: unique symbol;
|
|
6
|
+
type eventListenerSignature = <K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions) => void;
|
|
7
|
+
interface AuthInfo {
|
|
8
|
+
accessTokenFn: () => string | undefined;
|
|
9
|
+
user: system.User;
|
|
10
|
+
}
|
|
11
|
+
interface PluginOpts {
|
|
12
|
+
cortezaAuthURL: string;
|
|
13
|
+
callbackURL: string;
|
|
14
|
+
}
|
|
15
|
+
interface AuthCtor {
|
|
16
|
+
app: string;
|
|
17
|
+
/**
|
|
18
|
+
* when true, use console as a logger, no-op otherwise.
|
|
19
|
+
*/
|
|
20
|
+
verbose: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* where the authe backend is
|
|
23
|
+
*/
|
|
24
|
+
cortezaAuthURL: string;
|
|
25
|
+
/**
|
|
26
|
+
* URL we'll be listening to for callbacksa
|
|
27
|
+
*/
|
|
28
|
+
callbackURL: string;
|
|
29
|
+
/**
|
|
30
|
+
* used for redirection
|
|
31
|
+
*/
|
|
32
|
+
location: Location;
|
|
33
|
+
/**
|
|
34
|
+
* used for storing
|
|
35
|
+
*/
|
|
36
|
+
sessionStorage: Storage;
|
|
37
|
+
/**
|
|
38
|
+
* used for event listeners
|
|
39
|
+
*/
|
|
40
|
+
registerEventListener: eventListenerSignature;
|
|
41
|
+
/**
|
|
42
|
+
* Static string with entry-point URL stored at app init
|
|
43
|
+
* so that there is no risk of changes when Vue router gets it's hands on it
|
|
44
|
+
*/
|
|
45
|
+
entrypointURL: string;
|
|
46
|
+
/**
|
|
47
|
+
* multiply factor for token expiration
|
|
48
|
+
* this will tell internal refresh system how much
|
|
49
|
+
* before the token expiration we'll refresh the access toke
|
|
50
|
+
*
|
|
51
|
+
* keep in mind that access token is exchanged on every app load
|
|
52
|
+
*/
|
|
53
|
+
refreshFactor: number;
|
|
54
|
+
}
|
|
55
|
+
interface Logger {
|
|
56
|
+
debug(...data: unknown[]): void;
|
|
57
|
+
info(...data: unknown[]): void;
|
|
58
|
+
error(...data: unknown[]): void;
|
|
59
|
+
}
|
|
60
|
+
export declare class Auth {
|
|
61
|
+
/**
|
|
62
|
+
* Access token is only stored here (in-memory)!
|
|
63
|
+
* we do not want to keep it in the local store
|
|
64
|
+
*/
|
|
65
|
+
private [accessToken]?;
|
|
66
|
+
/**
|
|
67
|
+
* Access token is only stored here (in-memory)!
|
|
68
|
+
* we do not want to keep it in the local store
|
|
69
|
+
*/
|
|
70
|
+
private [user]?;
|
|
71
|
+
/**
|
|
72
|
+
* Name of the app that is using the auth plugin
|
|
73
|
+
*/
|
|
74
|
+
readonly app: string;
|
|
75
|
+
readonly refreshFactor: number;
|
|
76
|
+
readonly verbose: boolean;
|
|
77
|
+
readonly cortezaAuthURL: string;
|
|
78
|
+
readonly callbackURL: string;
|
|
79
|
+
readonly location: Location;
|
|
80
|
+
readonly sessionStorage: Storage;
|
|
81
|
+
readonly registerEventListener: eventListenerSignature;
|
|
82
|
+
/**
|
|
83
|
+
* Application entrypoint URL
|
|
84
|
+
*/
|
|
85
|
+
readonly entrypointURL: string;
|
|
86
|
+
/**
|
|
87
|
+
* Keeps track of timeout callback in case we re-run it before it timesout
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
private refreshTimeout?;
|
|
91
|
+
private $emit?;
|
|
92
|
+
constructor({ app, verbose, cortezaAuthURL, callbackURL, entrypointURL, location, sessionStorage, refreshFactor, registerEventListener }: AuthCtor);
|
|
93
|
+
vue(vue: Vue): Auth;
|
|
94
|
+
get axios(): AxiosInstance;
|
|
95
|
+
/**
|
|
96
|
+
* wrapper for console (when in debug mode) or a simple no-op obj
|
|
97
|
+
*/
|
|
98
|
+
get log(): Logger;
|
|
99
|
+
/**
|
|
100
|
+
* Returns function that returns current access token
|
|
101
|
+
*/
|
|
102
|
+
get accessTokenFn(): () => string | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Handles initial authentication check
|
|
105
|
+
*
|
|
106
|
+
* handle function should be called immediately when application is created
|
|
107
|
+
* it checks whether app was requested on an URL with /auth/callback at the end
|
|
108
|
+
* if there is an error or code passed and handles that request appropriately:
|
|
109
|
+
*
|
|
110
|
+
* .../auth/callback?code=... exchanged authorization code for access token
|
|
111
|
+
* .../auth/callback?error=... renders an error that we got from the oauth2 provider
|
|
112
|
+
*
|
|
113
|
+
* If handle was called without /auth/callback or without params mentioned above:
|
|
114
|
+
* if user is not authorized, redirect to the configured path to start oauth2 flow
|
|
115
|
+
* if user is authorized, continue with execution
|
|
116
|
+
*/
|
|
117
|
+
handle(req?: URL): Promise<AuthInfo | null>;
|
|
118
|
+
/**
|
|
119
|
+
* Flagging session storage
|
|
120
|
+
*
|
|
121
|
+
* Challenge with sessions and browser tabs:
|
|
122
|
+
* Each browser tab & window interacts with an isolated session. When user clicks on a link to and wants to open
|
|
123
|
+
* it in a new window or a tab, or when tab is duplicated, session contents are copied!
|
|
124
|
+
*
|
|
125
|
+
* Consequences of that are that two (or more) tabs end up with the same session
|
|
126
|
+
* and the same refresh token, and we need to detect if we're dealing with refresh token in an old or new session.
|
|
127
|
+
*
|
|
128
|
+
* With this function we start the final state and flag the session. This way we'll
|
|
129
|
+
* know, after the redirection to the final location, if this is a final stage or not and if the refresh token
|
|
130
|
+
* belongs to this session or not.
|
|
131
|
+
*/
|
|
132
|
+
handleStateManagement(): boolean;
|
|
133
|
+
bindListeners(): void;
|
|
134
|
+
cleanFlags(): void;
|
|
135
|
+
/**
|
|
136
|
+
* Called when refresh token is re-fetched.
|
|
137
|
+
*
|
|
138
|
+
* Cleanup aux items in the session store
|
|
139
|
+
*/
|
|
140
|
+
completeFinalState(): void;
|
|
141
|
+
/**
|
|
142
|
+
* Exchanges the auth parameters for access & refresh token.
|
|
143
|
+
*
|
|
144
|
+
* If the parameters are correct and exchange is successful, the refresh token
|
|
145
|
+
* gets stored in localStorage for further use, the access token and current user get stored
|
|
146
|
+
* in-memory.
|
|
147
|
+
*
|
|
148
|
+
* Function will throw null when user is unauthenticated
|
|
149
|
+
*/
|
|
150
|
+
handleCallbackRoute(state: string | null, code: string): Promise<AuthInfo | null>;
|
|
151
|
+
/**
|
|
152
|
+
* Checks current auth state; is access token loaded OR do we have a refresh token we can use
|
|
153
|
+
*
|
|
154
|
+
* check uses system API client verify given/current JWT
|
|
155
|
+
*
|
|
156
|
+
* If JWT is valid, it is stored into local storage alongside
|
|
157
|
+
* loaded user.
|
|
158
|
+
*
|
|
159
|
+
* We're explicitly passing systemAPI to minimize plugin initialization complexity
|
|
160
|
+
*
|
|
161
|
+
* Function will throw null when user is unauthenticated
|
|
162
|
+
*/
|
|
163
|
+
handleState(): Promise<AuthInfo | null>;
|
|
164
|
+
logout(): void;
|
|
165
|
+
/**
|
|
166
|
+
* Starts new authentication flow
|
|
167
|
+
*
|
|
168
|
+
* It generates simple rand state to harden security and to
|
|
169
|
+
* keep track of before-flow-start location of the user
|
|
170
|
+
*/
|
|
171
|
+
startAuthenticationFlow(): void;
|
|
172
|
+
getRedirect(url: string): string;
|
|
173
|
+
isCallback(url: string): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* protects against too many tries when we try to auto-fix the "state does not match" error
|
|
176
|
+
* by restarting the aut flow.
|
|
177
|
+
*/
|
|
178
|
+
private incFlowCounter;
|
|
179
|
+
/**
|
|
180
|
+
* Exchanges authorization code for access and refresh tokens
|
|
181
|
+
*/
|
|
182
|
+
private exchangeCode;
|
|
183
|
+
/**
|
|
184
|
+
* Exchanges refresh token for new access and new refresh token
|
|
185
|
+
*
|
|
186
|
+
* After successful token exchange, we call response processing function
|
|
187
|
+
* to update internals & stored values
|
|
188
|
+
*
|
|
189
|
+
* @param refreshToken
|
|
190
|
+
*/
|
|
191
|
+
private exchangeRefresh;
|
|
192
|
+
/**
|
|
193
|
+
* Processes fetched token and stores it
|
|
194
|
+
*
|
|
195
|
+
* Access token is stored only to instance of this object
|
|
196
|
+
* Refresh token is stored only to local store
|
|
197
|
+
*
|
|
198
|
+
* @param oa2tkn OAuth2 token response
|
|
199
|
+
* @private
|
|
200
|
+
*/
|
|
201
|
+
private procTokenResponse;
|
|
202
|
+
/**
|
|
203
|
+
* oauth2token exchanges authorization code or refresh token for (new) access token
|
|
204
|
+
*
|
|
205
|
+
* @param payload
|
|
206
|
+
* @private
|
|
207
|
+
*/
|
|
208
|
+
private oauth2token;
|
|
209
|
+
private pruneStore;
|
|
210
|
+
get accessToken(): string | undefined;
|
|
211
|
+
get user(): system.User | undefined;
|
|
212
|
+
}
|
|
213
|
+
export default function (): PluginFunction<PluginOpts>;
|
|
214
|
+
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { PluginFunction } from 'vue';
|
|
2
|
-
interface Options {
|
|
3
|
-
baseURL?: string;
|
|
4
|
-
accessTokenFn?: () => string | undefined;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Generic Corteza API plugin
|
|
8
|
-
*
|
|
9
|
-
* Install a specific plugin:
|
|
10
|
-
* Vue.use(plugins.CortezaAPI('compose'))
|
|
11
|
-
*
|
|
12
|
-
* @constructor
|
|
13
|
-
*/
|
|
14
|
-
export default function (service: string, opt?: Options): PluginFunction<Options>;
|
|
15
|
-
export {};
|
|
1
|
+
import { PluginFunction } from 'vue';
|
|
2
|
+
interface Options {
|
|
3
|
+
baseURL?: string;
|
|
4
|
+
accessTokenFn?: () => string | undefined;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Generic Corteza API plugin
|
|
8
|
+
*
|
|
9
|
+
* Install a specific plugin:
|
|
10
|
+
* Vue.use(plugins.CortezaAPI('compose'))
|
|
11
|
+
*
|
|
12
|
+
* @constructor
|
|
13
|
+
*/
|
|
14
|
+
export default function (service: string, opt?: Options): PluginFunction<Options>;
|
|
15
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PluginFunction } from 'vue';
|
|
2
|
-
import { eventbus } from '@cortezaproject/corteza-js';
|
|
3
|
-
export default function (): PluginFunction<Partial<eventbus.Options>>;
|
|
1
|
+
import { PluginFunction } from 'vue';
|
|
2
|
+
import { eventbus } from '@cortezaproject/corteza-js';
|
|
3
|
+
export default function (): PluginFunction<Partial<eventbus.Options>>;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { default as CortezaAPI } from './corteza-api';
|
|
2
|
-
export { default as Auth } from './auth';
|
|
3
|
-
export { default as UIHooks } from './ui-hooks';
|
|
4
|
-
export { default as EventBus } from './eventbus';
|
|
5
|
-
export { default as Settings } from './settings';
|
|
6
|
-
export { default as Reminder } from './reminder';
|
|
7
|
-
export { default as I18n } from '../i18n';
|
|
1
|
+
export { default as CortezaAPI } from './corteza-api';
|
|
2
|
+
export { default as Auth } from './auth';
|
|
3
|
+
export { default as UIHooks } from './ui-hooks';
|
|
4
|
+
export { default as EventBus } from './eventbus';
|
|
5
|
+
export { default as Settings } from './settings';
|
|
6
|
+
export { default as Reminder } from './reminder';
|
|
7
|
+
export { default as I18n } from '../i18n';
|