@malevich-studio/strapi-sdk-typescript 1.2.21 → 1.2.22
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 +12 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +12 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +11 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +11 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -21413,6 +21413,12 @@ class Strapi {
|
|
|
21413
21413
|
...params,
|
|
21414
21414
|
});
|
|
21415
21415
|
}
|
|
21416
|
+
async updateUser(endpoint, id, data, params = {}) {
|
|
21417
|
+
return await this.fetchData(`${endpoint}/${id}`, data, {
|
|
21418
|
+
method: 'PUT',
|
|
21419
|
+
...params,
|
|
21420
|
+
});
|
|
21421
|
+
}
|
|
21416
21422
|
async delete(endpoint, id, params = {}) {
|
|
21417
21423
|
return await this.fetch(`${endpoint}/${id}`, {}, {
|
|
21418
21424
|
method: 'DELETE',
|
|
@@ -21434,7 +21440,11 @@ class Strapi {
|
|
|
21434
21440
|
} : {}),
|
|
21435
21441
|
}, params);
|
|
21436
21442
|
const response = await fetch(`${this.url}/api/${endpoint}`, mergedParams);
|
|
21437
|
-
|
|
21443
|
+
let data = null;
|
|
21444
|
+
try {
|
|
21445
|
+
data = await response?.json() || null;
|
|
21446
|
+
}
|
|
21447
|
+
catch (error) { }
|
|
21438
21448
|
log(mergedParams);
|
|
21439
21449
|
log(response);
|
|
21440
21450
|
log(data);
|
|
@@ -21944,7 +21954,7 @@ function generateMethodsCode(contentType, permissions) {
|
|
|
21944
21954
|
].join('\n'));
|
|
21945
21955
|
methods.push([
|
|
21946
21956
|
` public async update${getContentTypeName(contentType.schema.singularName)}(id: string, data: ${modelName}Input, params?: RequestInit) {`,
|
|
21947
|
-
` return await this.update<${modelName}, ${modelName}Input>('${contentType.schema.pluralName}', id, data, params);`,
|
|
21957
|
+
` return await this.update${modelName === 'User' ? 'User' : ''}<${modelName}, ${modelName}Input>('${contentType.schema.pluralName}', id, data, params);`,
|
|
21948
21958
|
' }',
|
|
21949
21959
|
].join('\n'));
|
|
21950
21960
|
methods.push([
|