@malevich-studio/strapi-sdk-typescript 1.2.18 → 1.2.19
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/cli.cjs +3 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +3 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -148,7 +148,7 @@ type DynamiczonePopulate<T> = {
|
|
|
148
148
|
[K in keyof T]: T[K];
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
|
-
declare class Strapi {
|
|
151
|
+
declare abstract class Strapi {
|
|
152
152
|
private readonly url;
|
|
153
153
|
private token?;
|
|
154
154
|
constructor(url: string, token?: string | undefined);
|
|
@@ -179,6 +179,11 @@ declare class Strapi {
|
|
|
179
179
|
uploadForm(form: FormData): Promise<File[]>;
|
|
180
180
|
private baseFetch;
|
|
181
181
|
private permissionsList?;
|
|
182
|
+
abstract me(): Promise<{
|
|
183
|
+
role?: {
|
|
184
|
+
documentId?: string;
|
|
185
|
+
};
|
|
186
|
+
}>;
|
|
182
187
|
can(uid: string, controller: string, action: PermissionAction): Promise<boolean>;
|
|
183
188
|
}
|
|
184
189
|
|
package/dist/index.mjs
CHANGED
|
@@ -21436,8 +21436,9 @@ class Strapi {
|
|
|
21436
21436
|
}
|
|
21437
21437
|
async can(uid, controller, action) {
|
|
21438
21438
|
if (!this.permissionsList) {
|
|
21439
|
-
const
|
|
21440
|
-
|
|
21439
|
+
const { role } = await this.me();
|
|
21440
|
+
const response = await this.fetchData(`users-permissions/role/${role?.documentId}`);
|
|
21441
|
+
this.permissionsList = response.role.permissions;
|
|
21441
21442
|
}
|
|
21442
21443
|
if (!this.permissionsList[uid]) {
|
|
21443
21444
|
throw new Error(`Permissions for ${uid} not found!`);
|