@malevich-studio/strapi-sdk-typescript 1.0.15 → 1.0.16
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 +4 -0
- package/dist/cli.cjs +40 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +40 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/generator/attributes/dynamiczone.d.ts +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,6 +114,7 @@ const articles = api.articles(
|
|
|
114
114
|
- [ ] Log In functionality
|
|
115
115
|
- [ ] User Registration
|
|
116
116
|
- [ ] User privileges check
|
|
117
|
+
- [ ] Add localization features
|
|
117
118
|
- [ ] Refactor `src/generator/index.ts` for better maintainability
|
|
118
119
|
- [ ] Enable passing Strapi credentials via CLI parameters
|
|
119
120
|
- [ ] Allow customization of API class path
|
|
@@ -125,3 +126,6 @@ const articles = api.articles(
|
|
|
125
126
|
---
|
|
126
127
|
|
|
127
128
|
📌 **Contributions are welcome!** If you encounter issues or have feature requests, feel free to open a pull request or an issue. 🚀
|
|
129
|
+
|
|
130
|
+
📦 [View on NPM](https://www.npmjs.com/package/@malevich-studio/strapi-sdk-typescript)
|
|
131
|
+
🔗 [GitHub Repository](https://github.com/malevich-studio/strapi-sdk-typescript)
|
package/dist/cli.cjs
CHANGED
|
@@ -21641,6 +21641,43 @@ let Date$1 = class Date extends Base {
|
|
|
21641
21641
|
}
|
|
21642
21642
|
};
|
|
21643
21643
|
|
|
21644
|
+
class Dynamiczone extends BaseRelation {
|
|
21645
|
+
constructor(name, attribute) {
|
|
21646
|
+
super(name, attribute);
|
|
21647
|
+
this.name = name;
|
|
21648
|
+
this.attribute = attribute;
|
|
21649
|
+
}
|
|
21650
|
+
getType() {
|
|
21651
|
+
const types = this.attribute.components
|
|
21652
|
+
.map(componentItem => getComponentName(componentItem))
|
|
21653
|
+
.join(' | ');
|
|
21654
|
+
return `(${types})[]`;
|
|
21655
|
+
}
|
|
21656
|
+
getInputType() {
|
|
21657
|
+
const types = this.attribute.components
|
|
21658
|
+
.map(componentItem => `DynamiczoneInput<'${componentItem}', ${getComponentName(componentItem)}Input>`)
|
|
21659
|
+
.join(' | ');
|
|
21660
|
+
return `(${types})[]`;
|
|
21661
|
+
}
|
|
21662
|
+
getPopulates() {
|
|
21663
|
+
const types = this.attribute.components
|
|
21664
|
+
.map(componentItem => `${getComponentName(componentItem)}Query`)
|
|
21665
|
+
.join(' & ');
|
|
21666
|
+
return [{
|
|
21667
|
+
name: this.name,
|
|
21668
|
+
type: `DynamiczonePopulate<${types}>`,
|
|
21669
|
+
}];
|
|
21670
|
+
}
|
|
21671
|
+
getFilters() {
|
|
21672
|
+
return [
|
|
21673
|
+
// {
|
|
21674
|
+
// name: this.name,
|
|
21675
|
+
// type: `${getComponentName(this.attribute.component)}Filters`,
|
|
21676
|
+
// }
|
|
21677
|
+
];
|
|
21678
|
+
}
|
|
21679
|
+
}
|
|
21680
|
+
|
|
21644
21681
|
const types = {
|
|
21645
21682
|
'string': String$1,
|
|
21646
21683
|
'text': String$1,
|
|
@@ -21657,11 +21694,13 @@ const types = {
|
|
|
21657
21694
|
'date': Date$1,
|
|
21658
21695
|
'datetime': DateTime,
|
|
21659
21696
|
'component': Component,
|
|
21697
|
+
'dynamiczone': Dynamiczone,
|
|
21660
21698
|
'blocks': Blocks,
|
|
21661
21699
|
'json': Json,
|
|
21662
21700
|
};
|
|
21663
21701
|
function getAttributeGenerator(name, attribute) {
|
|
21664
21702
|
if (!types[attribute.type]) {
|
|
21703
|
+
console.log(attribute);
|
|
21665
21704
|
throw new Error(`Attribute type "${attribute.type}" is not defined`);
|
|
21666
21705
|
}
|
|
21667
21706
|
return new types[attribute.type](name, attribute);
|
|
@@ -21814,7 +21853,7 @@ async function generateStrapiTypes(strapi) {
|
|
|
21814
21853
|
allInterfaces.push(generateInputTypeCode(modelName, attributes));
|
|
21815
21854
|
}
|
|
21816
21855
|
const output = [
|
|
21817
|
-
'import {Strapi as StrapiBase, Query, Filters, FilterValue, RelationInput} from "@malevich-studio/strapi-sdk-typescript";',
|
|
21856
|
+
'import {Strapi as StrapiBase, Query, Filters, FilterValue, RelationInput, DynamiczonePopulate, DynamiczoneInput} from "@malevich-studio/strapi-sdk-typescript";',
|
|
21818
21857
|
'import {BlocksContent} from "@strapi/blocks-react-renderer";',
|
|
21819
21858
|
'',
|
|
21820
21859
|
'export default class Strapi extends StrapiBase {',
|