import { CreateChannelInput, CreateChannelResult, DeletionResponse, UpdateChannelInput, UpdateChannelResult } from '@subit/common/lib/generated-types'; import { ID, Type } from '@subit/common/lib/shared-types'; import { RequestContext } from '../../api/common/request-context'; import { ErrorResultUnion } from '../../common/error/error-result'; import { ChannelAware } from '../../common/types/common-types'; import { ConfigService } from '../../config/config.service'; import { VendureEntity } from '../../entity/base/base.entity'; import { Channel } from '../../entity/channel/channel.entity'; import { CustomFieldRelationService } from '../helpers/custom-field-relation/custom-field-relation.service'; import { TransactionalConnection } from '../transaction/transactional-connection'; import { GlobalSettingsService } from './global-settings.service'; export declare class ChannelService { private connection; private configService; private globalSettingsService; private customFieldRelationService; private allChannels; constructor(connection: TransactionalConnection, configService: ConfigService, globalSettingsService: GlobalSettingsService, customFieldRelationService: CustomFieldRelationService); /** * When the app is bootstrapped, ensure a default Channel exists and populate the * channel lookup array. */ initChannels(): Promise; /** * Assigns a ChannelAware entity to the default Channel as well as any channel * specified in the RequestContext. */ assignToCurrentChannel(entity: T, ctx: RequestContext): T; /** * Assigns the entity to the given Channels and saves. */ assignToChannels(ctx: RequestContext, entityType: Type, entityId: ID, channelIds: ID[]): Promise; /** * Removes the entity from the given Channels and saves. */ removeFromChannels(ctx: RequestContext, entityType: Type, entityId: ID, channelIds: ID[]): Promise; /** * Given a channel token, returns the corresponding Channel if it exists. */ getChannelFromToken(token: string): Channel; /** * Returns the default Channel. */ getDefaultChannel(): Channel; findAll(ctx: RequestContext): Promise; findOne(ctx: RequestContext, id: ID): Promise; create(ctx: RequestContext, input: CreateChannelInput): Promise>; update(ctx: RequestContext, input: UpdateChannelInput): Promise>; delete(ctx: RequestContext, id: ID): Promise; isChannelAware(entity: VendureEntity): entity is VendureEntity & ChannelAware; /** * There must always be a default Channel. If none yet exists, this method creates one. * Also ensures the default Channel token matches the defaultChannelToken config setting. */ private ensureDefaultChannelExists; private validateDefaultLanguageCode; private updateAllChannels; }