Skip to content

Add numberSelector utility #1126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 28, 2023
Merged

Conversation

trivikr
Copy link
Contributor

@trivikr trivikr commented Dec 27, 2023

Issue #, if available:

  • Currently used in NODE_MAX_ATTEMPT_CONFIG_OPTIONS
    export const NODE_MAX_ATTEMPT_CONFIG_OPTIONS: LoadedConfigSelectors<number> = {
    environmentVariableSelector: (env) => {
    const value = env[ENV_MAX_ATTEMPTS];
    if (!value) return undefined;
    const maxAttempt = parseInt(value);
    if (Number.isNaN(maxAttempt)) {
    throw new Error(`Environment variable ${ENV_MAX_ATTEMPTS} mast be a number, got "${value}"`);
    }
    return maxAttempt;
    },
    configFileSelector: (profile) => {
    const value = profile[CONFIG_MAX_ATTEMPTS];
    if (!value) return undefined;
    const maxAttempt = parseInt(value);
    if (Number.isNaN(maxAttempt)) {
    throw new Error(`Shared config file entry ${CONFIG_MAX_ATTEMPTS} mast be a number, got "${value}"`);
    }
    return maxAttempt;
    },
    default: DEFAULT_MAX_ATTEMPTS,
    };
  • Required in feat(middleware-compression): add middleware for request compression aws/aws-sdk-js-v3#5618

Description of changes:

Add numberSelector utility in util-config-selector


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@trivikr trivikr marked this pull request as ready for review December 27, 2023 21:34
@trivikr trivikr requested review from a team as code owners December 27, 2023 21:34
@trivikr trivikr requested a review from milesziemer December 27, 2023 21:34
@trivikr trivikr merged commit dd2b9c7 into smithy-lang:main Dec 28, 2023
@trivikr trivikr deleted the util-number-selector branch December 28, 2023 20:36
kuhe pushed a commit to kuhe/smithy-typescript that referenced this pull request Jan 3, 2024
kuhe pushed a commit to kuhe/smithy-typescript that referenced this pull request Jan 4, 2024
kuhe pushed a commit to kuhe/smithy-typescript that referenced this pull request Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants