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

[AB#40827] Update Media Template to use mosaic-grpahql-common and service-common after split #136

Merged
merged 9 commits into from Aug 24, 2023

Conversation

AxTrusov
Copy link
Member

@AxTrusov AxTrusov commented Aug 24, 2023

Pull Request

Prerequisites

  • My code follows the coding conventions
  • All tests pass

Description

  • Update media-template to use the new mosaic-graphql-common library and service-common libraries.
  • Update unit tests.

For release notes:
A new library @axinom/mosaic-graphql-common is introduced. This library contains all common utility functions related to GraphQL and Postgraphile plugins. These functions and plugins were previously inside @axinom/mosaic-service-common.

Classes and methods:
PostgraphileOptionsBuilder
enhanceGraphqlErrors (previously graphqlErrorsHandler in @axinom/mosaic-service-common)
getWebsocketFromRequest

Postgraphile Plugins:
AddErrorCodesEnumPluginFactory
AnnotateTypesWithPermissionsPlugin
DeprecateStrayNodeIdFieldsPlugin
GenericBulkPluginFactory
GraphiqlManagementModePluginHook
OmitFromQueryRootPlugin
OperationsEnumGeneratorPluginFactory
SubscriptionsPluginFactory
ValidationDirectivesPlugin

Apart from refactoring the imports to point to @axinom/mosaic-graphql-common, the following change is required to make the services compatible with this change.

In buildPostgraphileOptions, change

.setErrorsHandler((errors) => {
      return graphqlErrorsHandler(
        errors,
        customPgErrorMapper,
        defaultWriteLogMapper,
      );
    })

to

.setErrorsHandler((errors, req) => {
      return enhanceGraphqlErrors(
        errors,
        req.body.operationName,
        customizeGraphQlErrorFields(defaultPgErrorMapper), // use the correct PG Error Mapper
        logGraphQlError(defaultWriteLogMapper), // use the correct Write Log Mapper
      );
    })

Testing notes

Smoke tests should be enough.

@AxTrusov AxTrusov changed the title Update Media Template to use mosaic-grpahql-common and service-common after split [AB#40827] Update Media Template to use mosaic-grpahql-common and service-common after split Aug 24, 2023
@EmperorRXF
Copy link
Member

do we have any documentation to support this change? For example I would wish to write about this change in our release-notes, and would be great if we have some documentation to already point to?

if not, then can you pls provide a high-level description of the change to be used in release-notes?

@AxTrusov AxTrusov merged commit 89c3253 into dev Aug 24, 2023
5 checks passed
yohanAnushka pushed a commit that referenced this pull request Sep 11, 2023
…vice-common after split (#136)

* refactor: Use graphql-common in media-service

* refactor:  Use graphql-common in catalog service

* refactor: Use graphql-common in entitlement service

* refactor: Use service common after split

* refactor: Modify TestContext in Catalog Service

* refactor: Modify Test Context in media service, fix unit tests

* chore: Update package versions in vod2live service

* refactor: Fix unit tests and related code changes in entitlement service

* chore: revert entitlement service changes to work with fixed graphql lib
[AB#40827]

---------

Co-authored-by: Yasith Ariyasena <yasith.ariyasena@gmail.com>
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.

None yet

3 participants