@malevich-studio/strapi-sdk-typescript 1.0.7 → 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 +16 -7
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +16 -7
- package/dist/cli.mjs.map +1 -1
- package/dist/generator/attributes/date.d.ts +11 -0
- package/dist/index.cjs +4 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +4 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/cli.mjs
CHANGED
|
@@ -21287,7 +21287,7 @@ class Strapi {
|
|
|
21287
21287
|
return (await this.baseRequest('upload', {
|
|
21288
21288
|
method: 'POST',
|
|
21289
21289
|
body: form,
|
|
21290
|
-
}))
|
|
21290
|
+
}));
|
|
21291
21291
|
}
|
|
21292
21292
|
async baseRequest(endpoint, params = {}) {
|
|
21293
21293
|
const response = await fetch(`${this.url}/api/${endpoint}`, _.merge({
|
|
@@ -21297,13 +21297,10 @@ class Strapi {
|
|
|
21297
21297
|
}, params));
|
|
21298
21298
|
if (!response.ok) {
|
|
21299
21299
|
console.log(`${this.url}/api/${endpoint}`);
|
|
21300
|
-
console.log(_.merge({
|
|
21301
|
-
headers: {
|
|
21302
|
-
Authorization: `Bearer ${this.token}`,
|
|
21303
|
-
},
|
|
21304
|
-
}, params));
|
|
21305
21300
|
console.log(response);
|
|
21306
|
-
|
|
21301
|
+
const data = await response.json();
|
|
21302
|
+
console.log(data);
|
|
21303
|
+
console.log(data?.error?.details?.errors);
|
|
21307
21304
|
throw new Error(`Помилка запиту до Strapi: ${response.status} ${response.statusText}`);
|
|
21308
21305
|
}
|
|
21309
21306
|
return (await response.json());
|
|
@@ -21612,6 +21609,17 @@ let Boolean$1 = class Boolean extends Base {
|
|
|
21612
21609
|
}
|
|
21613
21610
|
};
|
|
21614
21611
|
|
|
21612
|
+
let Date$1 = class Date extends Base {
|
|
21613
|
+
constructor(name, attribute) {
|
|
21614
|
+
super(name, attribute);
|
|
21615
|
+
this.name = name;
|
|
21616
|
+
this.attribute = attribute;
|
|
21617
|
+
}
|
|
21618
|
+
getType() {
|
|
21619
|
+
return 'string';
|
|
21620
|
+
}
|
|
21621
|
+
};
|
|
21622
|
+
|
|
21615
21623
|
const types = {
|
|
21616
21624
|
'string': String$1,
|
|
21617
21625
|
'text': String$1,
|
|
@@ -21625,6 +21633,7 @@ const types = {
|
|
|
21625
21633
|
'media': Media,
|
|
21626
21634
|
'relation': Relation,
|
|
21627
21635
|
'enumeration': Enumeration,
|
|
21636
|
+
'date': Date$1,
|
|
21628
21637
|
'datetime': DateTime,
|
|
21629
21638
|
'component': Component,
|
|
21630
21639
|
'blocks': Blocks,
|