UNPKG

vendure-import-products-plugin

Version:

- This plugin imports the products from the specified url every specified day.

37 lines (36 loc) 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSuperadminContext = void 0; const core_1 = require("@vendure/core"); /** * @description * Creates a {@link RequestContext} configured for the default Channel with the activeUser set * as the superadmin user. Useful for populating data. * * @docsCategory testing */ async function getSuperadminContext(defaultChannel, connection, configService) { const { superadminCredentials } = configService.authOptions; const superAdminUser = await connection .getRepository(core_1.User) .findOneOrFail({ where: { identifier: superadminCredentials.identifier } }); return new core_1.RequestContext({ channel: defaultChannel, apiType: 'admin', isAuthorized: true, authorizedAsOwnerOnly: false, session: { id: '', token: '', expires: new Date(), cacheExpiry: 999999, user: { id: superAdminUser.id, identifier: superAdminUser.identifier, verified: true, channelPermissions: [], }, }, }); } exports.getSuperadminContext = getSuperadminContext;