Skip to content

Conversation

@yavorona
Copy link
Contributor

@yavorona yavorona commented Sep 15, 2020

Summary

Create index.d.ts file for decision_service module

@yavorona yavorona requested a review from a team as a code owner September 15, 2020 19:07
@yavorona yavorona self-assigned this Sep 15, 2020
@@ -0,0 +1,151 @@
/**
* Copyright 2018-2020, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just be 2020

}

export interface ConfigObj {
__datafileStr: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't document private properties

featureKeyMap: {[key: string]: FeatureFlag}; //look into this one closer
}

interface Event {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of these entities are being defined in #567 already. We should reuse them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, for all the entity types that are related to or located in project config.

@coveralls
Copy link

coveralls commented Sep 15, 2020

Coverage Status

Coverage remained the same at 96.638% when pulling 3dcda32 on pnguen/decision_service_index.d.ts into eaf61d0 on master.

@yavorona yavorona removed their assignment Sep 16, 2020
Copy link
Contributor

@mjc1283 mjc1283 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes to locate type definitions in the appropriate module and import them into the consumers.

UNSTABLE_conditionEvaluators: unknown;
}

interface ConfigObj {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be imported from the project config module (see PR #567)


export function createDecisionService(options: Options): DecisionService;

export interface UserProfileService {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are UserProfileService and/or UserProfile needed in any other modules? There might be a more natural place for these to live.

Copy link
Contributor Author

@yavorona yavorona Sep 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved them back per your comment on UserProfileService. Although, now we are importing them from a root-level module to here, which is an anti-pattern. What are your thoughts @mjc1283?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are importing them from a root-level module to here, which is an anti-pattern.

Agreed. Let's keep them in decision service like you originally had, and consider moving them later on if it makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. UserAttributes would also need to be moved here for now to avoid anti-pattern.

featureKeyMap: {[key: string]: FeatureFlag}; //look into this one closer
}

interface Event {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, for all the entity types that are related to or located in project config.

value: string | number | boolean | null;
}

type ConditionTree<Leaf> = Leaf | unknown[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be imported from condition_tree_evaluator

Copy link
Contributor

@mjc1283 mjc1283 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but this depends on #567. If you want to merge it first, let's put more of a stub or skeleton in project_config/index.d.ts which can be filled in later by #567


export function createDecisionService(options: Options): DecisionService;

export interface UserProfileService {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are importing them from a root-level module to here, which is an anti-pattern.

Agreed. Let's keep them in decision service like you originally had, and consider moving them later on if it makes sense.

}>
}

type ConditionTree<Leaf> = Leaf | unknown[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import from condition_tree_evaluator

Copy link
Contributor

@mjc1283 mjc1283 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still waiting for update after #567 is complete

@yavorona yavorona force-pushed the pnguen/decision_service_index.d.ts branch from 21d7df7 to 2b495c5 Compare September 23, 2020 20:40
@yavorona yavorona removed their assignment Sep 23, 2020
interface Decision {
experiment: import('../../shared_types').Experiment | null;
variation: import('../../shared_types').Variation | null;
decisionSource: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to use an enum for this. Can be updated later if so.

@yavorona yavorona merged commit 7fdb06a into master Sep 23, 2020
@yavorona yavorona deleted the pnguen/decision_service_index.d.ts branch September 23, 2020 22:51
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.

6 participants