@smithy/core
Advanced tools
@@ -243,2 +243,5 @@ 'use strict'; | ||
| const anno = { | ||
| it: Symbol.for("@smithy/nor-struct-it"), | ||
| }; | ||
| class NormalizedSchema { | ||
@@ -399,6 +402,3 @@ ref; | ||
| isIdempotencyToken() { | ||
| const match = (traits) => (traits & 0b0100) === 0b0100 || | ||
| !!traits?.idempotencyToken; | ||
| const { normalizedTraits, traits, memberTraits } = this; | ||
| return match(normalizedTraits) || match(traits) || match(memberTraits); | ||
| return !!this.getMergedTraits().idempotencyToken; | ||
| } | ||
@@ -484,5 +484,15 @@ getMergedTraits() { | ||
| const struct = this.getSchema(); | ||
| for (let i = 0; i < struct[4].length; ++i) { | ||
| yield [struct[4][i], member([struct[5][i], 0], struct[4][i])]; | ||
| const z = struct[4].length; | ||
| let it = struct[anno.it]; | ||
| if (it && z === it.length) { | ||
| yield* it; | ||
| return; | ||
| } | ||
| it = Array(z); | ||
| for (let i = 0; i < z; ++i) { | ||
| const k = struct[4][i]; | ||
| const v = member([struct[5][i], 0], k); | ||
| yield (it[i] = [k, v]); | ||
| } | ||
| struct[anno.it] = it; | ||
| } | ||
@@ -489,0 +499,0 @@ } |
| import { deref } from "../deref"; | ||
| import { translateTraits } from "./translateTraits"; | ||
| const anno = { | ||
| it: Symbol.for("@smithy/nor-struct-it"), | ||
| }; | ||
| export class NormalizedSchema { | ||
@@ -158,6 +161,3 @@ ref; | ||
| isIdempotencyToken() { | ||
| const match = (traits) => (traits & 0b0100) === 0b0100 || | ||
| !!traits?.idempotencyToken; | ||
| const { normalizedTraits, traits, memberTraits } = this; | ||
| return match(normalizedTraits) || match(traits) || match(memberTraits); | ||
| return !!this.getMergedTraits().idempotencyToken; | ||
| } | ||
@@ -243,5 +243,15 @@ getMergedTraits() { | ||
| const struct = this.getSchema(); | ||
| for (let i = 0; i < struct[4].length; ++i) { | ||
| yield [struct[4][i], member([struct[5][i], 0], struct[4][i])]; | ||
| const z = struct[4].length; | ||
| let it = struct[anno.it]; | ||
| if (it && z === it.length) { | ||
| yield* it; | ||
| return; | ||
| } | ||
| it = Array(z); | ||
| for (let i = 0; i < z; ++i) { | ||
| const k = struct[4][i]; | ||
| const v = member([struct[5][i], 0], k); | ||
| yield (it[i] = [k, v]); | ||
| } | ||
| struct[anno.it] = it; | ||
| } | ||
@@ -248,0 +258,0 @@ } |
@@ -66,3 +66,2 @@ import type { $MemberSchema, $Schema, $SchemaRef, NormalizedSchema as INormalizedSchema, SchemaRef, SchemaTraitsObject, StaticSchema } from "@smithy/types"; | ||
| /** | ||
| * This is a shortcut to avoid calling `getMergedTraits().idempotencyToken` on every string. | ||
| * @returns whether the schema has the idempotencyToken trait. | ||
@@ -69,0 +68,0 @@ */ |
@@ -66,3 +66,2 @@ import { $MemberSchema, $Schema, $SchemaRef, NormalizedSchema as INormalizedSchema, SchemaRef, SchemaTraitsObject, StaticSchema } from "@smithy/types"; | ||
| /** | ||
| * This is a shortcut to avoid calling `getMergedTraits().idempotencyToken` on every string. | ||
| * @returns whether the schema has the idempotencyToken trait. | ||
@@ -69,0 +68,0 @@ */ |
+1
-1
| { | ||
| "name": "@smithy/core", | ||
| "version": "3.20.8", | ||
| "version": "3.21.0", | ||
| "scripts": { | ||
@@ -5,0 +5,0 @@ "build": "yarn lint && concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'", |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
451259
0.01%11244
0.16%