Skip to content

Commit

Permalink
feat(hasura): metadata output property ordering
Browse files Browse the repository at this point in the history
align the output format of managed metadata to match what hasura produces

re #219
  • Loading branch information
WonderPanda committed Jan 16, 2021
1 parent 9584104 commit 9e15b1b
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions packages/hasura/src/hasura.metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from './hasura.interfaces';
import { safeLoad, safeDump } from 'js-yaml';
import { readFileSync, writeFileSync } from 'fs';
import { orderBy } from 'lodash';
import {
TableEntry,
EventTriggerDefinition,
Expand Down Expand Up @@ -76,7 +77,7 @@ export const updateEventTriggerMeta = (
const tablesMeta = readFileSync(tablesYamlPath, utf8);
const tableEntries = safeLoad(tablesMeta) as TableEntry[];

eventHandlerConfigs.forEach((config) => {
orderBy(eventHandlerConfigs, (x) => x.triggerName).forEach((config) => {
const {
schema = 'public',
tableName,
Expand All @@ -103,19 +104,19 @@ export const updateEventTriggerMeta = (
...eventTriggers,
{
name: triggerName,
definition: convertEventTriggerDefinition(definition),
retry_conf: {
num_retries: numRetries,
interval_sec: intervalInSeconds,
timeout_sec: timeoutInSeconds,
},
webhook_from_env: managedMetaDataConfig.nestEndpointEnvName,
headers: [
{
name: moduleConfig.webhookConfig.secretHeader,
value_from_env: managedMetaDataConfig.secretHeaderEnvName,
},
],
retry_conf: {
interval_sec: intervalInSeconds,
num_retries: numRetries,
timeout_sec: timeoutInSeconds,
},
definition: convertEventTriggerDefinition(definition),
},
];
});
Expand Down Expand Up @@ -156,23 +157,23 @@ export const updateScheduledEventTriggerMeta = (
}) => {
return {
name,
payload,
comment,
webhook: `{{${managedMetaDataConfig.nestEndpointEnvName}}}`,
schedule: cronSchedule,
include_in_metadata: true,
payload,
retry_conf: {
num_retries: retryConfig.numRetries,
timeout_seconds: retryConfig.timeoutInSeconds,
tolerance_seconds: retryConfig.toleranceSeconds,
retry_interval_seconds: retryConfig.intervalInSeconds,
},
headers: [
{
name: moduleConfig.webhookConfig.secretHeader,
value_from_env: managedMetaDataConfig.secretHeaderEnvName,
},
],
webhook: `{{${managedMetaDataConfig.nestEndpointEnvName}}}`,
retry_conf: {
num_retries: retryConfig.numRetries,
retry_interval_seconds: retryConfig.intervalInSeconds,
timeout_seconds: retryConfig.timeoutInSeconds,
tolerance_seconds: retryConfig.toleranceSeconds,
},
comment,
};
}
);
Expand Down

0 comments on commit 9e15b1b

Please sign in to comment.