@azure-tools/codegen
Advanced tools
Comparing version 2.1.191 to 2.1.196
@@ -1,4 +0,13 @@ | ||
export declare type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>> : T[P] extends ReadonlyArray<infer V> ? ReadonlyArray<DeepPartial<V>> : T[P] extends string | number | boolean | null | undefined ? T[P] : DeepPartial<T[P]>; | ||
}; | ||
export declare type Primitive = string | number | boolean | bigint | symbol | undefined | null; | ||
export declare type XDeepPartial<T> = DeepPartial<T>; | ||
export declare type DeepPartial<T> = T extends Primitive | Function | Date ? T : T extends Map<infer K, infer V> ? DeepPartialMap<K, V> : T extends Set<infer U> ? DeepPartialSet<U> : { | ||
[P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>> : T[P] extends ReadonlyArray<infer V> ? ReadonlyArray<DeepPartial<V>> : T[P] extends Primitive ? T[P] : DeepPartial<T[P]>; | ||
} | T; | ||
export declare type NDeepPartial<T> = T extends Primitive ? T : T extends Function ? T : T extends Date ? T : T extends Map<infer K, infer V> ? DeepPartialMap<K, V> : T extends Set<infer U> ? DeepPartialSet<U> : T extends {} ? { | ||
[P in keyof T]?: T[P] extends string | number | boolean | null | undefined ? T[P] : NDeepPartial<T[P]>; | ||
} : Partial<T>; | ||
interface DeepPartialSet<ItemType> extends Set<NDeepPartial<ItemType>> { | ||
} | ||
interface DeepPartialMap<KeyType, ValueType> extends Map<NDeepPartial<KeyType>, NDeepPartial<ValueType>> { | ||
} | ||
/** inheriting from Initializer adds an apply<T> method to the class, allowing you to accept an object initalizer, and applying it to the class in the constructor. */ | ||
@@ -9,2 +18,3 @@ export declare class Initializer { | ||
} | ||
export {}; | ||
//# sourceMappingURL=initializer.d.ts.map |
@@ -1,3 +0,4 @@ | ||
export declare function deserialize<T>(text: string, filename: string): T; | ||
export declare function serialize<T>(model: T): string; | ||
import { Schema } from 'js-yaml'; | ||
export declare function deserialize<T>(text: string, filename: string, schema?: Schema): T; | ||
export declare function serialize<T>(model: T, schema?: Schema): string; | ||
//# sourceMappingURL=yaml.d.ts.map |
@@ -10,5 +10,9 @@ "use strict"; | ||
'$key', | ||
'primitives', | ||
'objects', | ||
'dictionaries', | ||
'compounds', | ||
'choices', | ||
'name', | ||
'schemas', | ||
'name', | ||
'type', | ||
@@ -67,4 +71,5 @@ 'format', | ||
} | ||
function deserialize(text, filename) { | ||
function deserialize(text, filename, schema = js_yaml_1.DEFAULT_SAFE_SCHEMA) { | ||
return js_yaml_1.safeLoad(text, { | ||
schema, | ||
filename, | ||
@@ -74,13 +79,15 @@ }); | ||
exports.deserialize = deserialize; | ||
function serialize(model) { | ||
function serialize(model, schema = js_yaml_1.DEFAULT_SAFE_SCHEMA) { | ||
return js_yaml_1.dump(model, { | ||
schema: schema, | ||
sortKeys: sortWithPriorty, | ||
schema: js_yaml_1.DEFAULT_SAFE_SCHEMA, | ||
skipInvalid: true, | ||
lineWidth: 240 | ||
}). | ||
replace(/\s*\w*: {}/g, ''). | ||
replace(/\s*\w*: \[\]/g, ''). | ||
replace(/(\s*- \$key:)/g, '\n$1'). | ||
replace(/(\s*)(language:)/g, '\n$1## ----------------------------------------------------------------------$1$2'); | ||
lineWidth: 240, | ||
}) | ||
.replace(/\s*\w*: {}/g, '') | ||
.replace(/\s*\w*: \[\]/g, '') | ||
.replace(/(\s*- \$key:)/g, '\n$1') | ||
.replace(/-\n\s+version/g, '- version'); | ||
// .replace(/(\s*)(language:)/g, '\n$1## ----------------------------------------------------------------------$1$2') | ||
// replace(/([^:]\n)(\s*-)/g, '$1\n$2') | ||
//.replace(/(\s*language:)/g, '\n$1'); | ||
@@ -87,0 +94,0 @@ } |
{ | ||
"name": "@azure-tools/codegen", | ||
"version": "2.1.191", | ||
"version": "2.1.196", | ||
"patchOffset": 100, | ||
@@ -51,4 +51,4 @@ "description": "Autorest Code generator common and base classes", | ||
"dependencies": { | ||
"@azure-tools/async-io": "~3.0.185", | ||
"@azure-tools/linq": "~3.1.187", | ||
"@azure-tools/async-io": "~3.0.187", | ||
"@azure-tools/linq": "~3.1.190", | ||
"js-yaml": "3.13.1", | ||
@@ -55,0 +55,0 @@ "semver": "^5.5.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
180677
2290
Updated@azure-tools/linq@~3.1.190