tale-js-sdk 0.1.4 → 1.0.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.
- package/dist/acl/index.d.ts +232 -102
- package/dist/acl/index.js +431 -489
- package/dist/acl/types.d.ts +95 -161
- package/dist/common/types.d.ts +5 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/rbac/index.d.ts +464 -2
- package/dist/rbac/index.js +1123 -2
- package/dist/rbac/types.d.ts +73 -304
- package/package.json +1 -1
package/dist/acl/types.d.ts
CHANGED
|
@@ -1,208 +1,142 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
pageNumber: number;
|
|
7
|
-
pageSize: number;
|
|
8
|
-
paged: boolean;
|
|
9
|
-
unpaged: boolean;
|
|
10
|
-
};
|
|
11
|
-
last: boolean;
|
|
12
|
-
totalPages: number;
|
|
13
|
-
totalElements: number;
|
|
14
|
-
size: number;
|
|
15
|
-
number: number;
|
|
16
|
-
sort: Sort;
|
|
17
|
-
first: boolean;
|
|
18
|
-
numberOfElements: number;
|
|
19
|
-
empty: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface Sort {
|
|
22
|
-
empty: boolean;
|
|
23
|
-
sorted: boolean;
|
|
24
|
-
unsorted: boolean;
|
|
25
|
-
}
|
|
26
|
-
export interface CommonOptions {
|
|
27
|
-
baseUrl?: string;
|
|
28
|
-
appKey?: string;
|
|
29
|
-
appSecret?: string;
|
|
30
|
-
appToken?: string;
|
|
31
|
-
}
|
|
32
|
-
export interface AclOptions extends CommonOptions {
|
|
33
|
-
include_records?: boolean;
|
|
34
|
-
include_templates?: boolean;
|
|
35
|
-
effect_type?: 'allow' | 'deny' | 'inherit';
|
|
36
|
-
priority_range?: {
|
|
37
|
-
min: number;
|
|
38
|
-
max: number;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
1
|
+
import type { CommonOptions } from "../common/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* ACL Record (Access Control List Record)
|
|
4
|
+
* Represents a single access control rule
|
|
5
|
+
*/
|
|
41
6
|
export interface AclRecord {
|
|
42
7
|
record_id: string;
|
|
43
8
|
app_id: string;
|
|
44
|
-
template_id
|
|
45
|
-
subject_type:
|
|
9
|
+
template_id?: string;
|
|
10
|
+
subject_type: string;
|
|
46
11
|
subject_id?: string;
|
|
47
12
|
subject_identifier?: string;
|
|
48
13
|
resource_type: string;
|
|
49
14
|
resource_id?: string;
|
|
50
15
|
resource_identifier?: string;
|
|
51
|
-
effect_type:
|
|
52
|
-
priority
|
|
53
|
-
data_scope?: Record<string,
|
|
54
|
-
description?: string;
|
|
55
|
-
created_at?: string;
|
|
56
|
-
updated_at?: string;
|
|
57
|
-
}
|
|
58
|
-
export interface AclTemplate {
|
|
59
|
-
template_id: string;
|
|
60
|
-
app_id: string;
|
|
61
|
-
template_name: string;
|
|
62
|
-
template_code: string;
|
|
63
|
-
subject_filter?: Record<string, any>;
|
|
64
|
-
resource_filter?: Record<string, any>;
|
|
65
|
-
effect_type?: 'allow' | 'deny' | 'inherit';
|
|
66
|
-
default_priority?: number;
|
|
16
|
+
effect_type: string;
|
|
17
|
+
priority?: number;
|
|
18
|
+
data_scope?: Record<string, unknown>;
|
|
67
19
|
description?: string;
|
|
68
|
-
created_at
|
|
69
|
-
updated_at
|
|
20
|
+
created_at: string;
|
|
21
|
+
updated_at: string;
|
|
70
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Request for creating an ACL record
|
|
25
|
+
*/
|
|
71
26
|
export interface CreateAclRecordRequest {
|
|
72
|
-
template_id
|
|
73
|
-
subject_type:
|
|
27
|
+
template_id?: string;
|
|
28
|
+
subject_type: string;
|
|
74
29
|
subject_id?: string;
|
|
75
30
|
subject_identifier?: string;
|
|
76
31
|
resource_type: string;
|
|
77
32
|
resource_id?: string;
|
|
78
33
|
resource_identifier?: string;
|
|
79
|
-
effect_type:
|
|
34
|
+
effect_type: string;
|
|
80
35
|
priority?: number;
|
|
81
|
-
data_scope?: Record<string,
|
|
36
|
+
data_scope?: Record<string, unknown>;
|
|
82
37
|
description?: string;
|
|
83
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Request for updating an ACL record
|
|
41
|
+
*/
|
|
84
42
|
export interface UpdateAclRecordRequest {
|
|
85
43
|
template_id?: string;
|
|
86
|
-
effect_type?:
|
|
44
|
+
effect_type?: string;
|
|
87
45
|
priority?: number;
|
|
88
|
-
data_scope?: Record<string,
|
|
46
|
+
data_scope?: Record<string, unknown>;
|
|
89
47
|
description?: string;
|
|
90
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Request for listing ACL records
|
|
51
|
+
*/
|
|
91
52
|
export interface ListAclRecordsRequest {
|
|
53
|
+
page?: number;
|
|
54
|
+
size?: number;
|
|
92
55
|
template_id?: string;
|
|
93
|
-
subject_type?:
|
|
56
|
+
subject_type?: string;
|
|
94
57
|
subject_id?: string;
|
|
95
58
|
subject_identifier?: string;
|
|
96
59
|
resource_type?: string;
|
|
97
60
|
resource_id?: string;
|
|
98
61
|
resource_identifier?: string;
|
|
99
|
-
page?: number;
|
|
100
|
-
size?: number;
|
|
101
|
-
sort_by?: string;
|
|
102
|
-
sort_direction?: 'asc' | 'desc';
|
|
103
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Batch creation response for ACL records
|
|
65
|
+
*/
|
|
66
|
+
export interface AclBatchCreateResponse {
|
|
67
|
+
success_count: number;
|
|
68
|
+
failure_count: number;
|
|
69
|
+
success_records: AclRecord[];
|
|
70
|
+
failures: AclBatchFailure[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Failure details for batch creation
|
|
74
|
+
*/
|
|
75
|
+
export interface AclBatchFailure {
|
|
76
|
+
index: number;
|
|
77
|
+
request: CreateAclRecordRequest;
|
|
78
|
+
error_message: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* ACL Template
|
|
82
|
+
* Represents a reusable ACL configuration template
|
|
83
|
+
*/
|
|
84
|
+
export interface AclTemplate {
|
|
85
|
+
template_id: string;
|
|
86
|
+
app_id: string;
|
|
87
|
+
template_name: string;
|
|
88
|
+
template_code: string;
|
|
89
|
+
subject_type?: string;
|
|
90
|
+
subject_filter?: Record<string, unknown>;
|
|
91
|
+
resource_type?: string;
|
|
92
|
+
resource_filter?: Record<string, unknown>;
|
|
93
|
+
effect_type?: string;
|
|
94
|
+
priority?: number;
|
|
95
|
+
data_scope?: Record<string, unknown>;
|
|
96
|
+
description?: string;
|
|
97
|
+
created_at: string;
|
|
98
|
+
updated_at: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Request for creating an ACL template
|
|
102
|
+
*/
|
|
104
103
|
export interface CreateAclTemplateRequest {
|
|
105
104
|
template_name: string;
|
|
106
105
|
template_code: string;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
subject_type?: string;
|
|
107
|
+
subject_filter?: Record<string, unknown>;
|
|
108
|
+
resource_type?: string;
|
|
109
|
+
resource_filter?: Record<string, unknown>;
|
|
110
|
+
effect_type?: string;
|
|
111
|
+
priority?: number;
|
|
112
|
+
data_scope?: Record<string, unknown>;
|
|
111
113
|
description?: string;
|
|
112
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Request for updating an ACL template
|
|
117
|
+
*/
|
|
113
118
|
export interface UpdateAclTemplateRequest {
|
|
114
119
|
template_name?: string;
|
|
115
|
-
subject_filter?: Record<string,
|
|
116
|
-
resource_filter?: Record<string,
|
|
117
|
-
effect_type?:
|
|
118
|
-
|
|
120
|
+
subject_filter?: Record<string, unknown>;
|
|
121
|
+
resource_filter?: Record<string, unknown>;
|
|
122
|
+
effect_type?: string;
|
|
123
|
+
priority?: number;
|
|
124
|
+
data_scope?: Record<string, unknown>;
|
|
119
125
|
description?: string;
|
|
120
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Request for listing ACL templates
|
|
129
|
+
*/
|
|
121
130
|
export interface ListAclTemplatesRequest {
|
|
122
|
-
resource_type?: string;
|
|
123
|
-
subject_type?: 'user' | 'role' | 'group';
|
|
124
131
|
page?: number;
|
|
125
132
|
size?: number;
|
|
126
133
|
sort_by?: string;
|
|
127
|
-
sort_direction?:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
record: AclRecord;
|
|
131
|
-
message?: string;
|
|
132
|
-
}
|
|
133
|
-
export interface CreateAclRecordJson {
|
|
134
|
-
data: CreateAclRecordResponse;
|
|
135
|
-
code: number;
|
|
136
|
-
msg: string;
|
|
137
|
-
}
|
|
138
|
-
export interface UpdateAclRecordResponse {
|
|
139
|
-
record: AclRecord;
|
|
140
|
-
message?: string;
|
|
141
|
-
}
|
|
142
|
-
export interface UpdateAclRecordJson {
|
|
143
|
-
data: UpdateAclRecordResponse;
|
|
144
|
-
code: number;
|
|
145
|
-
msg: string;
|
|
146
|
-
}
|
|
147
|
-
export interface DeleteAclRecordResponse {
|
|
148
|
-
deleted: boolean;
|
|
149
|
-
record_id: string;
|
|
150
|
-
}
|
|
151
|
-
export interface DeleteAclRecordJson {
|
|
152
|
-
data: DeleteAclRecordResponse;
|
|
153
|
-
code: number;
|
|
154
|
-
msg: string;
|
|
155
|
-
}
|
|
156
|
-
export interface GetAclRecordResponse {
|
|
157
|
-
record: AclRecord;
|
|
158
|
-
}
|
|
159
|
-
export interface GetAclRecordJson {
|
|
160
|
-
data: GetAclRecordResponse;
|
|
161
|
-
code: number;
|
|
162
|
-
msg: string;
|
|
163
|
-
}
|
|
164
|
-
export interface ListAclRecordsJson {
|
|
165
|
-
data: PaginatedResponse<AclRecord>;
|
|
166
|
-
code: number;
|
|
167
|
-
msg: string;
|
|
168
|
-
}
|
|
169
|
-
export interface CreateAclTemplateResponse {
|
|
170
|
-
template: AclTemplate;
|
|
171
|
-
message?: string;
|
|
172
|
-
}
|
|
173
|
-
export interface CreateAclTemplateJson {
|
|
174
|
-
data: CreateAclTemplateResponse;
|
|
175
|
-
code: number;
|
|
176
|
-
msg: string;
|
|
177
|
-
}
|
|
178
|
-
export interface UpdateAclTemplateResponse {
|
|
179
|
-
template: AclTemplate;
|
|
180
|
-
message?: string;
|
|
181
|
-
}
|
|
182
|
-
export interface UpdateAclTemplateJson {
|
|
183
|
-
data: UpdateAclTemplateResponse;
|
|
184
|
-
code: number;
|
|
185
|
-
msg: string;
|
|
186
|
-
}
|
|
187
|
-
export interface DeleteAclTemplateResponse {
|
|
188
|
-
deleted: boolean;
|
|
189
|
-
template_id: string;
|
|
190
|
-
}
|
|
191
|
-
export interface DeleteAclTemplateJson {
|
|
192
|
-
data: DeleteAclTemplateResponse;
|
|
193
|
-
code: number;
|
|
194
|
-
msg: string;
|
|
195
|
-
}
|
|
196
|
-
export interface GetAclTemplateResponse {
|
|
197
|
-
template: AclTemplate;
|
|
198
|
-
}
|
|
199
|
-
export interface GetAclTemplateJson {
|
|
200
|
-
data: GetAclTemplateResponse;
|
|
201
|
-
code: number;
|
|
202
|
-
msg: string;
|
|
134
|
+
sort_direction?: "asc" | "desc";
|
|
135
|
+
resource_type?: string;
|
|
136
|
+
subject_type?: string;
|
|
203
137
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Options for ACL operations
|
|
140
|
+
*/
|
|
141
|
+
export interface AclOptions extends CommonOptions {
|
|
208
142
|
}
|
package/dist/common/types.d.ts
CHANGED
|
@@ -50,15 +50,18 @@ export interface Role {
|
|
|
50
50
|
role_name: string;
|
|
51
51
|
role_type?: string;
|
|
52
52
|
role_property?: Record<string, unknown>;
|
|
53
|
-
|
|
53
|
+
role_privileges?: Privilege[];
|
|
54
|
+
privilege_ids?: string[];
|
|
55
|
+
resource_ids?: string[];
|
|
54
56
|
expired_at?: string;
|
|
57
|
+
remark?: string;
|
|
55
58
|
}
|
|
56
59
|
export interface Privilege {
|
|
57
60
|
privilege_id: string;
|
|
58
61
|
privilege_name: string;
|
|
59
62
|
privilege_type?: string;
|
|
60
63
|
privilege_property?: Record<string, unknown>;
|
|
61
|
-
|
|
64
|
+
resource_ids?: string[];
|
|
62
65
|
expired_at?: string;
|
|
63
66
|
remark?: string;
|
|
64
67
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ export * from "./token.js";
|
|
|
3
3
|
export * from "./user/index.js";
|
|
4
4
|
export * from "./auth/index.js";
|
|
5
5
|
export * from "./user-group/index.js";
|
|
6
|
+
export * from "./rbac/index.js";
|
|
7
|
+
export * from "./acl/index.js";
|
|
6
8
|
export * from "./errors.js";
|
|
7
9
|
export type { CommonOptions, PageResponse, UserGroup, Role, Privilege, AppInfo, User } from "./common/types.js";
|