Skip to content

Commit

Permalink
Merge pull request #4838 from mnaamani/qn-hotfix-member-external-reso…
Browse files Browse the repository at this point in the history
…urce-update

query-node: hotfix membership metadata handler
  • Loading branch information
mnaamani committed Aug 24, 2023
2 parents dac64ea + e9fcbb3 commit d144823
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions query-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.3.0

- Fix external resources mapping of membership metadata to ignore unrecognized type.

### 1.2.2

- Integrates OpenTelemetry API/SDK with Query Node's Graphql Server for exporting improved tracing logs & metrics to Elasticsearch. Adds `./start-elasticsearch-stack.sh` script to bootstrap elasticsearch services (Elasticsearch + Kibana + APM Server) with all the required configurations.
Expand Down
2 changes: 1 addition & 1 deletion query-node/mappings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "query-node-mappings",
"version": "1.2.1",
"version": "1.3.0",
"description": "Mappings for hydra-processor",
"main": "lib/src/index.js",
"license": "MIT",
Expand Down
14 changes: 8 additions & 6 deletions query-node/mappings/src/membership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import {
getMemberById,
getWorker,
getWorkingGroupByName,
invalidMetadata,
logger,
saveMetaprotocolTransactionErrored,
saveMetaprotocolTransactionSuccessful,
Expand Down Expand Up @@ -126,13 +127,14 @@ function asMembershipExternalResource(
): Pick<MembershipExternalResource, 'type' | 'value'>[] {
const typeKey = isSet(resource.type) && MembershipMetadata.ExternalResource.ResourceType[resource.type]

if (!typeKey || !(typeKey in MembershipExternalResourceType)) {
throw new Error(`Invalid ResourceType: ${typeKey}`)
if (typeKey && typeKey in MembershipExternalResourceType) {
const type = MembershipExternalResourceType[typeKey]
const value = resource.value
return type && value ? [{ type, value }] : []
} else {
invalidMetadata(`Invalid ResourceType: ${resource.type}`)
return []
}

const type = MembershipExternalResourceType[typeKey]
const value = resource.value
return type && value ? [{ type, value }] : []
}

async function saveMembershipMetadata(
Expand Down
2 changes: 1 addition & 1 deletion query-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "query-node-root",
"version": "1.2.2",
"version": "1.3.0",
"description": "GraphQL server and mappings. Generated with ♥ by Hydra-CLI",
"scripts": {
"build": "./build.sh",
Expand Down

0 comments on commit d144823

Please sign in to comment.