UNPKG

sp-js-provisioning

Version:
77 lines (76 loc) 2.56 kB
import { IWeb } from '@pnp/sp/presets/all'; import { JsomContext } from 'spfx-jsom'; import { IProvisioningConfig } from '../provisioningconfig'; import { ProvisioningContext } from '../provisioningcontext'; import { ITaxonomy } from '../schema'; import { HandlerBase } from './handlerbase'; /** * Describes the Taxonomy Object Handler. * * Provisions a term group, its term sets and terms into the default site * collection term store using JSOM (so explicit term-set/term GUIDs from the * template are preserved). Idempotent: anything that already exists by ID is * left untouched. */ export declare class Taxonomy extends HandlerBase { jsomContext: JsomContext; context: ProvisioningContext; private termStore; /** * Creates a new instance of the Taxonomy handler. */ constructor(config: IProvisioningConfig); /** * Provisioning taxonomy * * @param web - The web * @param taxonomy - The taxonomy part of the template * @param context - Provisioning context */ ProvisionObjects(web: IWeb, taxonomy: ITaxonomy, context: ProvisioningContext): Promise<void>; /** * Ensure the term group exists, creating it with the specified ID if missing. * * @param groupDef - Term group definition */ private ensureGroup; /** * Ensure the term set exists under the group, creating it with the specified * ID if missing. * * @param group - Parent term group * @param termSetDef - Term set definition * @param lcid - Default language of the term store */ private ensureTermSet; /** * Ensure all terms exist in the term set (creating missing ones with their * specified IDs and custom properties) and apply the custom sort order. * * @param termSet - Parent term set * @param termSetDef - Term set definition * @param lcid - Default language of the term store */ private ensureTerms; /** * Apply custom properties to a newly created term. * * @param term - The term * @param termDef - Term definition */ private applyCustomProperties; /** * Apply the custom sort order of a term set based on the `SortOrder` of its * terms. * * @param termSet - The term set * @param terms - Term definitions */ private applySortOrder; /** * Load a taxonomy client object and return whether it exists on the server. * * @param clientObject - The taxonomy client object (group/set/term) */ private exists; }