private async fetchFlag()

in packages/openfeature-server-provider/src/ConfidenceServerProvider.ts [33:50]


  private async fetchFlag<T extends Value>(
    flagKey: string,
    defaultValue: T,
    context: EvaluationContext,
  ): Promise<ResolutionDetails<T>> {
    const evaluation = (await this.confidence
      .withContext(convertContext(context))
      .evaluateFlag(flagKey, defaultValue)) as FlagEvaluation.Resolved<T>;

    if (evaluation.reason === 'ERROR') {
      const { errorCode, ...rest } = evaluation;
      return {
        ...rest,
        errorCode: this.mapErrorCode(errorCode),
      };
    }
    return evaluation;
  }