Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function decorateProperties<s> (
obj: CachingMaterialsManager<s>,
input: CachingMaterialsManagerDecorateInput<s>
) {
const { cache, backingMaterialsManager, maxAge, maxBytesEncrypted, maxMessagesEncrypted, partition } = input
/* Precondition: A caching material manager needs a cache. */
needs(cache, 'You must provide a cache.')
/* Precondition: A caching material manager needs a way to get material. */
needs(backingMaterialsManager, 'You must provide a backing material source.')
/* Precondition: You *can not* cache something forever. */
needs(maxAge > 0, 'You must configure a maxAge')
/* Precondition: maxBytesEncrypted must be inside bounds. i.e. positive and not more than the maximum. */
needs(!maxBytesEncrypted || (maxBytesEncrypted > 0 && Maximum.BYTES_PER_CACHED_KEY_LIMIT >= maxBytesEncrypted), 'maxBytesEncrypted is outside of bounds.')
/* Precondition: maxMessagesEncrypted must be inside bounds. i.e. positive and not more than the maximum. */
needs(!maxMessagesEncrypted || (maxMessagesEncrypted > 0 && Maximum.MESSAGES_PER_CACHED_KEY_LIMIT >= maxMessagesEncrypted), 'maxMessagesEncrypted is outside of bounds.')
/* Precondition: partition must be a string. */
needs(partition && typeof partition === 'string', 'partition must be a string.')
readOnlyProperty(obj, '_cache', cache)
readOnlyProperty(obj, '_backingMaterialsManager', backingMaterialsManager)
readOnlyProperty(obj, '_maxAge', maxAge)
readOnlyProperty(obj, '_maxBytesEncrypted', maxBytesEncrypted || Maximum.BYTES_PER_CACHED_KEY_LIMIT)
readOnlyProperty(obj, '_maxMessagesEncrypted', maxMessagesEncrypted || Maximum.MESSAGES_PER_CACHED_KEY_LIMIT)
readOnlyProperty(obj, '_partition', partition)
}
</s></s></s>
/* Precondition: A caching material manager needs a way to get material. */
needs(backingMaterialsManager, 'You must provide a backing material source.')
/* Precondition: You *can not* cache something forever. */
needs(maxAge > 0, 'You must configure a maxAge')
/* Precondition: maxBytesEncrypted must be inside bounds. i.e. positive and not more than the maximum. */
needs(!maxBytesEncrypted || (maxBytesEncrypted > 0 && Maximum.BYTES_PER_CACHED_KEY_LIMIT >= maxBytesEncrypted), 'maxBytesEncrypted is outside of bounds.')
/* Precondition: maxMessagesEncrypted must be inside bounds. i.e. positive and not more than the maximum. */
needs(!maxMessagesEncrypted || (maxMessagesEncrypted > 0 && Maximum.MESSAGES_PER_CACHED_KEY_LIMIT >= maxMessagesEncrypted), 'maxMessagesEncrypted is outside of bounds.')
/* Precondition: partition must be a string. */
needs(partition && typeof partition === 'string', 'partition must be a string.')
readOnlyProperty(obj, '_cache', cache)
readOnlyProperty(obj, '_backingMaterialsManager', backingMaterialsManager)
readOnlyProperty(obj, '_maxAge', maxAge)
readOnlyProperty(obj, '_maxBytesEncrypted', maxBytesEncrypted || Maximum.BYTES_PER_CACHED_KEY_LIMIT)
readOnlyProperty(obj, '_maxMessagesEncrypted', maxMessagesEncrypted || Maximum.MESSAGES_PER_CACHED_KEY_LIMIT)
readOnlyProperty(obj, '_partition', partition)
}