private async _importWorkItemTypes()

in src/Common/ProcessImporter.ts [29:43]


    private async _importWorkItemTypes(payload: IProcessPayload): Promise<void> {
        for (const wit of payload.workItemTypes) {
            if (wit.class === WITProcessInterfaces.WorkItemTypeClass.System) {
                //The exported payload should not have exported System WITypes, so fail on import.
                throw new ImportError(`Work item type '${wit.name}' is a system work item type with no modifications, cannot import.`);
            }
            else {
                const createdWorkItemType = await Utility.tryCatchWithKnownError(() => this._witProcessDefinitionApi.createWorkItemType(wit, payload.process.typeId),
                    () => new ImportError(`Failed to create work item type '${wit.id}, see logs for details.`));
                if (!createdWorkItemType || createdWorkItemType.id !== wit.id) {
                    throw new ImportError(`Failed to create work item type '${wit.id}', server returned empty or reference name does not match.`);
                }
            }
        }
    }