@shopify/shopify-app-remix
Version:
Shopify Remix - to simplify the building of Shopify Apps with Remix
22 lines (19 loc) • 801 B
JavaScript
import { ensureValidOfflineSession } from '../../helpers/ensure-valid-offline-session.mjs';
import '../../types.mjs';
import '@shopify/shopify-api';
import { SessionNotFoundError } from '../../errors.mjs';
import { adminClientFactory } from '../../clients/admin/factory.mjs';
function unauthenticatedAdminContextFactory(params) {
return async (shop) => {
const session = await ensureValidOfflineSession(params, shop);
if (!session) {
throw new SessionNotFoundError(`Could not find a session for shop ${shop} when creating unauthenticated admin context`);
}
return {
session,
admin: adminClientFactory({ params, session }),
};
};
}
export { unauthenticatedAdminContextFactory };
//# sourceMappingURL=factory.mjs.map