@twinfinity/permission 5.0.3-ci.28538
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/BuildInfo.d.ts +12 -0
- package/dist/BuildInfo.d.ts.map +1 -0
- package/dist/BuildInfo.js +15 -0
- package/dist/BuildInfo.js.map +1 -0
- package/dist/PermissionClient.d.ts +19 -0
- package/dist/PermissionClient.d.ts.map +1 -0
- package/dist/PermissionClient.js +149 -0
- package/dist/PermissionClient.js.map +1 -0
- package/dist/errors.d.ts +24 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +45 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +48 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +22 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/PermissionClient.html +6 -0
- package/docs/classes/PermissionConflictError.html +4 -0
- package/docs/classes/PermissionError.html +4 -0
- package/docs/classes/PermissionForbiddenError.html +3 -0
- package/docs/classes/PermissionNotFoundError.html +3 -0
- package/docs/classes/PermissionValidationError.html +3 -0
- package/docs/enums/PrincipalType.html +4 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +1 -0
- package/docs/interfaces/DeleteGroupRequest.html +2 -0
- package/docs/interfaces/Group.html +8 -0
- package/docs/interfaces/IPermissionClient.html +5 -0
- package/docs/interfaces/PaginatedResponse.html +3 -0
- package/docs/interfaces/Pagination.html +4 -0
- package/docs/interfaces/PermissionErrorBody.html +4 -0
- package/docs/interfaces/PutGroupRequest.html +5 -0
- package/docs/interfaces/User.html +6 -0
- package/package.json +55 -0
- package/src/BuildInfo.ts +28 -0
- package/src/PermissionClient.ts +219 -0
- package/src/errors.ts +55 -0
- package/src/index.ts +3 -0
- package/src/tsconfig.json +12 -0
- package/src/types.ts +51 -0
package/src/errors.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { PermissionErrorBody } from './types';
|
|
2
|
+
|
|
3
|
+
export class PermissionValidationError extends Error {
|
|
4
|
+
public readonly body: PermissionErrorBody | undefined;
|
|
5
|
+
|
|
6
|
+
constructor(message: string, body?: PermissionErrorBody) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'PermissionValidationError';
|
|
9
|
+
this.body = body;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class PermissionError extends Error {
|
|
14
|
+
public readonly status: number;
|
|
15
|
+
public readonly statusText: string;
|
|
16
|
+
|
|
17
|
+
constructor(message: string, status: number, statusText: string) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = 'PermissionError';
|
|
20
|
+
this.status = status;
|
|
21
|
+
this.statusText = statusText;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class PermissionNotFoundError extends Error {
|
|
26
|
+
public readonly body: PermissionErrorBody | undefined;
|
|
27
|
+
|
|
28
|
+
constructor(message: string, body?: PermissionErrorBody) {
|
|
29
|
+
super(message);
|
|
30
|
+
this.name = 'PermissionNotFoundError';
|
|
31
|
+
this.body = body;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class PermissionForbiddenError extends Error {
|
|
36
|
+
public readonly body: PermissionErrorBody | undefined;
|
|
37
|
+
|
|
38
|
+
constructor(message: string, body?: PermissionErrorBody) {
|
|
39
|
+
super(message);
|
|
40
|
+
this.name = 'PermissionForbiddenError';
|
|
41
|
+
this.body = body;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export class PermissionConflictError<T = unknown> extends Error {
|
|
46
|
+
public readonly data: T | undefined;
|
|
47
|
+
public readonly body: PermissionErrorBody | undefined;
|
|
48
|
+
|
|
49
|
+
constructor(message: string, data: T | undefined, body?: PermissionErrorBody) {
|
|
50
|
+
super(message);
|
|
51
|
+
this.name = 'PermissionConflictError';
|
|
52
|
+
this.data = data;
|
|
53
|
+
this.body = body;
|
|
54
|
+
}
|
|
55
|
+
}
|
package/src/index.ts
ADDED
package/src/types.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface Pagination {
|
|
2
|
+
limit: number;
|
|
3
|
+
maxLimit: number;
|
|
4
|
+
nextPage: string | null;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface PaginatedResponse<T> {
|
|
8
|
+
data: T[];
|
|
9
|
+
pagination: Pagination;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface User {
|
|
13
|
+
id: string;
|
|
14
|
+
username: string;
|
|
15
|
+
email: string;
|
|
16
|
+
firstName: string | null;
|
|
17
|
+
lastName: string | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export enum PrincipalType {
|
|
21
|
+
Unknown = 'Unknown',
|
|
22
|
+
DomainGroup = 'DomainGroup',
|
|
23
|
+
Group = 'Group'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Group {
|
|
27
|
+
id: string;
|
|
28
|
+
ownerSystem: string;
|
|
29
|
+
principalType: PrincipalType;
|
|
30
|
+
title: string;
|
|
31
|
+
displayName: string | null;
|
|
32
|
+
etag: string;
|
|
33
|
+
isEditable: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface PutGroupRequest {
|
|
37
|
+
/** Title for the group. Used on create; ignored on update (title is immutable). */
|
|
38
|
+
title: string;
|
|
39
|
+
displayName?: string | null;
|
|
40
|
+
etag?: string | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface DeleteGroupRequest {
|
|
44
|
+
etag: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface PermissionErrorBody {
|
|
48
|
+
detail: string;
|
|
49
|
+
cause: string;
|
|
50
|
+
item?: { kind: string; id?: string } | null;
|
|
51
|
+
}
|