Skip to content
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

feat(effects): add mapToAction operator #1822

Merged
merged 13 commits into from
May 15, 2019
Merged

feat(effects): add mapToAction operator #1822

merged 13 commits into from
May 15, 2019

Conversation

alex-okrushko
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

Introduces mapToAction operator that can take either the config object, or 2 parameters: project and error.

config has the following interface:

/** Represents config with named paratemeters for mapToAction */
export interface MapToActionConfig<
  InputAction extends Action,
  OutputAction extends Action,
  ErrorAction extends Action,
  CompleteAction extends Action,
  UnsubscribeAction extends Action
> {
  // Project function that produces the output actions in success cases
  project: (action: InputAction, index: number) => Observable<OutputAction>;
  // Error handle function for project
  error: (error: any, action: InputAction) => ErrorAction;
  // Optional complete action provider
  // count is the number of actions project emitted before completion
  // action is the action that was completed
  complete?: (count: number, action: InputAction) => CompleteAction;
  // Optional flattening operator
  operator?: <InputAction, OutputAction>(
    project: (input: InputAction, index: number) => Observable<OutputAction>
  ) => OperatorFunction<InputAction, OutputAction>;
  // Optional unsubscribe action provider
  // count is the number of actions project emitted before unsubscribing
  // action is the action that was unsubscribed from
  unsubscribe?: (count: number, action: InputAction) => UnsubscribeAction;
}
[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes # #1224

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@ngrxbot
Copy link
Collaborator

ngrxbot commented May 5, 2019

Preview docs changes for 29e89c6 at https://previews.ngrx.io/pr1822-29e89c6/

@alex-okrushko
Copy link
Member Author

Waiting for #1795 to be merged, so I can adjust the path of NotificationKind - removing it from internal.

@ngrxbot
Copy link
Collaborator

ngrxbot commented May 6, 2019

Preview docs changes for 388ca02 at https://previews.ngrx.io/pr1822-388ca02/

@ngrxbot
Copy link
Collaborator

ngrxbot commented May 7, 2019

Preview docs changes for 96654cf at https://previews.ngrx.io/pr1822-96654cf/

@alex-okrushko alex-okrushko self-assigned this May 7, 2019
@ThomasBurleson
Copy link
Contributor

@alex-okrushko - should this include a README or docs on (a) Benefits and (b) How to use it ?

modules/effects/src/map_to_action.ts Outdated Show resolved Hide resolved
modules/effects/src/map_to_action.ts Outdated Show resolved Hide resolved
modules/effects/src/map_to_action.ts Outdated Show resolved Hide resolved
modules/effects/src/map_to_action.ts Outdated Show resolved Hide resolved
modules/effects/src/map_to_action.ts Outdated Show resolved Hide resolved
modules/effects/src/map_to_action.ts Outdated Show resolved Hide resolved
modules/effects/src/map_to_action.ts Outdated Show resolved Hide resolved
modules/effects/src/map_to_action.ts Outdated Show resolved Hide resolved
modules/effects/src/map_to_action.ts Outdated Show resolved Hide resolved
@ngrxbot
Copy link
Collaborator

ngrxbot commented May 9, 2019

Preview docs changes for 946f828 at https://previews.ngrx.io/pr1822-946f828/

@alex-okrushko
Copy link
Member Author

FYI, I'm adding docs for this PR ATM.

@ngrxbot
Copy link
Collaborator

ngrxbot commented May 13, 2019

Preview docs changes for 43cba13 at https://previews.ngrx.io/pr1822-43cba13/

Copy link
Member

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

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

Feedback on the docs

projects/ngrx.io/content/guide/effects/index.md Outdated Show resolved Hide resolved
projects/ngrx.io/content/guide/effects/index.md Outdated Show resolved Hide resolved
projects/ngrx.io/content/guide/effects/index.md Outdated Show resolved Hide resolved
projects/ngrx.io/content/guide/effects/operators.md Outdated Show resolved Hide resolved
projects/ngrx.io/content/guide/effects/operators.md Outdated Show resolved Hide resolved
projects/ngrx.io/content/guide/effects/operators.md Outdated Show resolved Hide resolved
projects/ngrx.io/content/guide/effects/operators.md Outdated Show resolved Hide resolved
projects/ngrx.io/content/guide/effects/operators.md Outdated Show resolved Hide resolved
projects/ngrx.io/content/guide/effects/operators.md Outdated Show resolved Hide resolved
@ngrxbot
Copy link
Collaborator

ngrxbot commented May 14, 2019

Preview docs changes for 2629f1a at https://previews.ngrx.io/pr1822-2629f1a/

@ngrxbot
Copy link
Collaborator

ngrxbot commented May 14, 2019

Preview docs changes for bfce944 at https://previews.ngrx.io/pr1822-bfce944/

@ngrxbot
Copy link
Collaborator

ngrxbot commented May 14, 2019

Preview docs changes for 090e6c9 at https://previews.ngrx.io/pr1822-090e6c9/

@ngrxbot
Copy link
Collaborator

ngrxbot commented May 14, 2019

Preview docs changes for bfce944 at https://previews.ngrx.io/pr1822-bfce944/

@ngrxbot
Copy link
Collaborator

ngrxbot commented May 14, 2019

Preview docs changes for 090e6c9 at https://previews.ngrx.io/pr1822-090e6c9/

@ngrxbot
Copy link
Collaborator

ngrxbot commented May 14, 2019

Preview docs changes for c5e6f99 at https://previews.ngrx.io/pr1822-c5e6f99/

1 similar comment
@ngrxbot
Copy link
Collaborator

ngrxbot commented May 14, 2019

Preview docs changes for c5e6f99 at https://previews.ngrx.io/pr1822-c5e6f99/

@ngrxbot
Copy link
Collaborator

ngrxbot commented May 14, 2019

Preview docs changes for f248946 at https://previews.ngrx.io/pr1822-f248946/

@ngrxbot
Copy link
Collaborator

ngrxbot commented May 15, 2019

Preview docs changes for 2369f9e at https://previews.ngrx.io/pr1822-2369f9e/

Copy link
Member

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

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

👍

@brandonroberts brandonroberts merged commit 1ff986f into ngrx:master May 15, 2019
@alex-okrushko alex-okrushko deleted the map-to-action branch October 30, 2019 03:02
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