@malevich-studio/strapi-sdk-typescript 1.2.3 → 1.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/README.md +31 -3
- package/dist/cli.cjs +65 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +65 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +52 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.mjs +52 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -20102,6 +20102,9 @@ class Strapi {
|
|
|
20102
20102
|
setToken(token) {
|
|
20103
20103
|
this.token = token;
|
|
20104
20104
|
}
|
|
20105
|
+
getToken() {
|
|
20106
|
+
return this.token;
|
|
20107
|
+
}
|
|
20105
20108
|
async baseLogin(identifier, password) {
|
|
20106
20109
|
const response = await this.fetchData('/auth/local', {
|
|
20107
20110
|
identifier,
|
|
@@ -20109,8 +20112,55 @@ class Strapi {
|
|
|
20109
20112
|
}, {
|
|
20110
20113
|
method: 'POST',
|
|
20111
20114
|
});
|
|
20112
|
-
|
|
20113
|
-
|
|
20115
|
+
if (!response.error) {
|
|
20116
|
+
this.setToken(response.jwt);
|
|
20117
|
+
}
|
|
20118
|
+
return response;
|
|
20119
|
+
}
|
|
20120
|
+
async baseRegister(data) {
|
|
20121
|
+
const response = await this.fetchData('/auth/local/register', data, {
|
|
20122
|
+
method: 'POST',
|
|
20123
|
+
});
|
|
20124
|
+
if (!response.error) {
|
|
20125
|
+
this.setToken(response.jwt);
|
|
20126
|
+
}
|
|
20127
|
+
return response;
|
|
20128
|
+
}
|
|
20129
|
+
async forgotPassword(email) {
|
|
20130
|
+
return await this.fetchData('/auth/forgot-password', { email }, {
|
|
20131
|
+
method: 'POST',
|
|
20132
|
+
});
|
|
20133
|
+
}
|
|
20134
|
+
async sendEmailConfirmation(email) {
|
|
20135
|
+
return await this.fetchData('/auth/send-email-confirmation', { email }, {
|
|
20136
|
+
method: 'POST',
|
|
20137
|
+
});
|
|
20138
|
+
}
|
|
20139
|
+
async baseResetPassword(password, code) {
|
|
20140
|
+
const response = await this.fetchData('/auth/reset-password', {
|
|
20141
|
+
password,
|
|
20142
|
+
passwordConfirmation: password,
|
|
20143
|
+
code,
|
|
20144
|
+
}, {
|
|
20145
|
+
method: 'POST',
|
|
20146
|
+
});
|
|
20147
|
+
if (!response.error) {
|
|
20148
|
+
this.setToken(response.jwt);
|
|
20149
|
+
}
|
|
20150
|
+
return response;
|
|
20151
|
+
}
|
|
20152
|
+
async baseChangePassword(password, currentPassword) {
|
|
20153
|
+
const response = await this.fetchData('/auth/change-password', {
|
|
20154
|
+
password,
|
|
20155
|
+
passwordConfirmation: password,
|
|
20156
|
+
currentPassword,
|
|
20157
|
+
}, {
|
|
20158
|
+
method: 'POST',
|
|
20159
|
+
});
|
|
20160
|
+
if (!response.error) {
|
|
20161
|
+
this.setToken(response.jwt);
|
|
20162
|
+
}
|
|
20163
|
+
return response;
|
|
20114
20164
|
}
|
|
20115
20165
|
async getLocales(params) {
|
|
20116
20166
|
return await this.baseFetch('i18n/locales', _.merge({
|
|
@@ -20731,7 +20781,19 @@ async function generateStrapiTypes(strapi) {
|
|
|
20731
20781
|
` public async login(identifier: string, password: string) {`,
|
|
20732
20782
|
` return await this.baseLogin<User>(identifier, password);`,
|
|
20733
20783
|
' }',
|
|
20734
|
-
'',
|
|
20784
|
+
' ',
|
|
20785
|
+
` public async register(data: UserInput) {`,
|
|
20786
|
+
` return await this.baseRegister<User, UserInput>(data);`,
|
|
20787
|
+
' }',
|
|
20788
|
+
' ',
|
|
20789
|
+
` public async resetPassword(password: string, code: string) {`,
|
|
20790
|
+
` return await this.baseResetPassword<User>(password, code);`,
|
|
20791
|
+
' }',
|
|
20792
|
+
' ',
|
|
20793
|
+
` public async changePassword(password: string, currentPassword: string) {`,
|
|
20794
|
+
` return await this.baseChangePassword<User>(password, currentPassword);`,
|
|
20795
|
+
' }',
|
|
20796
|
+
' ',
|
|
20735
20797
|
methods.join('\n\n'),
|
|
20736
20798
|
'}',
|
|
20737
20799
|
'',
|