@rebasepro/client 0.2.4 → 0.2.5
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/admin.d.ts +1 -31
- package/dist/index.es.js +0 -28
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +0 -28
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -4
- package/src/admin.ts +1 -41
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.5",
|
|
5
5
|
"description": "HTTP SDK client for the Rebase custom backend",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/rebaseco"
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"./package.json": "./package.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@rebasepro/common": "0.2.
|
|
34
|
-
"@rebasepro/
|
|
35
|
-
"@rebasepro/
|
|
33
|
+
"@rebasepro/common": "0.2.5",
|
|
34
|
+
"@rebasepro/utils": "0.2.5",
|
|
35
|
+
"@rebasepro/types": "0.2.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@jest/globals": "^29.7.0",
|
package/src/admin.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transport } from "./transport";
|
|
1
|
+
import type { Transport } from "./transport";
|
|
2
2
|
|
|
3
3
|
export interface AdminUser {
|
|
4
4
|
uid: string;
|
|
@@ -11,13 +11,6 @@ export interface AdminUser {
|
|
|
11
11
|
updatedAt: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export interface RebaseRole {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
isAdmin: boolean;
|
|
18
|
-
defaultPermissions: Record<string, unknown> | null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
14
|
export interface CreateAdminOptions {
|
|
22
15
|
adminPath?: string;
|
|
23
16
|
}
|
|
@@ -67,34 +60,6 @@ export function createAdmin(transport: Transport, options?: CreateAdminOptions)
|
|
|
67
60
|
});
|
|
68
61
|
}
|
|
69
62
|
|
|
70
|
-
async function listRoles() {
|
|
71
|
-
return transport.request<{ roles: RebaseRole[] }>(adminPath + "/roles", { method: "GET" });
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async function getRole(roleId: string) {
|
|
75
|
-
return transport.request<{ role: RebaseRole }>(adminPath + "/roles/" + encodeURIComponent(roleId), { method: "GET" });
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async function createRole(data: { id: string, name: string, isAdmin?: boolean, defaultPermissions?: Record<string, unknown> }) {
|
|
79
|
-
return transport.request<{ role: RebaseRole }>(adminPath + "/roles", {
|
|
80
|
-
method: "POST",
|
|
81
|
-
body: JSON.stringify(data)
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
async function updateRole(roleId: string, data: { name?: string, isAdmin?: boolean, defaultPermissions?: Record<string, unknown> }) {
|
|
86
|
-
return transport.request<{ role: RebaseRole }>(adminPath + "/roles/" + encodeURIComponent(roleId), {
|
|
87
|
-
method: "PUT",
|
|
88
|
-
body: JSON.stringify(data)
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async function deleteRole(roleId: string) {
|
|
93
|
-
return transport.request<{ success: boolean }>(adminPath + "/roles/" + encodeURIComponent(roleId), {
|
|
94
|
-
method: "DELETE"
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
63
|
async function bootstrap() {
|
|
99
64
|
return transport.request<{ success: boolean; message: string; user: { uid: string; roles: string[] } }>(adminPath + "/bootstrap", {
|
|
100
65
|
method: "POST"
|
|
@@ -108,11 +73,6 @@ export function createAdmin(transport: Transport, options?: CreateAdminOptions)
|
|
|
108
73
|
createUser,
|
|
109
74
|
updateUser,
|
|
110
75
|
deleteUser,
|
|
111
|
-
listRoles,
|
|
112
|
-
getRole,
|
|
113
|
-
createRole,
|
|
114
|
-
updateRole,
|
|
115
|
-
deleteRole,
|
|
116
76
|
bootstrap
|
|
117
77
|
};
|
|
118
78
|
}
|