@malevich-studio/strapi-sdk-typescript 1.2.9 → 1.2.11
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 +13 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +13 -6
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +9 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +9 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -21300,18 +21300,16 @@ class Strapi {
|
|
|
21300
21300
|
this.token = token;
|
|
21301
21301
|
}
|
|
21302
21302
|
async fetch(endpoint, data = {}, params = {}) {
|
|
21303
|
-
|
|
21303
|
+
const queryString = params.method === 'GET' ? qs.stringify(data) : '';
|
|
21304
|
+
return await this.fetchData(queryString ? `${endpoint}?${queryString}` : endpoint, { data }, params);
|
|
21304
21305
|
}
|
|
21305
21306
|
async fetchData(endpoint, data = {}, params = {}) {
|
|
21306
|
-
|
|
21307
|
-
return await this.baseFetch(queryString ? `${endpoint}?${queryString}` : endpoint, _.merge({
|
|
21307
|
+
return await this.baseFetch(endpoint, _.merge({
|
|
21308
21308
|
headers: {
|
|
21309
21309
|
'Content-Type': 'application/json',
|
|
21310
21310
|
},
|
|
21311
21311
|
...(params.method && !['GET', 'DELETE'].includes(params.method) ? {
|
|
21312
|
-
body: JSON.stringify(
|
|
21313
|
-
data,
|
|
21314
|
-
})
|
|
21312
|
+
body: JSON.stringify(data)
|
|
21315
21313
|
} : {}),
|
|
21316
21314
|
}, params));
|
|
21317
21315
|
}
|
|
@@ -21378,6 +21376,11 @@ class Strapi {
|
|
|
21378
21376
|
}
|
|
21379
21377
|
return response;
|
|
21380
21378
|
}
|
|
21379
|
+
async baseMe(data) {
|
|
21380
|
+
return await this.fetchData('users/me', data, {
|
|
21381
|
+
method: 'GET',
|
|
21382
|
+
});
|
|
21383
|
+
}
|
|
21381
21384
|
async getLocales(params) {
|
|
21382
21385
|
return await this.baseFetch('i18n/locales', _.merge({
|
|
21383
21386
|
headers: {
|
|
@@ -22007,6 +22010,10 @@ async function generateStrapiTypes(strapi) {
|
|
|
22007
22010
|
` return await this.baseChangePassword<User>(password, currentPassword);`,
|
|
22008
22011
|
' }',
|
|
22009
22012
|
' ',
|
|
22013
|
+
` public async me(data: UserInput) {`,
|
|
22014
|
+
` return await this.baseMer<User, UserInput>(data);`,
|
|
22015
|
+
' }',
|
|
22016
|
+
' ',
|
|
22010
22017
|
methods.join('\n\n'),
|
|
22011
22018
|
'}',
|
|
22012
22019
|
'',
|