@krlwlfrt/tsg
Advanced tools
Comparing version 1.0.2 to 1.1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generatePropertyType = exports.generateName = void 0; | ||
exports.generateName = generateName; | ||
exports.generatePropertyType = generatePropertyType; | ||
const index_1 = require("./index"); | ||
@@ -14,3 +15,2 @@ function generateName(thing) { | ||
} | ||
exports.generateName = generateName; | ||
function generatePropertyType(property) { | ||
@@ -30,3 +30,2 @@ let type = generateName(property.type); | ||
} | ||
exports.generatePropertyType = generatePropertyType; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhhbXBsZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvZXhhbXBsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBY0EsbUNBQXlFO0FBT3pFLFNBQWdCLFlBQVksQ0FBQyxLQUFnQztJQUMzRCxJQUFJLElBQUEsbUJBQVcsRUFBQyxLQUFLLENBQUMsRUFBRTtRQUN0QixPQUFPLEtBQUssQ0FBQyxJQUFJLENBQUM7S0FDbkI7SUFFRCxJQUFJLE9BQU8sS0FBSyxDQUFDLFNBQVMsS0FBSyxRQUFRLElBQUksS0FBSyxDQUFDLFNBQVMsQ0FBQyxNQUFNLEtBQUssQ0FBQyxFQUFFO1FBQ3ZFLE9BQU8sS0FBSyxDQUFDLElBQUksQ0FBQztLQUNuQjtJQUVELE9BQU8sR0FBRyxLQUFLLENBQUMsU0FBUyxJQUFJLEtBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQztBQUM1QyxDQUFDO0FBVkQsb0NBVUM7QUFPRCxTQUFnQixvQkFBb0IsQ0FBQyxRQUFrQjtJQUNyRCxJQUFJLElBQUksR0FBRyxZQUFZLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxDQUFDO0lBRXZDLElBQUksUUFBUSxDQUFDLElBQUksQ0FBQyxTQUFTLEtBQUssS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0FBQyxTQUFTLElBQUksS0FBSyxDQUFDLElBQUksRUFBRSxDQUFDO0FBQzVDLENBQUM7QUFPRCxTQUFnQixvQkFBb0IsQ0FBQyxRQUFrQjtJQUNyRCxJQUFJLElBQUksR0FBRyxZQUFZLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxDQUFDO0lBRXZDLElBQUksUUFBUSxDQUFDLElBQUksQ0FBQyxTQUFTLEtBQUssS0FBSyxFQUFFLENBQUM7UUFDdEMsSUFBSSxHQUFHLFFBQVEsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFdBQVcsRUFBRSxDQUFDO0lBQzFDLENBQUM7SUFFRCxJQUFJLEtBQUssQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLFVBQVUsQ0FBQyxFQUFFLENBQUM7UUFDdkMsS0FBSyxNQUFNLFNBQVMsSUFBSSxRQUFRLENBQUMsVUFBVSxFQUFFLENBQUM7WUFDNUMsSUFBSSxTQUFTLENBQUMsSUFBSSxLQUFLLFVBQVUsSUFBSSxPQUFPLFNBQVMsQ0FBQyxLQUFLLEtBQUssU0FBUyxJQUFJLFNBQVMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztnQkFDN0YsSUFBSSxJQUFJLFNBQVMsQ0FBQztZQUNwQixDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7SUFFRCxPQUFPLElBQUksQ0FBQztBQUNkLENBQUMifQ== |
@@ -22,9 +22,9 @@ export interface ThingWithNameAndNamespace { | ||
export interface Union extends ThingWithNameAndNamespace { | ||
unitedTypes: Array<(Type | string | number | boolean)>; | ||
unitedTypes: (Type | string | number | boolean)[]; | ||
} | ||
export interface Enum extends ThingWithNameAndNamespace { | ||
items: Array<{ | ||
items: { | ||
key: string; | ||
value: string | number | boolean; | ||
}>; | ||
}[]; | ||
} | ||
@@ -31,0 +31,0 @@ export declare function isEntity(type: Type): type is Entity; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateTypeScript = exports.checkDuplicateNames = exports.isAttribute = exports.isEnum = exports.isUnion = exports.isEntity = void 0; | ||
exports.isEntity = isEntity; | ||
exports.isUnion = isUnion; | ||
exports.isEnum = isEnum; | ||
exports.isAttribute = isAttribute; | ||
exports.checkDuplicateNames = checkDuplicateNames; | ||
exports.generateTypeScript = generateTypeScript; | ||
function isEntity(type) { | ||
@@ -10,3 +15,2 @@ if (!('properties' in type)) { | ||
} | ||
exports.isEntity = isEntity; | ||
function isUnion(type) { | ||
@@ -18,3 +22,2 @@ if (!('unitedTypes' in type)) { | ||
} | ||
exports.isUnion = isUnion; | ||
function isEnum(type) { | ||
@@ -26,3 +29,2 @@ if (!('items' in type)) { | ||
} | ||
exports.isEnum = isEnum; | ||
function isAttribute(thing) { | ||
@@ -34,3 +36,2 @@ if (!('value' in thing)) { | ||
} | ||
exports.isAttribute = isAttribute; | ||
function checkDuplicateNames(types, checkNamespace = false) { | ||
@@ -53,3 +54,2 @@ if (types.length < 2) { | ||
} | ||
exports.checkDuplicateNames = checkDuplicateNames; | ||
function quotePropertyName(name) { | ||
@@ -163,3 +163,2 @@ if (!/^[a-z0-9]*$/i.test(name)) { | ||
} | ||
exports.generateTypeScript = generateTypeScript; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBaUlBLFNBQWdCLFFBQVEsQ0FBQyxJQUFVO0lBQ2pDLElBQUksQ0FBQyxDQUFDLFlBQVksSUFBSSxJQUFJLENBQUMsRUFBRTtRQUMzQixPQUFPLEtBQUssQ0FBQztLQUNkO0lBRUQsT0FBTyxLQUFLLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsQ0FBQztBQUN4QyxDQUFDO0FBTkQsNEJBTUM7QUFPRCxTQUFnQixPQ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FNLFlBQVksR0FBRyxxQkFBcUIsQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUVqRCxNQUFNLElBQUksZUFBZSxhQUFhLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQztZQUVsRCxJQUFJLElBQUksQ0FBQyxRQUFRLEtBQUssSUFBSSxFQUFFLENBQUM7Z0JBQzNCLElBQUksWUFBWSxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQztvQkFDbkMsTUFBTSxJQUFJLFNBQVMsWUFBWSxHQUFHLENBQUM7Z0JBQ3JDLENBQUM7cUJBQU0sQ0FBQztvQkFDTixNQUFNLElBQUksR0FBRyxZQUFZLElBQUksQ0FBQztnQkFDaEMsQ0FBQztZQUNILENBQUM7aUJBQU0sQ0FBQztnQkFDTixNQUFNLElBQUksR0FBRyxZQUFZLEVBQUUsQ0FBQztZQUM5QixDQUFDO1lBRUQsTUFBTSxJQUFJLEtBQUssQ0FBQztRQUNsQixDQUFDO0lBQ0gsQ0FBQztJQUVELE9BQU8sTUFBTSxDQUFDO0FBQ2hCLENBQUMifQ== |
{ | ||
"name": "@krlwlfrt/tsg", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "TypeScript generator", | ||
@@ -16,16 +16,18 @@ "repository": { | ||
"devDependencies": { | ||
"@krlwlfrt/otpc": "1.0.0", | ||
"@eslint/js": "9.15.0", | ||
"@krlwlfrt/otpc": "2.0.0", | ||
"@testdeck/mocha": "0.3.3", | ||
"@types/mocha": "10.0.1", | ||
"@types/node": "^18", | ||
"@typescript-eslint/eslint-plugin": "5.59.2", | ||
"@typescript-eslint/parser": "5.59.2", | ||
"conventional-changelog-cli": "2.2.2", | ||
"eslint": "8.40.0", | ||
"mocha": "10.2.0", | ||
"nyc": "15.1.0", | ||
"rimraf": "5.0.0", | ||
"ts-node": "10.9.1", | ||
"typedoc": "0.24.7", | ||
"typescript": "5.0.4" | ||
"@types/eslint__js": "8.42.3", | ||
"@types/mocha": "10.0.10", | ||
"@types/node": "22.9.3", | ||
"conventional-changelog-cli": "5.0.0", | ||
"eslint": "9.15.0", | ||
"eslint-plugin-jsdoc": "50.5.0", | ||
"mocha": "10.8.2", | ||
"nyc": "17.1.0", | ||
"rimraf": "6.0.1", | ||
"ts-node": "10.9.2", | ||
"typedoc": "0.26.11", | ||
"typescript": "5.6.3", | ||
"typescript-eslint": "8.15.0" | ||
}, | ||
@@ -37,3 +39,3 @@ "scripts": { | ||
"documentation": "typedoc --out docs --readme README.md src/index.ts", | ||
"lint": "eslint src --ext .ts", | ||
"lint": "eslint src", | ||
"prepublishOnly": "npm ci && npm run build && npm test", | ||
@@ -40,0 +42,0 @@ "push": "git push && git push origin \"v$npm_package_version\"", |
@@ -15,8 +15,8 @@ /* | ||
*/ | ||
import {isAttribute, Property, ThingWithNameAndNamespace} from './index'; | ||
import { isAttribute, Property, ThingWithNameAndNamespace } from './index'; | ||
/** | ||
* Generate name for a thing | ||
* | ||
* @param thing Thing to generate name for | ||
* @returns Name for thing | ||
*/ | ||
@@ -37,4 +37,4 @@ export function generateName(thing: ThingWithNameAndNamespace): string { | ||
* Example implementation to generate property types | ||
* | ||
* @param property Property to generate type for | ||
* @returns Name for property | ||
*/ | ||
@@ -41,0 +41,0 @@ export function generatePropertyType(property: Property): string { |
@@ -103,3 +103,3 @@ /* | ||
*/ | ||
unitedTypes: Array<(Type | string | number | boolean)>; | ||
unitedTypes: (Type | string | number | boolean)[]; | ||
} | ||
@@ -114,3 +114,3 @@ | ||
*/ | ||
items: Array<{ | ||
items: { | ||
/** | ||
@@ -124,3 +124,3 @@ * Key of the item | ||
value: string | number | boolean; | ||
}>; | ||
}[]; | ||
} | ||
@@ -130,4 +130,4 @@ | ||
* Check if a Type is an Entity | ||
* | ||
* @param type Type to check | ||
* @returns True, if Type is an Entity | ||
*/ | ||
@@ -144,4 +144,4 @@ export function isEntity(type: Type): type is Entity { | ||
* Check if a Type is a Union | ||
* | ||
* @param type Type to check | ||
* @returns True, if Type is Union | ||
*/ | ||
@@ -158,4 +158,4 @@ export function isUnion(type: Type): type is Union { | ||
* Check if a Type is an Enum | ||
* | ||
* @param type Type to check | ||
* @returns True, if Type is an Enum | ||
*/ | ||
@@ -172,4 +172,4 @@ export function isEnum(type: Type): type is Enum { | ||
* Check if a ThingWithNameAndNamespace is an Attribute | ||
* | ||
* @param thing Thing to check | ||
* @returns True, if ThingWithNameAndNamespace is an Attribute | ||
*/ | ||
@@ -186,5 +186,5 @@ export function isAttribute(thing: ThingWithNameAndNamespace): thing is Attribute { | ||
* Check for duplicate names | ||
* | ||
* @param types List of types to check | ||
* @param checkNamespace Whether or not to check the namespace additionally to the name | ||
* @returns True, if duplicate names are found | ||
*/ | ||
@@ -205,3 +205,2 @@ export function checkDuplicateNames(types: Type[], checkNamespace = false): boolean { | ||
if (!checkNamespace || types[i].namespace === types[j].namespace) { | ||
// tslint:disable-next-line:no-console | ||
console.info(`Found duplicate name '${types[i].name}' for pair [${i}, ${j}].`); | ||
@@ -220,2 +219,3 @@ duplicateFound = true; | ||
* @param name Name to quote | ||
* @returns Quoted property name, if necessary | ||
*/ | ||
@@ -232,6 +232,6 @@ function quotePropertyName(name: string): string { | ||
* Compile types to TypeScript code | ||
* | ||
* @param types List of types to compile | ||
* @param nameGenerator Function to generate the name of a thing | ||
* @param propertyTypeGenerator Function to generate the type of a property | ||
* @returns Generated TypeScript | ||
*/ | ||
@@ -243,3 +243,2 @@ export function generateTypeScript(types: Type[], | ||
if (checkDuplicateNames(types)) { | ||
// tslint:disable-next-line:no-console | ||
console.info('CAUTION: Duplicate names found!'); | ||
@@ -246,0 +245,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29319
16
565