@malevich-studio/strapi-sdk-typescript 1.2.21 → 1.2.23

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 CHANGED
@@ -21433,6 +21433,12 @@ class Strapi {
21433
21433
  ...params,
21434
21434
  });
21435
21435
  }
21436
+ async updateBaseUser(endpoint, id, data, params = {}) {
21437
+ return await this.fetchData(`${endpoint}/${id}`, data, {
21438
+ method: 'PUT',
21439
+ ...params,
21440
+ });
21441
+ }
21436
21442
  async delete(endpoint, id, params = {}) {
21437
21443
  return await this.fetch(`${endpoint}/${id}`, {}, {
21438
21444
  method: 'DELETE',
@@ -21454,7 +21460,11 @@ class Strapi {
21454
21460
  } : {}),
21455
21461
  }, params);
21456
21462
  const response = await fetch(`${this.url}/api/${endpoint}`, mergedParams);
21457
- const data = await response.json();
21463
+ let data = null;
21464
+ try {
21465
+ data = await response?.json() || null;
21466
+ }
21467
+ catch (error) { }
21458
21468
  log(mergedParams);
21459
21469
  log(response);
21460
21470
  log(data);
@@ -21964,7 +21974,7 @@ function generateMethodsCode(contentType, permissions) {
21964
21974
  ].join('\n'));
21965
21975
  methods.push([
21966
21976
  ` public async update${getContentTypeName(contentType.schema.singularName)}(id: string, data: ${modelName}Input, params?: RequestInit) {`,
21967
- ` return await this.update<${modelName}, ${modelName}Input>('${contentType.schema.pluralName}', id, data, params);`,
21977
+ ` return await this.update${modelName === 'User' ? 'BaseUser' : ''}<${modelName}, ${modelName}Input>('${contentType.schema.pluralName}', id, data, params);`,
21968
21978
  ' }',
21969
21979
  ].join('\n'));
21970
21980
  methods.push([