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

[#IP-339] Migrate fp-ts version from 1.x to 2.x #87

Closed
wants to merge 35 commits into from

Conversation

fabriziopapi
Copy link
Contributor

Update fp-ts version from 1.x to 2.x

List of Changes

Update fp-ts, io-ts, ts-commons and openapigen versions.
Fixed compilation errors due to different fp-ts 2.x version mode.
Fixed unit test compilation errors.
Refactor of saml.ts functions.

Motivation and Context

Reduce technical debt and enable dev to use new fp-ts feature.

How Has This Been Tested?

Already existing unit tests.

Types of changes

  • Chore (nothing changes by a user perspective)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@fabriziopapi fabriziopapi changed the title Ip 339 migrate fp ts [#IP-339] Migrate fp-ts version from 1.x to 2.x Aug 11, 2021
Copy link
Contributor

@balanza balanza left a comment

Choose a reason for hiding this comment

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

fp-ts-related changes look good to me. I advocate we move unrelated changes into dedicated PRs for better discussion and review.

package.json Show resolved Hide resolved
src/strategy/saml_client.ts Show resolved Hide resolved
@BurnedMarshal
Copy link
Contributor

@balanza @fabriziopapi Seems that some changes in this PR are already included into the master branch. Maybe a merge/rebase github issue. For example the update of passport-saml already happen in here https://github.com/pagopa/io-spid-commons/pull/60/files

@fabriziopapi
Copy link
Contributor Author

I already rebased the branch: this is why passport-saml related code is in the branch. Unluckily, I had to manual resolve conflict and commit the resolutions.

@balanza
Copy link
Contributor

balanza commented Sep 9, 2021

I already rebased the branch: this is why passport-saml related code is in the branch. Unluckily, I had to manual resolve conflict and commit the resolutions.

@fabriziopapi You're right, such changes are from #60. Fun fact: I've approved them 😅.

that's weird: why is it considered a change?

src/bin/startup-idps-metadata.ts Show resolved Hide resolved
src/bin/startup-idps-metadata.ts Show resolved Hide resolved
src/bin/startup-idps-metadata.ts Show resolved Hide resolved
src/bin/startup-idps-metadata.ts Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
@fabriziopapi
Copy link
Contributor Author

Replaced by PR #91

Copy link
Contributor

@BurnedMarshal BurnedMarshal left a comment

Choose a reason for hiding this comment

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

Sorry I've these pending comments. I'll move all the newer comments on the PR #91

Comment on lines +71 to +78
TE.fromEither(
E.fromOption(
() =>
new Error(
`SAML#ExtendedRedisCacheProvider: missing AuthnRequest ID`
)
)(getIDFromRequest(RequestXML))
),
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use the more compact TE.fromOption

Suggested change
TE.fromEither(
E.fromOption(
() =>
new Error(
`SAML#ExtendedRedisCacheProvider: missing AuthnRequest ID`
)
)(getIDFromRequest(RequestXML))
),
TE.fromOption(
() =>
new Error(
`SAML#ExtendedRedisCacheProvider: missing AuthnRequest ID`
)
)(getIDFromRequest(RequestXML)),

TE.chain(value =>
TE.fromEither(
pipe(
E.parseJSON(value, E.toError),
Copy link
Contributor

Choose a reason for hiding this comment

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

use parse from fp-ts/lib/Json instead, E.parseJson is deprecated

Suggested change
E.parseJSON(value, E.toError),
parse(value),
E.mapLeft(E.toError),

Comment on lines 2 to +3
import { TaskEither } from "fp-ts/lib/TaskEither";
import * as TE from "fp-ts/lib/TaskEither";
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicated import, use TE.TaskEither

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.

5 participants