@azure-tools/codegen
Advanced tools
Comparing version 2.1.223 to 2.1.227
@@ -16,2 +16,3 @@ export declare type Primitive = string | number | boolean | bigint | symbol | undefined | null; | ||
protected apply<T>(...initializer: Array<DeepPartial<T> | undefined>): void; | ||
protected applyWithExclusions<T>(exclusions: Array<string>, ...initializer: Array<DeepPartial<T> | undefined>): void; | ||
protected applyTo<T>($this: T, ...initializer: Array<DeepPartial<T> | undefined>): void; | ||
@@ -18,0 +19,0 @@ } |
@@ -8,3 +8,4 @@ "use strict"; | ||
const linq_1 = require("@azure-tools/linq"); | ||
function applyTo(source, target, cache = new Set()) { | ||
const empty = new Set(); | ||
function applyTo(source, target, exclusions, cache = new Set()) { | ||
if (cache.has(source)) { | ||
@@ -14,2 +15,5 @@ throw new Error('Circular refrenced models are not permitted in apply() initializers.'); | ||
for (const i of linq_1.keys(source)) { | ||
if (exclusions.has(i)) { | ||
continue; | ||
} | ||
switch (typeof source[i]) { | ||
@@ -20,3 +24,9 @@ case 'object': | ||
cache.add(source); | ||
applyTo(source[i], target[i], cache); | ||
try { | ||
applyTo(source[i], target[i], exclusions, cache); | ||
} | ||
catch (E) { | ||
console.error(` in property: ${i} `); | ||
throw E; | ||
} | ||
cache.delete(source); | ||
@@ -59,8 +69,14 @@ continue; | ||
for (const each of initializer) { | ||
applyTo(each, this); | ||
applyTo(each, this, empty); | ||
} | ||
} | ||
applyWithExclusions(exclusions, ...initializer) { | ||
const filter = new Set(exclusions); | ||
for (const each of initializer) { | ||
applyTo(each, this, filter); | ||
} | ||
} | ||
applyTo($this, ...initializer) { | ||
for (const each of initializer) { | ||
applyTo(each, $this); | ||
applyTo(each, $this, empty); | ||
} | ||
@@ -67,0 +83,0 @@ } |
{ | ||
"name": "@azure-tools/codegen", | ||
"version": "2.1.223", | ||
"version": "2.1.227", | ||
"patchOffset": 100, | ||
@@ -51,4 +51,4 @@ "description": "Autorest Code generator common and base classes", | ||
"dependencies": { | ||
"@azure-tools/async-io": "~3.0.207", | ||
"@azure-tools/linq": "~3.1.213", | ||
"@azure-tools/async-io": "~3.0.209", | ||
"@azure-tools/linq": "~3.1.215", | ||
"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
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
191537
2437
Updated@azure-tools/linq@~3.1.215