@ws-ui/store 0.1.1 → 0.1.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/README.md +3 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/store.d.ts +94 -0
- package/dist/index.cjs.js +157 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +6 -86
- package/dist/index.es.js +15729 -0
- package/dist/index.es.js.map +1 -0
- package/dist/modules/catalog/index.d.ts +13 -0
- package/dist/modules/catalog/reducer.d.ts +20 -0
- package/dist/modules/catalog/thunks.d.ts +4 -0
- package/dist/modules/catalog/types.d.ts +1 -0
- package/dist/modules/debugger/index.d.ts +6 -0
- package/dist/modules/debugger/reducer.d.ts +121 -0
- package/dist/modules/debugger/thunks.d.ts +11 -0
- package/dist/modules/debugger/types.d.ts +226 -0
- package/dist/modules/debugger/utils.d.ts +3 -0
- package/dist/modules/explorer/index.d.ts +6 -0
- package/dist/modules/explorer/reducer.d.ts +38 -0
- package/dist/modules/explorer/thunks.d.ts +263 -0
- package/dist/modules/explorer/types.d.ts +56 -0
- package/dist/modules/explorer/utils.d.ts +4 -0
- package/dist/modules/index.d.ts +52 -0
- package/dist/modules/modals/index.d.ts +5 -0
- package/dist/modules/modals/reducer.d.ts +17 -0
- package/dist/modules/modals/thunks.d.ts +12 -0
- package/dist/modules/modals/types.d.ts +69 -0
- package/dist/modules/model/helpers.d.ts +12 -0
- package/dist/modules/model/index.d.ts +8 -0
- package/dist/modules/model/reducer.d.ts +33 -0
- package/dist/modules/model/selectors.d.ts +12 -0
- package/dist/modules/model/subjects.d.ts +6 -0
- package/dist/modules/model/thunks.d.ts +55 -0
- package/dist/modules/model/types.d.ts +97 -0
- package/dist/modules/roles/__tests__/adapter.test.d.ts +1 -0
- package/dist/modules/roles/adapter.d.ts +179 -0
- package/dist/modules/roles/index.d.ts +21 -0
- package/dist/modules/roles/reducer.d.ts +64 -0
- package/dist/modules/roles/thunks.d.ts +24 -0
- package/dist/modules/roles/types.d.ts +86 -0
- package/dist/modules/root/index.d.ts +5 -0
- package/dist/modules/root/reducer.d.ts +153 -0
- package/dist/modules/root/thunks.d.ts +117 -0
- package/dist/modules/root/types.d.ts +59 -0
- package/dist/modules/settings/index.d.ts +5 -0
- package/dist/modules/settings/reducer.d.ts +45 -0
- package/dist/modules/settings/thunks.d.ts +7 -0
- package/dist/modules/settings/types.d.ts +7 -0
- package/dist/modules/settings/utils.d.ts +2 -0
- package/dist/modules/shared-css/index.d.ts +5 -0
- package/dist/modules/shared-css/reducer.d.ts +21 -0
- package/dist/modules/shared-css/thunks.d.ts +6 -0
- package/dist/modules/shared-css/types.d.ts +1 -0
- package/dist/modules/shared-datasources/index.d.ts +5 -0
- package/dist/modules/shared-datasources/reducer.d.ts +18 -0
- package/dist/modules/shared-datasources/thunks.d.ts +32 -0
- package/dist/modules/shared-datasources/types.d.ts +1 -0
- package/dist/modules/tabs/index.d.ts +5 -0
- package/dist/modules/tabs/reducer.d.ts +4 -0
- package/dist/modules/tabs/selectors.d.ts +64 -0
- package/dist/modules/tabs/types.d.ts +1 -0
- package/dist/modules/webforms/datasources.adapter.d.ts +40 -0
- package/dist/modules/webforms/index.d.ts +6 -0
- package/dist/modules/webforms/private.d.ts +3 -0
- package/dist/modules/webforms/reducer.d.ts +53 -0
- package/dist/modules/webforms/thunks.d.ts +58 -0
- package/dist/modules/webforms/types.d.ts +71 -0
- package/dist/provider.d.ts +5 -0
- package/dist/selectors/catalog.d.ts +234 -0
- package/dist/selectors/common.d.ts +146 -0
- package/dist/selectors/components.d.ts +70 -0
- package/dist/selectors/datasources.d.ts +262 -0
- package/dist/selectors/debugger.d.ts +922 -0
- package/dist/selectors/explorer.d.ts +1352 -0
- package/dist/selectors/index.d.ts +12 -0
- package/dist/selectors/modals.d.ts +41 -0
- package/dist/selectors/roles.d.ts +471 -0
- package/dist/selectors/settings.d.ts +337 -0
- package/dist/selectors/styles.d.ts +234 -0
- package/dist/selectors/tabs.d.ts +72 -0
- package/dist/selectors/webforms.d.ts +450 -0
- package/dist/store.d.ts +10 -0
- package/dist/utils.d.ts +16 -0
- package/package.json +46 -19
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -168
- package/dist/index.js.map +0 -1
- package/dist/index.module.js +0 -167
- package/dist/index.module.js.map +0 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/// <reference types="@ws-ui/shared/dist/declarations/datasources/interfaces/catalog" />
|
|
2
|
+
import { Edge, Node } from 'react-flow-renderer';
|
|
3
|
+
export interface TypeSuggestItem {
|
|
4
|
+
/** the title of the attribute type (used for display) */
|
|
5
|
+
title: string;
|
|
6
|
+
/**
|
|
7
|
+
* based on the selected type, the kind can be
|
|
8
|
+
* - related entity
|
|
9
|
+
* - related entities
|
|
10
|
+
* - alias
|
|
11
|
+
* - storage
|
|
12
|
+
*/
|
|
13
|
+
kind: catalog.AttributeKind;
|
|
14
|
+
/**
|
|
15
|
+
* the calculated kind holds the final value of the attribute kind property.
|
|
16
|
+
* it is resolved based on the selected type.
|
|
17
|
+
*/
|
|
18
|
+
calculatedKind: catalog.AttributeKind;
|
|
19
|
+
/** the actual value of the type.
|
|
20
|
+
* - can be a primitive type (date, number, bool, ...etc)
|
|
21
|
+
* - can be a dataclass name or a collection name ( related attribute )
|
|
22
|
+
* - can be a full path to an existing attribute. (alias)
|
|
23
|
+
*/
|
|
24
|
+
value: string;
|
|
25
|
+
/**
|
|
26
|
+
* it holds to final value for the attributes type property. it is resolved based on the selected type.
|
|
27
|
+
*/
|
|
28
|
+
calculatedType: string;
|
|
29
|
+
/**
|
|
30
|
+
* optional property defining the attribute behavior
|
|
31
|
+
*/
|
|
32
|
+
behavior?: string;
|
|
33
|
+
}
|
|
34
|
+
export type TypeSuggestItems = TypeSuggestItem[];
|
|
35
|
+
export type ModelNode = Omit<Node, 'type' | 'data'> & {
|
|
36
|
+
data: catalog.IDataClass;
|
|
37
|
+
type: 'table';
|
|
38
|
+
};
|
|
39
|
+
export type ModelEdge = Omit<Edge, 'data'> & {
|
|
40
|
+
data: {
|
|
41
|
+
sourceDataclass: string;
|
|
42
|
+
sourceAttribute?: string;
|
|
43
|
+
targetDataclass: string;
|
|
44
|
+
targetAttribute?: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export interface ServerModel {
|
|
48
|
+
toJSON: boolean;
|
|
49
|
+
extraProperties?: catalog.IModelProperties;
|
|
50
|
+
dataClasses: catalog.IDataClass[];
|
|
51
|
+
}
|
|
52
|
+
export type DataclassScope = 'public' | 'publicOnServer';
|
|
53
|
+
export type AttributeScope = 'public' | 'publicOnServer' | 'protected' | 'private';
|
|
54
|
+
export type TIndexType = 'btree' | 'cluster' | 'auto' | undefined;
|
|
55
|
+
export declare enum EAttributeTypes {
|
|
56
|
+
UUID = "uuid",
|
|
57
|
+
STRING = "string",
|
|
58
|
+
TEXT = "text",
|
|
59
|
+
DATE = "date",
|
|
60
|
+
TIME = "duration",
|
|
61
|
+
BOOLEAN = "bool",
|
|
62
|
+
BYTE = "byte",
|
|
63
|
+
INTEGER = "word",
|
|
64
|
+
LONG = "long",
|
|
65
|
+
LONG64 = "long64",
|
|
66
|
+
FLOAT = "number",
|
|
67
|
+
BLOB = "blob",
|
|
68
|
+
IMAGE = "image",
|
|
69
|
+
OBJECT = "object"
|
|
70
|
+
}
|
|
71
|
+
export declare enum EAttributeKind {
|
|
72
|
+
STORAGE = "storage",
|
|
73
|
+
RELATEDENTITY = "relatedEntity",
|
|
74
|
+
RELATEDENTITIES = "relatedEntities",
|
|
75
|
+
CALCULATED = "calculated",
|
|
76
|
+
COMPOSITION = "composition",
|
|
77
|
+
ALIAS = "alias"
|
|
78
|
+
}
|
|
79
|
+
export declare const isValidPrimaryKey: (attribute: catalog.IAttribute) => boolean;
|
|
80
|
+
export declare const attributeKinds: {
|
|
81
|
+
label: string;
|
|
82
|
+
value: string;
|
|
83
|
+
}[];
|
|
84
|
+
export declare const primaryKeyAttributes: TypeSuggestItems;
|
|
85
|
+
export declare const attributeTypes: TypeSuggestItems;
|
|
86
|
+
export declare const dataclassScopes: {
|
|
87
|
+
label: string;
|
|
88
|
+
value: string;
|
|
89
|
+
}[];
|
|
90
|
+
export declare const attributeScopes: {
|
|
91
|
+
label: string;
|
|
92
|
+
value: string;
|
|
93
|
+
}[];
|
|
94
|
+
export declare const indexTypes: {
|
|
95
|
+
label: string;
|
|
96
|
+
value: string;
|
|
97
|
+
}[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { EPermissionType, IGraphData, IPermission, IPrivilege, IResource, IResourcePermission, ISanitized, TById, TRawData, TRole, TRolesDict, TSanitizedPrivilege } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* pushes uniquely list of items
|
|
4
|
+
* @param array input array
|
|
5
|
+
* @param args list of elements to add to the array
|
|
6
|
+
* @returns an array containing unique fields
|
|
7
|
+
*/
|
|
8
|
+
export declare function uniquePush<T = string>(array: T[], ...args: T[]): T[];
|
|
9
|
+
/**
|
|
10
|
+
* Sanitize a privileges array
|
|
11
|
+
* @param data unsanitized data
|
|
12
|
+
* @returns sanitized data
|
|
13
|
+
*/
|
|
14
|
+
export declare function sanitizePrivileges(data: IPrivilege[]): TById;
|
|
15
|
+
/**
|
|
16
|
+
* sort list of sanitized pivileges
|
|
17
|
+
* @param dict sanitized data
|
|
18
|
+
* @returns sorted privileges
|
|
19
|
+
*/
|
|
20
|
+
export declare function sort(dict: TById): TSanitizedPrivilege[];
|
|
21
|
+
/**
|
|
22
|
+
* Lists the parents of a specific element
|
|
23
|
+
* @param id identifier of the current element
|
|
24
|
+
* @param dict sanitized privileges
|
|
25
|
+
* @returns parents of the current element
|
|
26
|
+
*/
|
|
27
|
+
export declare function parents(id: string, dict: TById): string[];
|
|
28
|
+
/**
|
|
29
|
+
* Lists the children of a specific element
|
|
30
|
+
* @param id identifier of the current element
|
|
31
|
+
* @param dict sanitized privileges
|
|
32
|
+
* @returns children of the current element
|
|
33
|
+
*/
|
|
34
|
+
export declare function children(id: string, dict: TById): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Calculates from a sanitized privileges dictionary the list of allowed to include children
|
|
37
|
+
* @param id identifier of the current element
|
|
38
|
+
* @param dict sanitized privileges
|
|
39
|
+
* @returns allowed to include privileges
|
|
40
|
+
*/
|
|
41
|
+
export declare function allowed(id: string, dict: TById): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Removes an element from a sanitized dictionary
|
|
44
|
+
* @param id identifier of the current element
|
|
45
|
+
* @param dict sanitized privileges
|
|
46
|
+
* @returns new dictionary containing the initialone except the one with "id"
|
|
47
|
+
*/
|
|
48
|
+
export declare function remove(id: string, dict: TById): TById;
|
|
49
|
+
/**
|
|
50
|
+
* Adds an existing node as a child of another node
|
|
51
|
+
* @param parentId the parent identifier
|
|
52
|
+
* @param childId the child identifer
|
|
53
|
+
* @param dict sanitized privileges dictionary
|
|
54
|
+
* @returns the new dictionary
|
|
55
|
+
*/
|
|
56
|
+
export declare function addIn(parentId: string, childId: string, dict: TById): TById;
|
|
57
|
+
/**
|
|
58
|
+
* Removes an existing node from its (specified) parent
|
|
59
|
+
* @param parentId the parent identifier
|
|
60
|
+
* @param childId the child identifer
|
|
61
|
+
* @param dict sanitized privileges dictionary
|
|
62
|
+
* @returns the new dictionary
|
|
63
|
+
*/
|
|
64
|
+
export declare function removeFrom(parentId: string, childId: string, dict: TById): TById;
|
|
65
|
+
/**
|
|
66
|
+
* Create a new privilege
|
|
67
|
+
* @param name the privilege name
|
|
68
|
+
* @param dict sanitized privileges dictionary
|
|
69
|
+
* @returns the new dictionary
|
|
70
|
+
*/
|
|
71
|
+
export declare function create(name: string, dict: TById): TById;
|
|
72
|
+
export declare function createWithResource(name: string, resource: string, type: EPermissionType, action: IResourcePermission['name'], dict: TById): TById;
|
|
73
|
+
/**
|
|
74
|
+
* Renames an existing node
|
|
75
|
+
* @param name the new name
|
|
76
|
+
* @param id the node identifier
|
|
77
|
+
* @param dict sanitized privileges dictionary
|
|
78
|
+
* @returns the new dictionary
|
|
79
|
+
*/
|
|
80
|
+
export declare function rename(name: string, id: string, dict: TById): TById;
|
|
81
|
+
/**
|
|
82
|
+
* Populates a list privileges IDs
|
|
83
|
+
* @param ids the identifiers of privileges to populate
|
|
84
|
+
* @param dict sanitized privileges dictionary
|
|
85
|
+
* @returns populated privileges
|
|
86
|
+
*/
|
|
87
|
+
export declare function populateShallow(ids: string[], dict: TById): (IPrivilege | null)[];
|
|
88
|
+
/**
|
|
89
|
+
* Get the privilege object from its identifier
|
|
90
|
+
* @param id the identifier of the node
|
|
91
|
+
* @param dict sanitized privileges dictionary
|
|
92
|
+
* @returns populated privilege
|
|
93
|
+
*/
|
|
94
|
+
export declare function getPrivilegeById(id: string, dict: TById): TSanitizedPrivilege | null;
|
|
95
|
+
/**
|
|
96
|
+
* Maps the privileges to their permissions
|
|
97
|
+
* @param param0 the raw permission object
|
|
98
|
+
* @returns an object mapping the privilege to its permission
|
|
99
|
+
*/
|
|
100
|
+
export declare function actionsToPrivs({ applyTo, type, ...actions }: IPermission): {
|
|
101
|
+
[privName: string]: string[];
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Converts a raw permission to a resource
|
|
105
|
+
* @param item a permission
|
|
106
|
+
* @returns the resource object
|
|
107
|
+
*/
|
|
108
|
+
export declare function getResourceFromType(item: IPermission): IResource;
|
|
109
|
+
/**
|
|
110
|
+
* Sanitizes the raw permissions
|
|
111
|
+
* @param data list of raw permissions
|
|
112
|
+
* @param byKey dictionary
|
|
113
|
+
* @returns a new dictionary containing the sanitized permissions
|
|
114
|
+
*/
|
|
115
|
+
export declare function sanitizePermissions(data: IPermission[], byKey: TById): TById;
|
|
116
|
+
/**
|
|
117
|
+
* Converts a dictionary indexed by id to a new one indexed by name
|
|
118
|
+
* @param dict dictioanry
|
|
119
|
+
* @returns a new dictionary indexed by privilege name
|
|
120
|
+
*/
|
|
121
|
+
export declare function getDictByName(dict: TById): TById;
|
|
122
|
+
/**
|
|
123
|
+
* Sanitizes the content of roles.json file
|
|
124
|
+
* @param data raw data
|
|
125
|
+
* @returns sanitized data
|
|
126
|
+
*/
|
|
127
|
+
export declare function sanitize(data: TRawData): ISanitized;
|
|
128
|
+
/**
|
|
129
|
+
* Converts sanitized data to a valid API payload
|
|
130
|
+
* @param data sanitized dictionary
|
|
131
|
+
* @returns raw data
|
|
132
|
+
*/
|
|
133
|
+
export declare function toAPI(data: ISanitized): TRawData;
|
|
134
|
+
export declare function getGraphData(id: string, dict: TById): IGraphData;
|
|
135
|
+
/**
|
|
136
|
+
*
|
|
137
|
+
* @param id privilege id
|
|
138
|
+
* @param permission
|
|
139
|
+
* @param dict
|
|
140
|
+
*/
|
|
141
|
+
export declare function addPermission(id: string, permission: IPermission, dict: TById): TById;
|
|
142
|
+
/**
|
|
143
|
+
*
|
|
144
|
+
* @param id
|
|
145
|
+
* @param permission
|
|
146
|
+
* @param dict
|
|
147
|
+
*/
|
|
148
|
+
export declare function removePermission(id: string, permission: IPermission, dict: TById): TById;
|
|
149
|
+
/**
|
|
150
|
+
*
|
|
151
|
+
* @param id
|
|
152
|
+
* @param permission
|
|
153
|
+
* @param dict
|
|
154
|
+
*/
|
|
155
|
+
export declare function resetResources(id: string, dict: TById): TById;
|
|
156
|
+
/**
|
|
157
|
+
*
|
|
158
|
+
* @param id privilege id
|
|
159
|
+
* @param resource resource name
|
|
160
|
+
* @param type resource type
|
|
161
|
+
* @param permission permission name
|
|
162
|
+
* @param dict privileges dictionary
|
|
163
|
+
* @returns
|
|
164
|
+
*/
|
|
165
|
+
export declare function togglePrivilegePermission(id: string, resource: string, type: EPermissionType, permission: IResourcePermission['name'], dict: TById): TById;
|
|
166
|
+
/**
|
|
167
|
+
*
|
|
168
|
+
* @param id
|
|
169
|
+
* @param permission
|
|
170
|
+
* @param dict
|
|
171
|
+
*/
|
|
172
|
+
export declare function togglePermission(id: string, resource: IResource, permission: IResourcePermission, dict: TById): TById;
|
|
173
|
+
export declare function getPromotions(id: string, dict: TById): Record<string, string[]>;
|
|
174
|
+
export declare function getInheritedResources(id: string, dict: TById): IResource[];
|
|
175
|
+
export declare const toState: (rolesArray: TRole[]) => TRolesDict;
|
|
176
|
+
export declare const removeRole: (id: string, roles: TRolesDict) => TRolesDict;
|
|
177
|
+
export declare const editRole: (id: string, newName: string, roles: TRolesDict) => TRolesDict;
|
|
178
|
+
export declare const createRole: (id: string, roles: TRolesDict) => TRolesDict;
|
|
179
|
+
export declare const saveRole: (role: TRole, roles: TRolesDict) => TRolesDict;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare const _default: import("redux").Reducer<{
|
|
2
|
+
flags: {
|
|
3
|
+
touched?: boolean | undefined;
|
|
4
|
+
removed?: boolean | undefined;
|
|
5
|
+
pinned?: boolean | undefined;
|
|
6
|
+
loading?: boolean | undefined;
|
|
7
|
+
old?: boolean | undefined;
|
|
8
|
+
enabled?: boolean | undefined;
|
|
9
|
+
confirmed?: boolean | undefined;
|
|
10
|
+
};
|
|
11
|
+
date?: string | undefined;
|
|
12
|
+
privileges: import("./types").TById;
|
|
13
|
+
roles: import("./types").TRolesDict;
|
|
14
|
+
forceLogin?: boolean | undefined;
|
|
15
|
+
selectedTab: "roles" | "privileges";
|
|
16
|
+
}>;
|
|
17
|
+
export default _default;
|
|
18
|
+
export * from './reducer';
|
|
19
|
+
export * from './thunks';
|
|
20
|
+
export * from './types';
|
|
21
|
+
export * from './adapter';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { IRolesState, TById, TRawData, TRolesDict } from './types';
|
|
3
|
+
declare const stateSlice: import("@reduxjs/toolkit").Slice<{
|
|
4
|
+
flags: {
|
|
5
|
+
touched?: boolean | undefined;
|
|
6
|
+
removed?: boolean | undefined;
|
|
7
|
+
pinned?: boolean | undefined;
|
|
8
|
+
loading?: boolean | undefined;
|
|
9
|
+
old?: boolean | undefined;
|
|
10
|
+
enabled?: boolean | undefined;
|
|
11
|
+
confirmed?: boolean | undefined;
|
|
12
|
+
};
|
|
13
|
+
date?: string | undefined;
|
|
14
|
+
privileges: TById;
|
|
15
|
+
roles: TRolesDict;
|
|
16
|
+
forceLogin?: boolean | undefined;
|
|
17
|
+
selectedTab: "roles" | "privileges";
|
|
18
|
+
}, {
|
|
19
|
+
updatePrivileges: (state: import("immer/dist/internal.js").WritableDraft<IRolesState>, action: PayloadAction<TById>) => void;
|
|
20
|
+
updateRoles: (state: import("immer/dist/internal.js").WritableDraft<IRolesState>, action: PayloadAction<TRolesDict>) => void;
|
|
21
|
+
updateRolesAndPrivileges: (state: import("immer/dist/internal.js").WritableDraft<IRolesState>, action: PayloadAction<{
|
|
22
|
+
roles: TRolesDict;
|
|
23
|
+
privileges: TById;
|
|
24
|
+
}>) => void;
|
|
25
|
+
toggleTab: (state: import("immer/dist/internal.js").WritableDraft<IRolesState>, action: PayloadAction<'privileges' | 'roles'>) => void;
|
|
26
|
+
toggleForceLogin: (state: import("immer/dist/internal.js").WritableDraft<IRolesState>, action: PayloadAction<boolean>) => void;
|
|
27
|
+
setRolesContent(state: import("immer/dist/internal.js").WritableDraft<IRolesState>, action: PayloadAction<{
|
|
28
|
+
content: TRawData;
|
|
29
|
+
date?: string;
|
|
30
|
+
flags?: IRolesState['flags'];
|
|
31
|
+
}>): {
|
|
32
|
+
flags: {
|
|
33
|
+
touched?: boolean | undefined;
|
|
34
|
+
removed?: boolean | undefined;
|
|
35
|
+
pinned?: boolean | undefined;
|
|
36
|
+
loading?: boolean | undefined;
|
|
37
|
+
old?: boolean | undefined;
|
|
38
|
+
enabled?: boolean | undefined;
|
|
39
|
+
confirmed?: boolean | undefined;
|
|
40
|
+
};
|
|
41
|
+
date?: string | undefined;
|
|
42
|
+
privileges: TById;
|
|
43
|
+
roles: TRolesDict;
|
|
44
|
+
forceLogin?: boolean | undefined;
|
|
45
|
+
selectedTab: "roles" | "privileges";
|
|
46
|
+
};
|
|
47
|
+
}, "roles">;
|
|
48
|
+
export declare const updatePrivileges: import("@reduxjs/toolkit").ActionCreatorWithPayload<TById, string>, updateRoles: import("@reduxjs/toolkit").ActionCreatorWithPayload<TRolesDict, string>, setRolesContent: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
49
|
+
content: TRawData;
|
|
50
|
+
date?: string | undefined;
|
|
51
|
+
flags?: Partial<{
|
|
52
|
+
touched: boolean;
|
|
53
|
+
removed: boolean;
|
|
54
|
+
pinned: boolean;
|
|
55
|
+
loading: boolean;
|
|
56
|
+
old: boolean;
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
confirmed: boolean;
|
|
59
|
+
}> | undefined;
|
|
60
|
+
}, string>, toggleTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"roles" | "privileges", string>, toggleForceLogin: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, updateRolesAndPrivileges: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
61
|
+
roles: TRolesDict;
|
|
62
|
+
privileges: TById;
|
|
63
|
+
}, string>;
|
|
64
|
+
export default stateSlice;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ITabFlags } from '@ws-ui/shared';
|
|
2
|
+
import { IFileContentResponse, ISetFileContentResponse } from '@ws-ui/shared';
|
|
3
|
+
import { AppState } from '..';
|
|
4
|
+
import { ISanitized } from './types';
|
|
5
|
+
export declare const fetchRoles: import("@reduxjs/toolkit").AsyncThunk<IFileContentResponse<ISanitized>, void, {
|
|
6
|
+
state: AppState;
|
|
7
|
+
rejectValue: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const fetchRolesChanges: import("@reduxjs/toolkit").AsyncThunk<Partial<{
|
|
10
|
+
touched: boolean;
|
|
11
|
+
removed: boolean;
|
|
12
|
+
pinned: boolean;
|
|
13
|
+
loading: boolean;
|
|
14
|
+
old: boolean;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
confirmed: boolean;
|
|
17
|
+
}>, void, {
|
|
18
|
+
state: AppState;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const isRolesOutdated: (date: string | undefined) => Promise<boolean>;
|
|
21
|
+
export declare const saveRoles: import("@reduxjs/toolkit").AsyncThunk<ISetFileContentResponse, ISanitized, {
|
|
22
|
+
state: AppState;
|
|
23
|
+
rejectValue: string | ITabFlags;
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raw API response typing
|
|
3
|
+
*/
|
|
4
|
+
import { ITabFlags } from '@ws-ui/shared';
|
|
5
|
+
export type TRawData = Partial<{
|
|
6
|
+
privileges: IPrivilege[];
|
|
7
|
+
roles: IRole[];
|
|
8
|
+
permissions: Partial<{
|
|
9
|
+
allowed: IPermission[];
|
|
10
|
+
}>;
|
|
11
|
+
forceLogin: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
export type TPermissionOption = Pick<IPermission, 'applyTo' | 'type'>;
|
|
14
|
+
export type TAction = 'read' | 'create' | 'update' | 'drop' | 'describe' | 'execute' | 'promote';
|
|
15
|
+
export type IRolesState = ISanitized & {
|
|
16
|
+
flags: ITabFlags;
|
|
17
|
+
date?: string;
|
|
18
|
+
selectedTab: 'privileges' | 'roles';
|
|
19
|
+
};
|
|
20
|
+
export interface IPrivilege {
|
|
21
|
+
id?: string;
|
|
22
|
+
privilege: string;
|
|
23
|
+
includes?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface IRole {
|
|
26
|
+
id?: string;
|
|
27
|
+
role: string;
|
|
28
|
+
privileges?: string[];
|
|
29
|
+
}
|
|
30
|
+
export type TRole = Required<IRole>;
|
|
31
|
+
export declare enum EPermissionType {
|
|
32
|
+
DATACLASS = "dataclass",
|
|
33
|
+
METHOD = "method",
|
|
34
|
+
ATTRIBUTE = "attribute",
|
|
35
|
+
DATASTORE = "datastore"
|
|
36
|
+
}
|
|
37
|
+
export interface IPermission {
|
|
38
|
+
applyTo: string;
|
|
39
|
+
type: EPermissionType;
|
|
40
|
+
read?: string | string[];
|
|
41
|
+
create?: string | string[];
|
|
42
|
+
update?: string | string[];
|
|
43
|
+
drop?: string | string[];
|
|
44
|
+
describe?: string | string[];
|
|
45
|
+
execute?: string | string[];
|
|
46
|
+
promote?: string | string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Sanitized data
|
|
50
|
+
*/
|
|
51
|
+
export interface ISanitized {
|
|
52
|
+
privileges: TById;
|
|
53
|
+
roles: TRolesDict;
|
|
54
|
+
forceLogin?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface IResourcePermission {
|
|
57
|
+
name: TAction;
|
|
58
|
+
from: string[];
|
|
59
|
+
checked?: boolean;
|
|
60
|
+
info?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface IResource {
|
|
63
|
+
resource: string;
|
|
64
|
+
type: EPermissionType;
|
|
65
|
+
permissions: IResourcePermission[];
|
|
66
|
+
}
|
|
67
|
+
export type TSanitizedPrivilege = Required<IPrivilege> & {
|
|
68
|
+
parents: string[];
|
|
69
|
+
resources: IResource[];
|
|
70
|
+
};
|
|
71
|
+
export type TById = {
|
|
72
|
+
[id: string]: TSanitizedPrivilege;
|
|
73
|
+
};
|
|
74
|
+
export type TRolesDict = {
|
|
75
|
+
[id: string]: TRole;
|
|
76
|
+
};
|
|
77
|
+
export interface ILink {
|
|
78
|
+
source: string;
|
|
79
|
+
target: string;
|
|
80
|
+
}
|
|
81
|
+
export interface IGraphData {
|
|
82
|
+
selected: string;
|
|
83
|
+
parents: string[][];
|
|
84
|
+
children: string[][];
|
|
85
|
+
links: ILink[];
|
|
86
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { IWebFormStyleClass } from '@ws-ui/shared';
|
|
3
|
+
import { ITab, ITabExtra, ITabFlags } from '@ws-ui/shared';
|
|
4
|
+
import { IRootState, TActionAddDataSource, TActionRemoveDataSource, TActionSetDataSources } from './types';
|
|
5
|
+
export declare const stateSlice: import("@reduxjs/toolkit").Slice<import("immer/dist/internal.js").WritableDraft<IRootState>, {
|
|
6
|
+
setPanelState(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<Partial<ITab['view']['panel']> & {
|
|
7
|
+
path: string;
|
|
8
|
+
}>): void;
|
|
9
|
+
addDataSource(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionAddDataSource): void;
|
|
10
|
+
openSettingsTab(state: import("immer/dist/internal.js").WritableDraft<IRootState>): void;
|
|
11
|
+
removeDataSource(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionRemoveDataSource): void;
|
|
12
|
+
setDataSources(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: TActionSetDataSources): void;
|
|
13
|
+
setTabs(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<ITab[]>): void;
|
|
14
|
+
closeTab(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<number>): void;
|
|
15
|
+
closeOthers(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<string>): void;
|
|
16
|
+
closeAllTabs(state: import("immer/dist/internal.js").WritableDraft<IRootState>): void;
|
|
17
|
+
closeRightTabs(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<number>): void;
|
|
18
|
+
closeLeftTabs(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<number>): void;
|
|
19
|
+
closeSavedTabs(state: import("immer/dist/internal.js").WritableDraft<IRootState>): void;
|
|
20
|
+
confirmTab(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<string>): void;
|
|
21
|
+
selectTab(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<string>): void;
|
|
22
|
+
openTabUnselected(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<ITab>): void;
|
|
23
|
+
selectTabByReference(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<ITab & {
|
|
24
|
+
isNew?: boolean;
|
|
25
|
+
}>): void;
|
|
26
|
+
setContent(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<{
|
|
27
|
+
path: string;
|
|
28
|
+
content: any;
|
|
29
|
+
contentPath?: string;
|
|
30
|
+
}>): void;
|
|
31
|
+
setTabFlags(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<{
|
|
32
|
+
path: string;
|
|
33
|
+
flags: ITabFlags;
|
|
34
|
+
}>): void;
|
|
35
|
+
setTabsFlags(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<{
|
|
36
|
+
tabs: string[];
|
|
37
|
+
flags: ITabFlags;
|
|
38
|
+
}>): void;
|
|
39
|
+
setTabExtra(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<{
|
|
40
|
+
path: string;
|
|
41
|
+
extra: ITabExtra;
|
|
42
|
+
flags?: ITabFlags;
|
|
43
|
+
}>): void;
|
|
44
|
+
addWebFormStyles(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<{
|
|
45
|
+
path: string;
|
|
46
|
+
styles: IWebFormStyleClass[];
|
|
47
|
+
}>): void;
|
|
48
|
+
changeTabEditor(state: import("immer/dist/internal.js").WritableDraft<IRootState>, action: PayloadAction<ITab>): import("immer/dist/internal.js").WritableDraft<IRootState>;
|
|
49
|
+
}, "root">;
|
|
50
|
+
export declare const setTabs: import("@reduxjs/toolkit").ActionCreatorWithPayload<ITab<any, Partial<{
|
|
51
|
+
initialLineInfo: {
|
|
52
|
+
line: number;
|
|
53
|
+
offset?: number | undefined;
|
|
54
|
+
lastModification: number;
|
|
55
|
+
};
|
|
56
|
+
initialSelectionInfo: {
|
|
57
|
+
selection: import("@ws-ui/shared").ITextEditorSelection;
|
|
58
|
+
lastModification: number;
|
|
59
|
+
};
|
|
60
|
+
diffContent: string;
|
|
61
|
+
attributes: import("@ws-ui/shared").IMethodAttributes;
|
|
62
|
+
source: import("@ws-ui/shared").ISource;
|
|
63
|
+
editor: import("@ws-ui/shared").IEditor;
|
|
64
|
+
ext: import("@ws-ui/shared").DebuggerFileExtension;
|
|
65
|
+
}>>[], string>, closeTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>, setContent: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
66
|
+
path: string;
|
|
67
|
+
content: any;
|
|
68
|
+
contentPath?: string | undefined;
|
|
69
|
+
}, string>, setTabFlags: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
70
|
+
path: string;
|
|
71
|
+
flags: ITabFlags;
|
|
72
|
+
}, string>, setTabsFlags: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
73
|
+
tabs: string[];
|
|
74
|
+
flags: ITabFlags;
|
|
75
|
+
}, string>, setTabExtra: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
76
|
+
path: string;
|
|
77
|
+
extra: ITabExtra;
|
|
78
|
+
flags?: Partial<{
|
|
79
|
+
touched: boolean;
|
|
80
|
+
removed: boolean;
|
|
81
|
+
pinned: boolean;
|
|
82
|
+
loading: boolean;
|
|
83
|
+
old: boolean;
|
|
84
|
+
enabled: boolean;
|
|
85
|
+
confirmed: boolean;
|
|
86
|
+
}> | undefined;
|
|
87
|
+
}, string>, closeAllTabs: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, addDataSource: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
88
|
+
datasourceDef: datasources.ICreateDataSource;
|
|
89
|
+
path: string;
|
|
90
|
+
}, string>, closeRightTabs: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>, closeOthers: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, closeLeftTabs: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>, closeSavedTabs: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setDataSources: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
91
|
+
datasourceArr: datasources.ICreateDataSource[];
|
|
92
|
+
path: string;
|
|
93
|
+
}, string>, removeDataSource: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
94
|
+
path: string;
|
|
95
|
+
datasourceID: string;
|
|
96
|
+
}, string>, confirmTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, selectTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, selectTabByReference: import("@reduxjs/toolkit").ActionCreatorWithPayload<ITab<any, Partial<{
|
|
97
|
+
initialLineInfo: {
|
|
98
|
+
line: number;
|
|
99
|
+
offset?: number | undefined;
|
|
100
|
+
lastModification: number;
|
|
101
|
+
};
|
|
102
|
+
initialSelectionInfo: {
|
|
103
|
+
selection: import("@ws-ui/shared").ITextEditorSelection;
|
|
104
|
+
lastModification: number;
|
|
105
|
+
};
|
|
106
|
+
diffContent: string;
|
|
107
|
+
attributes: import("@ws-ui/shared").IMethodAttributes;
|
|
108
|
+
source: import("@ws-ui/shared").ISource;
|
|
109
|
+
editor: import("@ws-ui/shared").IEditor;
|
|
110
|
+
ext: import("@ws-ui/shared").DebuggerFileExtension;
|
|
111
|
+
}>> & {
|
|
112
|
+
isNew?: boolean | undefined;
|
|
113
|
+
}, string>, openTabUnselected: import("@reduxjs/toolkit").ActionCreatorWithPayload<ITab<any, Partial<{
|
|
114
|
+
initialLineInfo: {
|
|
115
|
+
line: number;
|
|
116
|
+
offset?: number | undefined;
|
|
117
|
+
lastModification: number;
|
|
118
|
+
};
|
|
119
|
+
initialSelectionInfo: {
|
|
120
|
+
selection: import("@ws-ui/shared").ITextEditorSelection;
|
|
121
|
+
lastModification: number;
|
|
122
|
+
};
|
|
123
|
+
diffContent: string;
|
|
124
|
+
attributes: import("@ws-ui/shared").IMethodAttributes;
|
|
125
|
+
source: import("@ws-ui/shared").ISource;
|
|
126
|
+
editor: import("@ws-ui/shared").IEditor;
|
|
127
|
+
ext: import("@ws-ui/shared").DebuggerFileExtension;
|
|
128
|
+
}>>, string>, addWebFormStyles: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
129
|
+
path: string;
|
|
130
|
+
styles: IWebFormStyleClass[];
|
|
131
|
+
}, string>, changeTabEditor: import("@reduxjs/toolkit").ActionCreatorWithPayload<ITab<any, Partial<{
|
|
132
|
+
initialLineInfo: {
|
|
133
|
+
line: number;
|
|
134
|
+
offset?: number | undefined;
|
|
135
|
+
lastModification: number;
|
|
136
|
+
};
|
|
137
|
+
initialSelectionInfo: {
|
|
138
|
+
selection: import("@ws-ui/shared").ITextEditorSelection;
|
|
139
|
+
lastModification: number;
|
|
140
|
+
};
|
|
141
|
+
diffContent: string;
|
|
142
|
+
attributes: import("@ws-ui/shared").IMethodAttributes;
|
|
143
|
+
source: import("@ws-ui/shared").ISource;
|
|
144
|
+
editor: import("@ws-ui/shared").IEditor;
|
|
145
|
+
ext: import("@ws-ui/shared").DebuggerFileExtension;
|
|
146
|
+
}>>, string>, openSettingsTab: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setPanelState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<{
|
|
147
|
+
isOpen: boolean;
|
|
148
|
+
type: string;
|
|
149
|
+
current: string;
|
|
150
|
+
}> & {
|
|
151
|
+
path: string;
|
|
152
|
+
}, string>;
|
|
153
|
+
export default stateSlice;
|