Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
const listsResponse = await mailchimp.get({
path: `/lists/`
});
const output = listsResponse.body.lists.map(item => ({
id: item.id,
name: item.name
}));
return new ListResponse(output);
} catch (e) {
return new ListErrorResponse(e);
}
},
getSettings: resolveGetSettings(({ models }) => models.MailchimpSettings)
},
MailchimpMutation: {
addToList: async (_: any, { list: listId, email }: Object, context: Object) => {
const { MailchimpSettings } = context.models;
const settings = await MailchimpSettings.load();
if (!get(settings, "data.apiKey")) {
throw Error("Mailchimp API key not set.");
}
const mailchimp = new MailchimpApi({ apiKey: settings.data.apiKey });
try {
const listResponse = await mailchimp.get({
path: `/lists/${listId}`
});
input FormsSettingsInput {
reCaptcha: ReCaptchaSettingsInput
}
extend type FormsQuery {
getSettings: FormsSettingsResponse
}
extend type FormsMutation {
updateSettings(data: FormsSettingsInput): FormsSettingsResponse
}
`,
resolvers: {
FormsQuery: {
getSettings: resolveGetSettings(getFormSettings)
},
FormsMutation: {
updateSettings: resolveUpdateSettings(getFormSettings)
}
}
};
home: ID
notFound: ID
error: ID
}
extend type PbQuery {
getSettings: PbSettingsResponse
}
extend type PbMutation {
updateSettings(data: PbSettingsInput): PbSettingsResponse
}
`,
resolvers: {
PbQuery: {
getSettings: resolveGetSettings(ctx => ctx.models.PbSettings)
},
PbMutation: {
updateSettings: resolveUpdateSettings(ctx => ctx.models.PbSettings)
},
PbSocialMedia: {
image({ image }) {
return image ? { __typename: "File", id: image } : null;
}
},
PbSettings: {
favicon({ favicon }) {
return favicon ? { __typename: "File", id: favicon } : null;
},
logo({ logo }) {
return logo ? { __typename: "File", id: logo } : null;
}
cookiePolicy: CookiePolicyQuery
}
extend type Mutation {
cookiePolicy: CookiePolicyMutation
}
`,
resolvers: {
Query: {
cookiePolicy: emptyResolver
},
Mutation: {
cookiePolicy: emptyResolver
},
CookiePolicyQuery: {
getSettings: resolveGetSettings(({ models }) => models.CookiePolicySettings)
},
CookiePolicyMutation: {
updateSettings: resolveUpdateSettings(
({ models }) => models.CookiePolicySettings
)
}
}
},
security: {
shield: {
CookiePolicyMutation: {
updateSettings: hasScope("pb:settings")
}
}
}
},
googleTagManager: GtmQuery
}
extend type Mutation {
googleTagManager: GtmMutation
}
`,
resolvers: {
Query: {
googleTagManager: emptyResolver
},
Mutation: {
googleTagManager: emptyResolver
},
GtmQuery: {
getSettings: resolveGetSettings(({ models }) => models.GoogleTagManagerSettings)
},
GtmMutation: {
updateSettings: resolveUpdateSettings(
({ models }) => models.GoogleTagManagerSettings
)
}
}
},
security: {
shield: {
GtmMutation: {
updateSettings: hasScope("pb:settings")
}
}
}
},