@cortezaproject/corteza-vue 2024.9.4 → 2024.9.5-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.
Files changed (65) hide show
  1. package/dist/components/index.d.ts +1 -1
  2. package/dist/components/input/index.d.ts +1 -0
  3. package/dist/index.cjs +1702 -4544
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.js +1700 -4542
  6. package/dist/index.js.map +1 -1
  7. package/dist/node_modules/@tiptap/pm/state/index.d.ts +1 -0
  8. package/dist/src/components/auth/index.d.ts +1 -0
  9. package/dist/src/components/c3/Controls/index.d.ts +22 -0
  10. package/dist/src/components/c3/helpers.d.ts +29 -0
  11. package/dist/src/components/c3/index.d.ts +7 -0
  12. package/dist/src/components/chart/index.d.ts +1 -0
  13. package/dist/src/components/corredor/index.d.ts +1 -0
  14. package/dist/src/components/filePreview/index.d.ts +3 -0
  15. package/dist/src/components/hint/index.d.ts +1 -0
  16. package/dist/src/components/index.d.ts +24 -0
  17. package/dist/src/components/input/CInputDateTime/lib/index.d.ts +4 -0
  18. package/dist/src/components/input/button/index.d.ts +1 -0
  19. package/dist/src/components/input/index.d.ts +15 -0
  20. package/dist/src/components/itemPicker/index.d.ts +2 -0
  21. package/dist/src/components/lightbox/index.d.ts +1 -0
  22. package/dist/src/components/loader/index.d.ts +1 -0
  23. package/dist/src/components/map/index.d.ts +1 -0
  24. package/dist/src/components/navigation/index.d.ts +3 -0
  25. package/dist/src/components/notifications/index.d.ts +2 -0
  26. package/dist/src/components/notifications/types/index.d.ts +6 -0
  27. package/dist/src/components/permissions/def.d.ts +14 -0
  28. package/dist/src/components/permissions/index.d.ts +2 -0
  29. package/dist/src/components/privacy/index.d.ts +1 -0
  30. package/dist/src/components/progress/index.d.ts +1 -0
  31. package/dist/src/components/prompts/definitions.d.ts +2 -0
  32. package/dist/src/components/prompts/index.d.ts +4 -0
  33. package/dist/src/components/prompts/kinds/index.d.ts +22 -0
  34. package/dist/src/components/prompts/utils.d.ts +3 -0
  35. package/dist/src/components/reminders/index.d.ts +1 -0
  36. package/dist/src/components/reporter/index.d.ts +4 -0
  37. package/dist/src/components/resourceList/index.d.ts +1 -0
  38. package/dist/src/components/toaster/index.d.ts +2 -0
  39. package/dist/src/components/toolbar/index.d.ts +1 -0
  40. package/dist/src/components/webcam/index.d.ts +1 -0
  41. package/dist/src/components/wrapper/index.d.ts +1 -0
  42. package/dist/src/corredor/compose-ctx.d.ts +32 -0
  43. package/dist/src/corredor/compose-ui.d.ts +105 -0
  44. package/dist/src/corredor/index.d.ts +3 -0
  45. package/dist/src/corredor/webapp-ctx.d.ts +11 -0
  46. package/dist/src/filters/date.d.ts +2 -0
  47. package/dist/src/filters/index.d.ts +2 -0
  48. package/dist/src/filters/url.d.ts +1 -0
  49. package/dist/src/i18n.d.ts +40 -0
  50. package/dist/src/index.d.ts +12 -0
  51. package/dist/src/libs/filter.d.ts +3 -0
  52. package/dist/src/libs/handle.d.ts +4 -0
  53. package/dist/src/libs/url.d.ts +12 -0
  54. package/dist/src/libs/websocket.d.ts +23 -0
  55. package/dist/src/mixins/index.d.ts +2 -0
  56. package/dist/src/plugins/auth.d.ts +217 -0
  57. package/dist/src/plugins/corteza-api.d.ts +15 -0
  58. package/dist/src/plugins/eventbus.d.ts +3 -0
  59. package/dist/src/plugins/index.d.ts +7 -0
  60. package/dist/src/plugins/ui-hooks.d.ts +74 -0
  61. package/dist/src/store/RBAC.d.ts +15 -0
  62. package/dist/src/store/index.d.ts +3 -0
  63. package/dist/src/store/notifications/index.d.ts +16 -0
  64. package/dist/src/store/wf-prompts/index.d.ts +21 -0
  65. package/package.json +17 -6
@@ -0,0 +1,217 @@
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 expiresIn;
92
+ private $emit?;
93
+ constructor({ app, verbose, cortezaAuthURL, callbackURL, entrypointURL, location, sessionStorage, refreshFactor, registerEventListener }: AuthCtor);
94
+ vue(vue: Vue): Auth;
95
+ get axios(): AxiosInstance;
96
+ /**
97
+ * wrapper for console (when in debug mode) or a simple no-op obj
98
+ */
99
+ get log(): Logger;
100
+ /**
101
+ * Returns function that returns current access token
102
+ */
103
+ get accessTokenFn(): () => string | undefined;
104
+ /**
105
+ * Handles initial authentication check
106
+ *
107
+ * handle function should be called immediately when application is created
108
+ * it checks whether app was requested on an URL with /auth/callback at the end
109
+ * if there is an error or code passed and handles that request appropriately:
110
+ *
111
+ * .../auth/callback?code=... exchanged authorization code for access token
112
+ * .../auth/callback?error=... renders an error that we got from the oauth2 provider
113
+ *
114
+ * If handle was called without /auth/callback or without params mentioned above:
115
+ * if user is not authorized, redirect to the configured path to start oauth2 flow
116
+ * if user is authorized, continue with execution
117
+ */
118
+ handle(req?: URL): Promise<AuthInfo | null>;
119
+ /**
120
+ * Flagging session storage
121
+ *
122
+ * Challenge with sessions and browser tabs:
123
+ * Each browser tab & window interacts with an isolated session. When user clicks on a link to and wants to open
124
+ * it in a new window or a tab, or when tab is duplicated, session contents are copied!
125
+ *
126
+ * Consequences of that are that two (or more) tabs end up with the same session
127
+ * and the same refresh token, and we need to detect if we're dealing with refresh token in an old or new session.
128
+ *
129
+ * With this function we start the final state and flag the session. This way we'll
130
+ * know, after the redirection to the final location, if this is a final stage or not and if the refresh token
131
+ * belongs to this session or not.
132
+ */
133
+ handleStateManagement(): boolean;
134
+ bindListeners(): void;
135
+ cleanFlags(): void;
136
+ /**
137
+ * Called when refresh token is re-fetched.
138
+ *
139
+ * Cleanup aux items in the session store
140
+ */
141
+ completeFinalState(): void;
142
+ /**
143
+ * Exchanges the auth parameters for access & refresh token.
144
+ *
145
+ * If the parameters are correct and exchange is successful, the refresh token
146
+ * gets stored in localStorage for further use, the access token and current user get stored
147
+ * in-memory.
148
+ *
149
+ * Function will throw null when user is unauthenticated
150
+ */
151
+ handleCallbackRoute(state: string | null, code: string): Promise<AuthInfo | null>;
152
+ /**
153
+ * Checks current auth state; is access token loaded OR do we have a refresh token we can use
154
+ *
155
+ * check uses system API client verify given/current JWT
156
+ *
157
+ * If JWT is valid, it is stored into local storage alongside
158
+ * loaded user.
159
+ *
160
+ * We're explicitly passing systemAPI to minimize plugin initialization complexity
161
+ *
162
+ * Function will throw null when user is unauthenticated
163
+ */
164
+ handleState(): Promise<AuthInfo | null>;
165
+ logout(): void;
166
+ /**
167
+ * Starts new authentication flow
168
+ *
169
+ * It generates simple rand state to harden security and to
170
+ * keep track of before-flow-start location of the user
171
+ */
172
+ startAuthenticationFlow(): void;
173
+ getRedirect(url: string): string;
174
+ isCallback(url: string): boolean;
175
+ /**
176
+ * protects against too many tries when we try to auto-fix the "state does not match" error
177
+ * by restarting the aut flow.
178
+ */
179
+ private incFlowCounter;
180
+ startAutoLogout(): Promise<number>;
181
+ stopAutoLogout(): Promise<AuthInfo | null>;
182
+ /**
183
+ * Exchanges authorization code for access and refresh tokens
184
+ */
185
+ private exchangeCode;
186
+ /**
187
+ * Exchanges refresh token for new access and new refresh token
188
+ *
189
+ * After successful token exchange, we call response processing function
190
+ * to update internals & stored values
191
+ *
192
+ * @param refreshToken
193
+ */
194
+ private exchangeRefresh;
195
+ /**
196
+ * Processes fetched token and stores it
197
+ *
198
+ * Access token is stored only to instance of this object
199
+ * Refresh token is stored only to local store
200
+ *
201
+ * @param oa2tkn OAuth2 token response
202
+ * @private
203
+ */
204
+ private procTokenResponse;
205
+ /**
206
+ * oauth2token exchanges authorization code or refresh token for (new) access token
207
+ *
208
+ * @param payload
209
+ * @private
210
+ */
211
+ private oauth2token;
212
+ private pruneStore;
213
+ get accessToken(): string | undefined;
214
+ get user(): system.User | undefined;
215
+ }
216
+ export default function (): PluginFunction<PluginOpts>;
217
+ export {};
@@ -0,0 +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 {};
@@ -0,0 +1,3 @@
1
+ import { PluginFunction } from 'vue';
2
+ import { eventbus } from '@cortezaproject/corteza-js';
3
+ export default function (): PluginFunction<Partial<eventbus.Options>>;
@@ -0,0 +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';
@@ -0,0 +1,74 @@
1
+ import { PluginFunction } from 'vue';
2
+ import { eventbus } from '@cortezaproject/corteza-js';
3
+ interface UIProp {
4
+ name: string;
5
+ value: string;
6
+ }
7
+ interface Trigger {
8
+ resourceTypes: string[];
9
+ eventTypes: string[];
10
+ uiProps: UIProp[];
11
+ constraints: object[];
12
+ weight?: number;
13
+ }
14
+ interface Script {
15
+ name: string;
16
+ label: string;
17
+ description?: string;
18
+ errors?: string[];
19
+ triggers: Trigger[];
20
+ }
21
+ export declare class Button {
22
+ readonly label: string;
23
+ readonly description?: string;
24
+ readonly script: string;
25
+ readonly resourceType: string;
26
+ readonly weight: number;
27
+ readonly variant?: string;
28
+ readonly page?: string;
29
+ readonly slot?: string;
30
+ readonly constraints: eventbus.ConstraintMatcher[];
31
+ constructor(s: Script, t: Trigger);
32
+ }
33
+ /**
34
+ * Consumes scripts that can be triggered manually and converts it to list of buttons
35
+ *
36
+ * These buttons can put manually to various compose page block or
37
+ * positioned automatically on designated pages & slots
38
+ */
39
+ export declare class UIHooks {
40
+ readonly app: string;
41
+ readonly verbose = false;
42
+ protected set: Button[];
43
+ constructor(opt: string | Partial<UIHooks>);
44
+ /**
45
+ * Takes one or more scripts and converts them to buttons
46
+ *
47
+ * With every script added it removes ALL
48
+ * buttons that use the same script
49
+ */
50
+ Register(...scripts: Script[]): void;
51
+ /**
52
+ * Remove all buttons that match a script
53
+ * @param name
54
+ * @constructor
55
+ */
56
+ Unregister({ name }: Script): void;
57
+ /**
58
+ * Searches for buttons that match the requirements
59
+ *
60
+ * This is used in 2 kinds of places:
61
+ * - currated list of buttons in compose blocks where admin can
62
+ * picks, reorder, name and style scripts by hand
63
+ * - different slots on pages where scripts are automatically placed
64
+ *
65
+ * @param resourceType
66
+ * @param page
67
+ * @param slot
68
+ * @constructor
69
+ */
70
+ Find(resourceType: string | string[], page?: string, slot?: string): Button[];
71
+ FindByScript(script: string): Button | undefined;
72
+ }
73
+ export default function (): PluginFunction<Partial<UIHooks>>;
74
+ export {};
@@ -0,0 +1,15 @@
1
+ import { StoreOptions } from 'vuex';
2
+ interface Rule {
3
+ resource: string;
4
+ operation: string;
5
+ allow: boolean;
6
+ }
7
+ interface State {
8
+ loaded: boolean;
9
+ rules: Array<Rule>;
10
+ }
11
+ interface Fetcher {
12
+ permissionsEffective: () => Promise<Array<Rule>>;
13
+ }
14
+ export default function (...apis: Array<Fetcher>): StoreOptions<State>;
15
+ export {};
@@ -0,0 +1,3 @@
1
+ export { default as wfPrompts } from './wf-prompts';
2
+ export { default as RBAC } from './RBAC';
3
+ export { default as notifications } from './notifications';
@@ -0,0 +1,16 @@
1
+ import { apiClients, system } from '@cortezaproject/corteza-js';
2
+ import { StoreOptions } from 'vuex';
3
+ interface Options {
4
+ api: apiClients.System;
5
+ ws: WebSocket;
6
+ watchInterval: number;
7
+ webapp: string;
8
+ }
9
+ interface State {
10
+ notifications: Array<system.Notification>;
11
+ visible: boolean;
12
+ pageCursor: string | null;
13
+ muted: boolean;
14
+ }
15
+ export default function ({ api }: Options): StoreOptions<State>;
16
+ export {};
@@ -0,0 +1,21 @@
1
+ import { apiClients, automation } from '@cortezaproject/corteza-js';
2
+ import { StoreOptions } from 'vuex';
3
+ interface Options {
4
+ api: apiClients.Automation;
5
+ ws: WebSocket;
6
+ watchInterval: number;
7
+ webapp: string;
8
+ }
9
+ interface State {
10
+ loading: boolean;
11
+ prompts: Array<automation.Prompt>;
12
+ /**
13
+ * Is prompt component active (modal open)?
14
+ * prompt = modal is open, show this/current prompt
15
+ * true = modal is open, show list of pending prompts
16
+ * false = modal is closed
17
+ */
18
+ active: automation.Prompt | boolean;
19
+ }
20
+ export default function ({ api, webapp }: Options): StoreOptions<State>;
21
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cortezaproject/corteza-vue",
3
3
  "description": "Corteza Vue.js JavaScript/TypeScript libs",
4
- "version": "2024.9.4",
4
+ "version": "2024.9.5-dev.2",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Denis Arh <denis.arh@crust.tech>",
7
7
  "type": "module",
@@ -30,15 +30,29 @@
30
30
  "resolutions": {
31
31
  "postcss": "^8.5.3",
32
32
  "json5": "^2.2.3",
33
- "loader-utils": "^3.2.0"
33
+ "loader-utils": "^3.2.0",
34
+ "prosemirror-model": "^1.25.0"
34
35
  },
35
36
  "dependencies": {
36
- "@cortezaproject/corteza-js": "^2024.9.4",
37
+ "@cortezaproject/corteza-js": "^2024.9.5-dev.2",
38
+ "@floating-ui/dom": "^1.7.4",
37
39
  "@fortawesome/fontawesome-svg-core": "^6.7.2",
38
40
  "@fortawesome/free-solid-svg-icons": "^6.7.2",
39
41
  "@fortawesome/vue-fontawesome": "^2.0.10",
40
42
  "@panter/vue-i18next": "^0.15.0",
41
43
  "@popperjs/core": "^2.11.8",
44
+ "@tiptap/core": "^3.4.2",
45
+ "@tiptap/extension-list": "^3.4.2",
46
+ "@tiptap/extension-mention": "^3.4.2",
47
+ "@tiptap/extension-placeholder": "^3.4.2",
48
+ "@tiptap/extension-table": "^3.4.2",
49
+ "@tiptap/extension-text-align": "^3.4.2",
50
+ "@tiptap/extension-text-style": "^3.4.2",
51
+ "@tiptap/extensions": "^3.4.2",
52
+ "@tiptap/pm": "^3.4.2",
53
+ "@tiptap/starter-kit": "^3.4.2",
54
+ "@tiptap/suggestion": "^3.4.2",
55
+ "@tiptap/vue-2": "^3.4.2",
42
56
  "bootstrap-vue": "2.23.1",
43
57
  "echarts": "5.6.0",
44
58
  "fuzzysort": "^3.1.0",
@@ -57,14 +71,11 @@
57
71
  "pino": "^9.6.0",
58
72
  "portal-vue": "^3.0.0",
59
73
  "qs": "^6.14.0",
60
- "tiptap": "^1.32.2",
61
- "tiptap-extensions": "^1.35.2",
62
74
  "v-photoswipe": "^1.0.3-1",
63
75
  "vue": "2.7.16",
64
76
  "vue-color": "^2.8.1",
65
77
  "vue-echarts": "7.0.3",
66
78
  "vue-select": "3.20.3",
67
- "vue-swatches": "^2.1.1",
68
79
  "vue2-ace-editor": "^0.0.15",
69
80
  "vue2-leaflet": "^2.7.1",
70
81
  "vuedraggable": "^2.24.3",