
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
kentico-cloud-model-generator-utility
Advanced tools
This utility generates strongly-typed models based on Content Types in a Kentico Cloud project. The models are supposed to be used together with the Kentico Cloud Typescript SDK.
The purpose of this project is to help you generate strongly typed models out of Kentico Cloud item types. These models can then be used along with the Kentico Cloud Delivery SDK
Install package globally:
npm i kentico-cloud-model-generator-utility -g
To generate models with e.g. ES2015
and TypeScript
navigate to folder where you want to generate models and run:
kc-generate --projectId=xxx --moduleResolution=ES2015 --codeType=TypeScript
codeType
- available options are TypeScript
and JavaScript
moduleResolution
- available options are CommonJs
and ES2015
projectId
- represents the Kentico Cloud Project Id from which models will be generatedsecureAccessKey
- Secure access key required to authenticate requests with enabled secure access in Kentico Cloud project.strictPropertyInitalization
- Marks typescript properties with !
. This is useful if you know all your properties are required. strictPropertyInitalization in TypesriptThere is no direct link between a element and a linked item that can be used inside that element. For this reason, you need to manually swap ContentItem
types with the types that represents that element.
import { ContentItem, Elements } from 'kentico-cloud-delivery';
/**
* This class was generated by 'kentico-cloud-model-generator-utility' at Mon May 07 2018 11:10:02 GMT+0200 (Central Europe Daylight Time).
*
* Note: You can substitute 'ContentItem' type with another generated class. Generator doesn't have this information available
* and so its up to you to define relationship between models.
*/
export class Actor extends ContentItem {
public url: Elements.UrlSlugElement;
public firstName: Elements.TextElement;
public lastName: Elements.TextElement;
public photo: Elements.AssetsElement;
constructor() {
super({
propertyResolver: ((elementName: string) => {
if (elementName === 'first_name') {
return 'firstName';
}
if (elementName === 'last_name') {
return 'lastName';
}
return elementName;
})
});
}
}
import { ContentItem, Elements } from 'kentico-cloud-delivery';
/**
* This class was generated by 'kentico-cloud-model-generator-utility' at Wed May 09 2018 11:14:55 GMT+0200 (Central Europe Daylight Time).
*/
export class Actor extends ContentItem {
constructor() {
super({
propertyResolver: ((elementName) => {
if (elementName === 'first_name') {
return 'firstName';
}
if (elementName === 'last_name') {
return 'lastName';
}
return elementName;
})
});
}
}
var KenticoCloud = require('kentico-cloud-delivery');
/**
* This class was generated by 'kentico-cloud-model-generator-utility' at Wed May 09 2018 11:17:05 GMT+0200 (Central Europe Daylight Time).
*/
export class Actor extends KenticoCloud.ContentItem {
constructor() {
super({
propertyResolver: ((elementName) => {
if (elementName === 'first_name') {
return 'firstName';
}
if (elementName === 'last_name') {
return 'lastName';
}
return elementName;
})
});
}
}
Contributions are welcomed. Simply make a pull request.
FAQs
This utility generates strongly-typed models based on Content Types in a Kentico Cloud project. The models are supposed to be used together with the Kentico Cloud Typescript SDK.
The npm package kentico-cloud-model-generator-utility receives a total of 0 weekly downloads. As such, kentico-cloud-model-generator-utility popularity was classified as not popular.
We found that kentico-cloud-model-generator-utility demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.