@malevich-studio/strapi-sdk-typescript 1.0.6 → 1.0.8
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 +17 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +17 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/generator/attributes/date.d.ts +11 -0
- package/dist/index.cjs +5 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/cli.cjs
CHANGED
|
@@ -21304,10 +21304,10 @@ class Strapi {
|
|
|
21304
21304
|
return await this.uploadForm(form);
|
|
21305
21305
|
}
|
|
21306
21306
|
async uploadForm(form) {
|
|
21307
|
-
return await this.baseRequest('upload', {
|
|
21307
|
+
return (await this.baseRequest('upload', {
|
|
21308
21308
|
method: 'POST',
|
|
21309
21309
|
body: form,
|
|
21310
|
-
});
|
|
21310
|
+
}));
|
|
21311
21311
|
}
|
|
21312
21312
|
async baseRequest(endpoint, params = {}) {
|
|
21313
21313
|
const response = await fetch(`${this.url}/api/${endpoint}`, _.merge({
|
|
@@ -21317,13 +21317,10 @@ class Strapi {
|
|
|
21317
21317
|
}, params));
|
|
21318
21318
|
if (!response.ok) {
|
|
21319
21319
|
console.log(`${this.url}/api/${endpoint}`);
|
|
21320
|
-
console.log(_.merge({
|
|
21321
|
-
headers: {
|
|
21322
|
-
Authorization: `Bearer ${this.token}`,
|
|
21323
|
-
},
|
|
21324
|
-
}, params));
|
|
21325
21320
|
console.log(response);
|
|
21326
|
-
|
|
21321
|
+
const data = await response.json();
|
|
21322
|
+
console.log(data);
|
|
21323
|
+
console.log(data?.error?.details?.errors);
|
|
21327
21324
|
throw new Error(`Помилка запиту до Strapi: ${response.status} ${response.statusText}`);
|
|
21328
21325
|
}
|
|
21329
21326
|
return (await response.json());
|
|
@@ -21632,6 +21629,17 @@ let Boolean$1 = class Boolean extends Base {
|
|
|
21632
21629
|
}
|
|
21633
21630
|
};
|
|
21634
21631
|
|
|
21632
|
+
let Date$1 = class Date extends Base {
|
|
21633
|
+
constructor(name, attribute) {
|
|
21634
|
+
super(name, attribute);
|
|
21635
|
+
this.name = name;
|
|
21636
|
+
this.attribute = attribute;
|
|
21637
|
+
}
|
|
21638
|
+
getType() {
|
|
21639
|
+
return 'string';
|
|
21640
|
+
}
|
|
21641
|
+
};
|
|
21642
|
+
|
|
21635
21643
|
const types = {
|
|
21636
21644
|
'string': String$1,
|
|
21637
21645
|
'text': String$1,
|
|
@@ -21645,6 +21653,7 @@ const types = {
|
|
|
21645
21653
|
'media': Media,
|
|
21646
21654
|
'relation': Relation,
|
|
21647
21655
|
'enumeration': Enumeration,
|
|
21656
|
+
'date': Date$1,
|
|
21648
21657
|
'datetime': DateTime,
|
|
21649
21658
|
'component': Component,
|
|
21650
21659
|
'blocks': Blocks,
|