function trimTrailingWhitespacesForLines(line1: number, line2: number, range?: TextRangeWithKind) {
            for (let line = line1; line < line2; line++) {
                const lineStartPosition = getStartPositionOfLine(line, sourceFile);
                const lineEndPosition = getEndLinePosition(line, sourceFile);

                // do not trim whitespaces in comments or template expression
                if (range && (isComment(range.kind) || isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) {
                    continue;
                }

                const whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition);
                if (whitespaceStart !== -1) {
                    Debug.assert(whitespaceStart === lineStartPosition || !isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(whitespaceStart - 1)));
                    recordDelete(whitespaceStart, lineEndPosition + 1 - whitespaceStart);
                }
            }
        }


/**
         * @param start The position of the first character in range
         * @param end The position of the last character in range
         */
function getTrailingWhitespaceStartPosition(start: number, end: number) {
            let pos = end;
            while (pos >= start && isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(pos))) {
                pos--;
            }
            if (pos !== end) {
                return pos + 1;
            }
            return -1;
        }


/**
         * Trimming will be done for lines after the previous range
         */
function trimTrailingWhitespacesForRemainingRange() {
            const startPosition = previousRange ? previousRange.end : originalRange.pos;

            const startLine = sourceFile.getLineAndCharacterOfPosition(startPosition).line;
            const endLine = sourceFile.getLineAndCharacterOfPosition(originalRange.end).line;

            trimTrailingWhitespacesForLines(startLine, endLine + 1, previousRange);
        }


function recordDelete(start: number, len: number) {
            if (len) {
                edits.push(createTextChangeFromStartLength(start, len, ""));
            }
        }


function recordReplace(start: number, len: number, newText: string) {
            if (len || newText) {
                edits.push(createTextChangeFromStartLength(start, len, newText));
            }
        }


function recordInsert(start: number, text: string) {
            if (text) {
                edits.push(createTextChangeFromStartLength(start, 0, text));
            }
        }


function applyRuleEdits(rule: Rule,
            previousRange: TextRangeWithKind,
            previousStartLine: number,
            currentRange: TextRangeWithKind,
            currentStartLine: number
        ): LineAction {
            const onLaterLine = currentStartLine !== previousStartLine;
            switch (rule.action) {
                case RuleAction.StopProcessingSpaceActions:
                    // no action required
                    return LineAction.None;
                case RuleAction.DeleteSpace:
                    if (previousRange.end !== currentRange.pos) {
                        // delete characters starting from t1.end up to t2.pos exclusive
                        recordDelete(previousRange.end, currentRange.pos - previousRange.end);
                        return onLaterLine ? LineAction.LineRemoved : LineAction.None;
                    }
                    break;
                case RuleAction.DeleteToken:
                    recordDelete(previousRange.pos, previousRange.end - previousRange.pos);
                    break;
                case RuleAction.InsertNewLine:
                    // exit early if we on different lines and rule cannot change number of newlines
                    // if line1 and line2 are on subsequent lines then no edits are required - ok to exit
                    // if line1 and line2 are separated with more than one newline - ok to exit since we cannot delete extra new lines
                    if (rule.flags !== RuleFlags.CanDeleteNewLines && previousStartLine !== currentStartLine) {
                        return LineAction.None;
                    }

                    // edit should not be applied if we have one line feed between elements
                    const lineDelta = currentStartLine - previousStartLine;
                    if (lineDelta !== 1) {
                        recordReplace(previousRange.end, currentRange.pos - previousRange.end, getNewLineOrDefaultFromHost(host, options));
                        return onLaterLine ? LineAction.None : LineAction.LineAdded;
                    }
                    break;
                case RuleAction.InsertSpace:
                    // exit early if we on different lines and rule cannot change number of newlines
                    if (rule.flags !== RuleFlags.CanDeleteNewLines && previousStartLine !== currentStartLine) {
                        return LineAction.None;
                    }

                    const posDelta = currentRange.pos - previousRange.end;
                    if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange.end) !== CharacterCodes.space) {
                        recordReplace(previousRange.end, currentRange.pos - previousRange.end, " ");
                        return onLaterLine ? LineAction.LineRemoved : LineAction.None;
                    }
                    break;
                case RuleAction.InsertTrailingSemicolon:
                    recordInsert(previousRange.end, ";");
            }
            return LineAction.None;
        }


/**
     * @param precedingToken pass `null` if preceding token was already computed and result was `undefined`.
     */
export function getRangeOfEnclosingComment(
        sourceFile: SourceFile,
        position: number,
        precedingToken?: Node | null,
        tokenAtPosition = getTokenAtPosition(sourceFile, position),
    ): CommentRange | undefined {
        const jsdoc = findAncestor(tokenAtPosition, isJSDoc);
        if (jsdoc) tokenAtPosition = jsdoc.parent;
        const tokenStart = tokenAtPosition.getStart(sourceFile);
        if (tokenStart <= position && position < tokenAtPosition.getEnd()) {
            return undefined;
        }

        // eslint-disable-next-line no-null/no-null
        precedingToken = precedingToken === null ? undefined : precedingToken === undefined ? findPrecedingToken(position, sourceFile) : precedingToken;

        // Between two consecutive tokens, all comments are either trailing on the former
        // or leading on the latter (and none are in both lists).
        const trailingRangesOfPreviousToken = precedingToken && getTrailingCommentRanges(sourceFile.text, precedingToken.end);
        const leadingCommentRangesOfNextToken = getLeadingCommentRangesOfNode(tokenAtPosition, sourceFile);
        const commentRanges = concatenate(trailingRangesOfPreviousToken, leadingCommentRangesOfNextToken);
        return commentRanges && find(commentRanges, range => rangeContainsPositionExclusive(range, position) ||
            // The end marker of a single-line comment does not include the newline character.
            // With caret at `^`, in the following case, we are inside a comment (^ denotes the cursor position):
            //
            //    // asdf   ^\n
            //
            // But for closed multi-line comments, we don't want to be inside the comment in the following case:
            //
            //    /* asdf */^
            //
            // However, unterminated multi-line comments *do* contain their end.
            //
            // Internally, we represent the end of the comment at the newline and closing '/', respectively.
            //
            position === range.end && (range.kind === SyntaxKind.SingleLineCommentTrivia || position === sourceFile.getFullWidth()));
    }


function getOpenTokenForList(node: Node, list: readonly Node[]) {
        switch (node.kind) {
            case SyntaxKind.Constructor:
            case SyntaxKind.FunctionDeclaration:
            case SyntaxKind.FunctionExpression:
            case SyntaxKind.MethodDeclaration:
            case SyntaxKind.MethodSignature:
            case SyntaxKind.ArrowFunction:
                if ((<FunctionDeclaration>node).typeParameters === list) {
                    return SyntaxKind.LessThanToken;
                }
                else if ((<FunctionDeclaration>node).parameters === list) {
                    return SyntaxKind.OpenParenToken;
                }
                break;
            case SyntaxKind.CallExpression:
            case SyntaxKind.NewExpression:
                if ((<CallExpression>node).typeArguments === list) {
                    return SyntaxKind.LessThanToken;
                }
                else if ((<CallExpression>node).arguments === list) {
                    return SyntaxKind.OpenParenToken;
                }
                break;
            case SyntaxKind.TypeReference:
                if ((<TypeReferenceNode>node).typeArguments === list) {
                    return SyntaxKind.LessThanToken;
                }
                break;
            case SyntaxKind.TypeLiteral:
                return SyntaxKind.OpenBraceToken;
        }

        return SyntaxKind.Unknown;
    }


function getCloseTokenForOpenToken(kind: SyntaxKind) {
        switch (kind) {
            case SyntaxKind.OpenParenToken:
                return SyntaxKind.CloseParenToken;
            case SyntaxKind.LessThanToken:
                return SyntaxKind.GreaterThanToken;
            case SyntaxKind.OpenBraceToken:
                return SyntaxKind.CloseBraceToken;
        }

        return SyntaxKind.Unknown;
    }


export function getIndentationString(indentation: number, options: EditorSettings): string {
        // reset interned strings if FormatCodeOptions were changed
        const resetInternedStrings =
            !internedSizes || (internedSizes.tabSize !== options.tabSize || internedSizes.indentSize !== options.indentSize);

        if (resetInternedStrings) {
            internedSizes = { tabSize: options.tabSize!, indentSize: options.indentSize! };
            internedTabsIndentation = internedSpacesIndentation = undefined;
        }

        if (!options.convertTabsToSpaces) {
            const tabs = Math.floor(indentation / options.tabSize!);
            const spaces = indentation - tabs * options.tabSize!;

            let tabString: string;
            if (!internedTabsIndentation) {
                internedTabsIndentation = [];
            }

            if (internedTabsIndentation[tabs] === undefined) {
                internedTabsIndentation[tabs] = tabString = repeatString("\t", tabs);
            }
            else {
                tabString = internedTabsIndentation[tabs];
            }

            return spaces ? tabString + repeatString(" ", spaces) : tabString;
        }
        else {
            let spacesString: string;
            const quotient = Math.floor(indentation / options.indentSize!);
            const remainder = indentation % options.indentSize!;
            if (!internedSpacesIndentation) {
                internedSpacesIndentation = [];
            }

            if (internedSpacesIndentation[quotient] === undefined) {
                spacesString = repeatString(" ", options.indentSize! * quotient);
                internedSpacesIndentation[quotient] = spacesString;
            }
            else {
                spacesString = internedSpacesIndentation[quotient];
            }

            return remainder ? spacesString + repeatString(" ", remainder) : spacesString;
        }
    }


() => Debug.formatSyntaxKind(kind)


c => startEndContainsRange(c.getStart(sourceFile), c.end, range) && c


d => rangeOverlapsWithStartEnd(originalRange, d.start!, d.start! + d.length!)


(e1, e2) => e1.start! - e2.start!


r => {
            // in current implementation sequence of arguments [r1, r2...] is monotonically increasing.
            // 'index' tracks the index of the most recent error that was checked.
            while (true) {
                if (index >= sorted.length) {
                    // all errors in the range were already checked -> no error in specified range
                    return false;
                }

                const error = sorted[index];
                if (r.end <= error.start!) {
                    // specified range ends before the error referred by 'index' - no error in range
                    return false;
                }

                if (startEndOverlapsWithStartEnd(r.pos, r.end, error.start!, error.start! + error.length!)) {
                    // specified range overlaps with error range
                    return true;
                }

                index++;
            }
        }


scanner => formatSpanWorker(
            range,
            node,
            initialIndentation,
            delta,
            scanner,
            formatContext,
            FormattingRequestKind.FormatSelection,
            _ => false, // assume that node does not have any errors
            sourceFileLike)


_ => false


scanner => formatSpanWorker(
                originalRange,
                enclosingNode,
                SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, formatContext.options),
                getOwnOrInheritedDelta(enclosingNode, formatContext.options, sourceFile),
                scanner,
                formatContext,
                requestKind,
                prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange),
                sourceFile)


item => processRange(item, sourceFile.getLineAndCharacterOfPosition(item.pos), enclosingNode, enclosingNode, /*dynamicIndentation*/ undefined!)


(kind, tokenIndentation, container) => {
                    switch (kind) {
                        // preceding comment to the token that closes the indentation scope inherits the indentation from the scope
                        // ..  {
                        //     // comment
                        // }
                        case SyntaxKind.CloseBraceToken:
                        case SyntaxKind.CloseBracketToken:
                        case SyntaxKind.CloseParenToken:
                            return indentation + getDelta(container);
                    }
                    return tokenIndentation !== Constants.Unknown ? tokenIndentation : indentation;
                }


(line, kind, container, suppressDelta) =>
                    !suppressDelta && shouldAddDelta(line, kind, container) ? indentation + getDelta(container) : indentation


() => indentation


(lineAdded, parent) => {
                    if (SmartIndenter.shouldIndentChildNode(options, parent, node, sourceFile)) {
                        indentation += lineAdded ? options.indentSize! : -options.indentSize!;
                        delta = SmartIndenter.shouldIndentChildNode(options, node) ? options.indentSize! : 0;
                    }
                }


child => {
                    processChildNode(child, /*inheritedIndentation*/ Constants.Unknown, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListItem*/ false);
                }


nodes => {
                    processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);
                }


arg => arg.pos === child.pos


item => insertIndentation(item.pos, commentIndentation, /*lineAdded*/ false)


rule => {
                    lineAction = applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine);
                    switch (lineAction) {
                        case LineAction.LineRemoved:
                            // Handle the case where the next line is moved to be the end of this line.
                            // In this case we don't indent the next line in the next pass.
                            if (currentParent.getStart(sourceFile) === currentItem.pos) {
                                dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ false, contextNode);
                            }
                            break;
                        case LineAction.LineAdded:
                            // Handle the case where token2 is moved to the new line.
                            // In this case we indent token2 in the next pass but we set
                            // sameLineIndent flag to notify the indenter that the indentation is within the line.
                            if (currentParent.getStart(sourceFile) === currentItem.pos) {
                                dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ true, contextNode);
                            }
                            break;
                        default:
                            Debug.assert(lineAction === LineAction.None);
                    }

                    // We need to trim trailing whitespace between the tokens if they were on different lines, and no rule was applied to put them on the same line
                    trimTrailingWhitespaces = trimTrailingWhitespaces && !(rule.action & RuleAction.DeleteSpace) && rule.flags !== RuleFlags.CanDeleteNewLines;
                }


range => rangeContainsPositionExclusive(range, position) ||
            // The end marker of a single-line comment does not include the newline character.
            // With caret at `^`, in the following case, we are inside a comment (^ denotes the cursor position):
            //
            //    // asdf   ^\n
            //
            // But for closed multi-line comments, we don't want to be inside the comment in the following case:
            //
            //    /* asdf */^
            //
            // However, unterminated multi-line comments *do* contain their end.
            //
            // Internally, we represent the end of the comment at the newline and closing '/', respectively.
            //
            position === range.end && (range.kind === SyntaxKind.SingleLineCommentTrivia || position === sourceFile.getFullWidth())


export interface FormatContext {
        readonly options: FormatCodeSettings;
        readonly getRules: RulesMap;
        readonly host: FormattingHost;
    }


export interface TextRangeWithKind<T extends SyntaxKind = SyntaxKind> extends TextRange {
        kind: T;
    }


export interface TokenInfo {
        leadingTrivia: TextRangeWithTriviaKind[] | undefined;
        token: TextRangeWithKind;
        trailingTrivia: TextRangeWithTriviaKind[] | undefined;
    }


/*
     * Indentation for the scope that can be dynamically recomputed.
     * i.e
     * while(true)
     * { let x;
     * }
     * Normally indentation is applied only to the first token in line so at glance 'let' should not be touched.
     * However if some format rule adds new line between '}' and 'let' 'let' will become
     * the first token in line so it should be indented
     */
interface DynamicIndentation {
        getIndentationForToken(tokenLine: number, tokenKind: SyntaxKind, container: Node, suppressDelta: boolean): number;
        getIndentationForComment(owningToken: SyntaxKind, tokenIndentation: number, container: Node): number;
        /**
         * Indentation for open and close tokens of the node if it is block or another node that needs special indentation
         * ... {
         * .........<child>
         * ....}
         *  ____ - indentation
         *      ____ - delta
         */
        getIndentation(): number;
        /**
         * Prefered relative indentation for child nodes.
         * Delta is used to carry the indentation info
         * foo(bar({
         *     $
         * }))
         * Both 'foo', 'bar' introduce new indentation with delta = 4, but total indentation in $ is not 8.
         * foo: { indentation: 0, delta: 4 }
         * bar: { indentation: foo.indentation + foo.delta = 4, delta: 4} however 'foo' and 'bar' are on the same line
         * so bar inherits indentation from foo and bar.delta will be 4
         *
         */
        getDelta(child: TextRangeWithKind): number;
        /**
         * Formatter calls this function when rule adds or deletes new lines from the text
         * so indentation scope can adjust values of indentation and delta.
         */
        recomputeIndentation(lineAddedByFormatting: boolean, parent: Node): void;
    }


const enum Constants {
        Unknown = -1
    }


const enum LineAction { None, LineAdded, LineRemoved }


export type TextRangeWithTriviaKind = TextRangeWithKind<TriviaKind>;


export interface ServerErrorMessage {
  path: string;
  code: string;
  message: string;
}


export interface ServerError {
  code: string;
  message: string;
  errors: ServerErrorMessage[];
}


(fullFilePath: string, reload = false) => {
      let task;
      let collection = require(fullFilePath);
      for (const i in collection) {
        const TaskClass = collection[i];
        task = new TaskClass();
        task.validate();

        if (api.tasks.tasks[task.name] && !reload) {
          log(
            `an existing task with the same name \`${task.name}\` will be overridden by the file ${fullFilePath}`,
            "crit"
          );
        }

        api.tasks.tasks[task.name] = task;
        api.tasks.jobs[task.name] = api.tasks.jobWrapper(task.name);
        log(
          `task ${reload ? "(re)" : ""} loaded: ${task.name}, ${fullFilePath}`,
          "debug"
        );
      }
    }


(taskName: string) => {
      const task = api.tasks.tasks[taskName];

      const middleware = task.middleware || [];
      const plugins = task.plugins || [];
      const pluginOptions = task.pluginOptions || {};

      if (task.frequency > 0) {
        if (plugins.indexOf("JobLock") < 0) {
          plugins.push("JobLock");
        }
        if (plugins.indexOf("QueueLock") < 0) {
          plugins.push("QueueLock");
        }
        if (plugins.indexOf("DelayQueueLock") < 0) {
          plugins.push("DelayQueueLock");
        }
      }

      // load middleware into plugins
      const processMiddleware = (m) => {
        if (api.tasks.middleware[m]) {
          //@ts-ignore
          class NodeResquePlugin extends Plugin {
            constructor(...args) {
              //@ts-ignore
              super(...args);
              if (api.tasks.middleware[m].preProcessor) {
                //@ts-ignore
                this.beforePerform = api.tasks.middleware[m].preProcessor;
              }
              if (api.tasks.middleware[m].postProcessor) {
                //@ts-ignore
                this.afterPerform = api.tasks.middleware[m].postProcessor;
              }
              if (api.tasks.middleware[m].preEnqueue) {
                //@ts-ignore
                this.beforeEnqueue = api.tasks.middleware[m].preEnqueue;
              }
              if (api.tasks.middleware[m].postEnqueue) {
                //@ts-ignore
                this.afterEnqueue = api.tasks.middleware[m].postEnqueue;
              }
            }
          }

          plugins.push(NodeResquePlugin);
        }
      };

      api.tasks.globalMiddleware.forEach(processMiddleware);
      middleware.forEach(processMiddleware);

      return {
        plugins,
        pluginOptions,
        perform: async function () {
          const combinedArgs = [].concat(Array.prototype.slice.call(arguments));
          combinedArgs.push(this);
          let response = null;
          try {
            response = await task.run.apply(task, combinedArgs);
            await taskModule.enqueueRecurrentTask(taskName);
          } catch (error) {
            if (task.frequency > 0 && task.reEnqueuePeriodicTaskIfException) {
              await taskModule.enqueueRecurrentTask(taskName);
            }
            throw error;
          }
          return response;
        },
      };
    }


(m) => {
        if (api.tasks.middleware[m]) {
          //@ts-ignore
          class NodeResquePlugin extends Plugin {
            constructor(...args) {
              //@ts-ignore
              super(...args);
              if (api.tasks.middleware[m].preProcessor) {
                //@ts-ignore
                this.beforePerform = api.tasks.middleware[m].preProcessor;
              }
              if (api.tasks.middleware[m].postProcessor) {
                //@ts-ignore
                this.afterPerform = api.tasks.middleware[m].postProcessor;
              }
              if (api.tasks.middleware[m].preEnqueue) {
                //@ts-ignore
                this.beforeEnqueue = api.tasks.middleware[m].preEnqueue;
              }
              if (api.tasks.middleware[m].postEnqueue) {
                //@ts-ignore
                this.afterEnqueue = api.tasks.middleware[m].postEnqueue;
              }
            }
          }

          plugins.push(NodeResquePlugin);
        }
      }


(reload) => {
      config.general.paths.task.forEach((p) => {
        utils
          .ensureNoTsHeaderFiles(
            glob.sync(path.join(p, "**", "**/*(*.js|*.ts)"))
          )
          .forEach((f) => {
            api.tasks.loadFile(f, reload);
          });
      });

      for (const pluginName in config.plugins) {
        if (config.plugins[pluginName].tasks !== false) {
          const pluginPath = config.plugins[pluginName].path;

          // old style at the root of the project
          let files = glob.sync(path.join(pluginPath, "tasks", "**", "*.js"));

          files = files.concat(
            glob.sync(path.join(pluginPath, "dist", "tasks", "**", "*.js"))
          );

          utils.ensureNoTsHeaderFiles(files).forEach((f) => {
            api.tasks.loadFile(f, reload);
          });
        }
      }
    }


(p) => {
        utils
          .ensureNoTsHeaderFiles(
            glob.sync(path.join(p, "**", "**/*(*.js|*.ts)"))
          )
          .forEach((f) => {
            api.tasks.loadFile(f, reload);
          });
      }


(f) => {
            api.tasks.loadFile(f, reload);
          }


/**
 * Tools for enqueuing and inspecting the task system (delayed jobs).
 */
export class Tasks extends Initializer {
  constructor() {
    super();
    this.name = "tasks";
    this.loadPriority = 699;
    this.startPriority = 975;
  }

  async initialize(config) {
    api.tasks = {
      tasks: {},
      jobs: {},
      middleware: {},
      globalMiddleware: [],
    };

    api.tasks.loadFile = (fullFilePath: string, reload = false) => {
      let task;
      let collection = require(fullFilePath);
      for (const i in collection) {
        const TaskClass = collection[i];
        task = new TaskClass();
        task.validate();

        if (api.tasks.tasks[task.name] && !reload) {
          log(
            `an existing task with the same name \`${task.name}\` will be overridden by the file ${fullFilePath}`,
            "crit"
          );
        }

        api.tasks.tasks[task.name] = task;
        api.tasks.jobs[task.name] = api.tasks.jobWrapper(task.name);
        log(
          `task ${reload ? "(re)" : ""} loaded: ${task.name}, ${fullFilePath}`,
          "debug"
        );
      }
    };

    api.tasks.jobWrapper = (taskName: string) => {
      const task = api.tasks.tasks[taskName];

      const middleware = task.middleware || [];
      const plugins = task.plugins || [];
      const pluginOptions = task.pluginOptions || {};

      if (task.frequency > 0) {
        if (plugins.indexOf("JobLock") < 0) {
          plugins.push("JobLock");
        }
        if (plugins.indexOf("QueueLock") < 0) {
          plugins.push("QueueLock");
        }
        if (plugins.indexOf("DelayQueueLock") < 0) {
          plugins.push("DelayQueueLock");
        }
      }

      // load middleware into plugins
      const processMiddleware = (m) => {
        if (api.tasks.middleware[m]) {
          //@ts-ignore
          class NodeResquePlugin extends Plugin {
            constructor(...args) {
              //@ts-ignore
              super(...args);
              if (api.tasks.middleware[m].preProcessor) {
                //@ts-ignore
                this.beforePerform = api.tasks.middleware[m].preProcessor;
              }
              if (api.tasks.middleware[m].postProcessor) {
                //@ts-ignore
                this.afterPerform = api.tasks.middleware[m].postProcessor;
              }
              if (api.tasks.middleware[m].preEnqueue) {
                //@ts-ignore
                this.beforeEnqueue = api.tasks.middleware[m].preEnqueue;
              }
              if (api.tasks.middleware[m].postEnqueue) {
                //@ts-ignore
                this.afterEnqueue = api.tasks.middleware[m].postEnqueue;
              }
            }
          }

          plugins.push(NodeResquePlugin);
        }
      };

      api.tasks.globalMiddleware.forEach(processMiddleware);
      middleware.forEach(processMiddleware);

      return {
        plugins,
        pluginOptions,
        perform: async function () {
          const combinedArgs = [].concat(Array.prototype.slice.call(arguments));
          combinedArgs.push(this);
          let response = null;
          try {
            response = await task.run.apply(task, combinedArgs);
            await taskModule.enqueueRecurrentTask(taskName);
          } catch (error) {
            if (task.frequency > 0 && task.reEnqueuePeriodicTaskIfException) {
              await taskModule.enqueueRecurrentTask(taskName);
            }
            throw error;
          }
          return response;
        },
      };
    };

    api.tasks.loadTasks = (reload) => {
      config.general.paths.task.forEach((p) => {
        utils
          .ensureNoTsHeaderFiles(
            glob.sync(path.join(p, "**", "**/*(*.js|*.ts)"))
          )
          .forEach((f) => {
            api.tasks.loadFile(f, reload);
          });
      });

      for (const pluginName in config.plugins) {
        if (config.plugins[pluginName].tasks !== false) {
          const pluginPath = config.plugins[pluginName].path;

          // old style at the root of the project
          let files = glob.sync(path.join(pluginPath, "tasks", "**", "*.js"));

          files = files.concat(
            glob.sync(path.join(pluginPath, "dist", "tasks", "**", "*.js"))
          );

          utils.ensureNoTsHeaderFiles(files).forEach((f) => {
            api.tasks.loadFile(f, reload);
          });
        }
      }
    };

    api.tasks.loadTasks(false);
  }

  async start(config) {
    if (config.redis.enabled === false) {
      return;
    }

    if (config.tasks.scheduler === true) {
      await taskModule.enqueueAllRecurrentTasks();
    }
  }
}


//@ts-ignore
class NodeResquePlugin extends Plugin {
            constructor(...args) {
              //@ts-ignore
              super(...args);
              if (api.tasks.middleware[m].preProcessor) {
                //@ts-ignore
                this.beforePerform = api.tasks.middleware[m].preProcessor;
              }
              if (api.tasks.middleware[m].postProcessor) {
                //@ts-ignore
                this.afterPerform = api.tasks.middleware[m].postProcessor;
              }
              if (api.tasks.middleware[m].preEnqueue) {
                //@ts-ignore
                this.beforeEnqueue = api.tasks.middleware[m].preEnqueue;
              }
              if (api.tasks.middleware[m].postEnqueue) {
                //@ts-ignore
                this.afterEnqueue = api.tasks.middleware[m].postEnqueue;
              }
            }
          }


export interface TaskApi {
  tasks: { [key: string]: any };
  jobs: { [key: string]: any };
  middleware: { [key: string]: TaskModule.task.TaskMiddleware };
  globalMiddleware: Array<string>;
  loadFile?: Function;
  jobWrapper?: Function;
  loadTasks?: Function;
}


async initialize(config) {
    api.tasks = {
      tasks: {},
      jobs: {},
      middleware: {},
      globalMiddleware: [],
    };

    api.tasks.loadFile = (fullFilePath: string, reload = false) => {
      let task;
      let collection = require(fullFilePath);
      for (const i in collection) {
        const TaskClass = collection[i];
        task = new TaskClass();
        task.validate();

        if (api.tasks.tasks[task.name] && !reload) {
          log(
            `an existing task with the same name \`${task.name}\` will be overridden by the file ${fullFilePath}`,
            "crit"
          );
        }

        api.tasks.tasks[task.name] = task;
        api.tasks.jobs[task.name] = api.tasks.jobWrapper(task.name);
        log(
          `task ${reload ? "(re)" : ""} loaded: ${task.name}, ${fullFilePath}`,
          "debug"
        );
      }
    };

    api.tasks.jobWrapper = (taskName: string) => {
      const task = api.tasks.tasks[taskName];

      const middleware = task.middleware || [];
      const plugins = task.plugins || [];
      const pluginOptions = task.pluginOptions || {};

      if (task.frequency > 0) {
        if (plugins.indexOf("JobLock") < 0) {
          plugins.push("JobLock");
        }
        if (plugins.indexOf("QueueLock") < 0) {
          plugins.push("QueueLock");
        }
        if (plugins.indexOf("DelayQueueLock") < 0) {
          plugins.push("DelayQueueLock");
        }
      }

      // load middleware into plugins
      const processMiddleware = (m) => {
        if (api.tasks.middleware[m]) {
          //@ts-ignore
          class NodeResquePlugin extends Plugin {
            constructor(...args) {
              //@ts-ignore
              super(...args);
              if (api.tasks.middleware[m].preProcessor) {
                //@ts-ignore
                this.beforePerform = api.tasks.middleware[m].preProcessor;
              }
              if (api.tasks.middleware[m].postProcessor) {
                //@ts-ignore
                this.afterPerform = api.tasks.middleware[m].postProcessor;
              }
              if (api.tasks.middleware[m].preEnqueue) {
                //@ts-ignore
                this.beforeEnqueue = api.tasks.middleware[m].preEnqueue;
              }
              if (api.tasks.middleware[m].postEnqueue) {
                //@ts-ignore
                this.afterEnqueue = api.tasks.middleware[m].postEnqueue;
              }
            }
          }

          plugins.push(NodeResquePlugin);
        }
      };

      api.tasks.globalMiddleware.forEach(processMiddleware);
      middleware.forEach(processMiddleware);

      return {
        plugins,
        pluginOptions,
        perform: async function () {
          const combinedArgs = [].concat(Array.prototype.slice.call(arguments));
          combinedArgs.push(this);
          let response = null;
          try {
            response = await task.run.apply(task, combinedArgs);
            await taskModule.enqueueRecurrentTask(taskName);
          } catch (error) {
            if (task.frequency > 0 && task.reEnqueuePeriodicTaskIfException) {
              await taskModule.enqueueRecurrentTask(taskName);
            }
            throw error;
          }
          return response;
        },
      };
    };

    api.tasks.loadTasks = (reload) => {
      config.general.paths.task.forEach((p) => {
        utils
          .ensureNoTsHeaderFiles(
            glob.sync(path.join(p, "**", "**/*(*.js|*.ts)"))
          )
          .forEach((f) => {
            api.tasks.loadFile(f, reload);
          });
      });

      for (const pluginName in config.plugins) {
        if (config.plugins[pluginName].tasks !== false) {
          const pluginPath = config.plugins[pluginName].path;

          // old style at the root of the project
          let files = glob.sync(path.join(pluginPath, "tasks", "**", "*.js"));

          files = files.concat(
            glob.sync(path.join(pluginPath, "dist", "tasks", "**", "*.js"))
          );

          utils.ensureNoTsHeaderFiles(files).forEach((f) => {
            api.tasks.loadFile(f, reload);
          });
        }
      }
    };

    api.tasks.loadTasks(false);
  }


async start(config) {
    if (config.redis.enabled === false) {
      return;
    }

    if (config.tasks.scheduler === true) {
      await taskModule.enqueueAllRecurrentTasks();
    }
  }


export declare type OpenIDConnectUserInfoResponse = WebAPICallResult & {
    ok?: boolean;
    warning?: string;
    error?: string;
    needed?: string;
    provided?: string;
    sub?: string;
    'https://slack.com/user_id'?: string;
    'https://slack.com/team_id'?: string;
    'https://slack.com/enterprise_id'?: string;
    email?: string;
    email_verified?: boolean;
    date_email_verified?: number;
    name?: string;
    picture?: string;
    given_name?: string;
    family_name?: string;
    locale?: string;
    'https://slack.com/team_name'?: string;
    'https://slack.com/team_domain'?: string;
    'https://slack.com/enterprise_name'?: string;
    'https://slack.com/enterprise_domain'?: string;
    'https://slack.com/user_image_24'?: string;
    'https://slack.com/user_image_32'?: string;
    'https://slack.com/user_image_48'?: string;
    'https://slack.com/user_image_72'?: string;
    'https://slack.com/user_image_192'?: string;
    'https://slack.com/user_image_512'?: string;
    'https://slack.com/user_image_1024'?: string;
    'https://slack.com/team_image_34'?: string;
    'https://slack.com/team_image_44'?: string;
    'https://slack.com/team_image_68'?: string;
    'https://slack.com/team_image_88'?: string;
    'https://slack.com/team_image_102'?: string;
    'https://slack.com/team_image_132'?: string;
    'https://slack.com/team_image_230'?: string;
};


() => StudentTeacher


(std_teach) => std_teach.teacher


@Entity({
  name: 'teachers',
})
export class Teacher extends master2 {
  @PrimaryGeneratedColumn()
  id: number;
  @Column({
    name: 'teacher_name',
  })
  teacherName: string;
  @OneToMany(() => StudentTeacher, (std_teach) => std_teach.teacher)
  std_teach: StudentTeacher[];
}


@Controller()
export class TodoController {
  constructor(
    private readonly todoService: TodoService,
    private readonly userService: UserService,
  ) {}

  @UseGuards(JwtAuthGuard)
  @Get('tasks?')
  async getAllTodo(
    @Request() req,
    @Query('status') status: TodoStatus,
  ): Promise<{ data: Todo[] }> {
    return { data: await this.todoService.getTodos(req.user.username, status) };
  }

  @UseGuards(JwtAuthGuard)
  @Post('tasks')
  async createTodo(
    @Request() req,
    @Body() body: CreateTodoDto,
  ): Promise<{ data: Todo }> {
    const username = req.user.username;
    const todoCount = await this.todoService.countTodoDaily(username);
    return {
      data: await this.userService.createTodo(
        username,
        body.content,
        todoCount,
      ),
    };
  }

  @UseGuards(JwtAuthGuard)
  @Put('tasks')
  async updateStatus(@Body() body: UpdateTodoStatusDto) {
    await this.todoService.setTodoStatus(body.id, body.status);
  }

  @UseGuards(JwtAuthGuard)
  @Put('many-tasks')
  async updateManyStatus(@Body() body: UpdateTodosStatusDto) {
    await this.todoService.setManyTodoStatus(body.ids, body.status);
  }

  @UseGuards(JwtAuthGuard)
  @Delete('tasks/:id')
  async deleteTodo(@Param('id') id: string) {
    await this.todoService.deleteTodoById(id);
  }

  @UseGuards(JwtAuthGuard)
  @Delete('tasks')
  async deleteAllTodos(@Request() req) {
    await this.todoService.deleteAllTodos(req.user.username);
  }
}


@UseGuards(JwtAuthGuard)
  @Get('tasks?')
  async getAllTodo(
    @Request() req,
    @Query('status') status: TodoStatus,
  ): Promise<{ data: Todo[] }> {
    return { data: await this.todoService.getTodos(req.user.username, status) };
  }


@UseGuards(JwtAuthGuard)
  @Post('tasks')
  async createTodo(
    @Request() req,
    @Body() body: CreateTodoDto,
  ): Promise<{ data: Todo }> {
    const username = req.user.username;
    const todoCount = await this.todoService.countTodoDaily(username);
    return {
      data: await this.userService.createTodo(
        username,
        body.content,
        todoCount,
      ),
    };
  }


@UseGuards(JwtAuthGuard)
  @Put('tasks')
  async updateStatus(@Body() body: UpdateTodoStatusDto) {
    await this.todoService.setTodoStatus(body.id, body.status);
  }


@UseGuards(JwtAuthGuard)
  @Put('many-tasks')
  async updateManyStatus(@Body() body: UpdateTodosStatusDto) {
    await this.todoService.setManyTodoStatus(body.ids, body.status);
  }


@UseGuards(JwtAuthGuard)
  @Delete('tasks/:id')
  async deleteTodo(@Param('id') id: string) {
    await this.todoService.deleteTodoById(id);
  }


@UseGuards(JwtAuthGuard)
  @Delete('tasks')
  async deleteAllTodos(@Request() req) {
    await this.todoService.deleteAllTodos(req.user.username);
  }


(
    state: DatasourcePaneReduxState,
    action: ReduxAction<{ id: string; draft: Partial<Datasource> }>,
  ) => {
    return {
      ...state,
      drafts: {
        ...state.drafts,
        [action.payload.id]: action.payload.draft,
      },
    };
  }


(
    state: DatasourcePaneReduxState,
    action: ReduxAction<{ id: string }>,
  ) => ({
    ...state,
    drafts: _.omit(state.drafts, action.payload.id),
  })


(
    state: DatasourcePaneReduxState,
    action: ReduxAction<{
      apiId: string;
      datasourceId: string;
      pageId: string;
      applicationId: string;
    }>,
  ) => {
    return {
      ...state,
      actionRouteInfo: action.payload,
    };
  }


(
    state: DatasourcePaneReduxState,
  ) => ({
    ...state,
    actionRouteInfo: {},
  })


(
    state: DatasourcePaneReduxState,
    action: ReduxAction<{ id: string }>,
  ) => {
    return {
      ...state,
      newDatasource: action.payload.id,
    };
  }


(
    state: DatasourcePaneReduxState,
  ) => {
    return {
      ...state,
      newDatasource: "",
    };
  }


(
    state: DatasourcePaneReduxState,
    action: ReduxAction<Datasource>,
  ) => {
    return {
      ...state,
      newDatasource: "",
      expandDatasourceId: action.payload.id,
    };
  }


(
    state: DatasourcePaneReduxState,
    action: ReduxAction<{ id: string; viewMode: boolean }>,
  ) => {
    return {
      ...state,
      viewMode: {
        ...state.viewMode,
        [action.payload.id]: action.payload.viewMode,
      },
    };
  }


(
    state: DatasourcePaneReduxState,
    action: ReduxAction<string>,
  ) => {
    return {
      ...state,
      expandDatasourceId: action.payload,
    };
  }


export interface DatasourcePaneReduxState {
  drafts: Record<string, Datasource>;
  expandDatasourceId: string;
  actionRouteInfo: Partial<{
    apiId: string;
    datasourceId: string;
    pageId: string;
    applicationId: string;
  }>;
  newDatasource: string;
  viewMode: Record<string, boolean>;
}


(subdomain: string) => `${subdomain}.github.com/repos/${owner}/${repo}/releases`


(urlPath: string, opts?: RequestInit) => {
  return requestJsonWithAuth(join(API_URL, urlPath), opts);
}


async (releaseId: string, filepath: string) => {
  const filename = basename(filepath);
  return requestJsonWithAuth(join(API_UPLOADS_URL, releaseId, `/assets?name=${filename}`), {
    method: 'POST',
    body: fs.createReadStream(filepath),
    headers: {
      'content-length': (await fs.stat(filepath)).size.toString(),
      'content-type': 'application/octet-stream',
    },
  });
}


() => {
  if (process.argv.length !== 3) {
    throw new Error(`Expected semver version as first and only argument`);
  }
  return process.argv[2].trim();
}


(tag: string) => tag.slice(1)


(semver: string) => `v${semver}`


async (url: string, opts: RequestInit = {}) => {
  url = encodeURI(`https://${url}`);
  opts.headers = { ...authHeaders, ...opts.headers };
  const response = await fetch(url, opts);
  if (response.status === 204) return null;
  const result = await response.json();
  if (response.status >= 400) {
    throw new Error(`${response.status}: Request to ${url} was rejected:\n${JSON.stringify(result, null, 2)}`);
  }
  return result;
}


() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions)


() => this.authentications.default.applyToRequest(localVarRequestOptions)


() => interceptor(localVarRequestOptions)


() => {
            if (Object.keys(localVarFormParams).length) {
                if (localVarUseFormData) {
                    (<any>localVarRequestOptions).formData = localVarFormParams;
                } else {
                    localVarRequestOptions.form = localVarFormParams;
                }
            }
            return new Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClass;  }>((resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1alpha1PriorityClass");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            });
        }


(resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1alpha1PriorityClass");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            }


(error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1alpha1PriorityClass");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                }


() => {
            if (Object.keys(localVarFormParams).length) {
                if (localVarUseFormData) {
                    (<any>localVarRequestOptions).formData = localVarFormParams;
                } else {
                    localVarRequestOptions.form = localVarFormParams;
                }
            }
            return new Promise<{ response: http.IncomingMessage; body: V1Status;  }>((resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1Status");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            });
        }


(resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1Status");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            }


(error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1Status");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                }


() => {
            if (Object.keys(localVarFormParams).length) {
                if (localVarUseFormData) {
                    (<any>localVarRequestOptions).formData = localVarFormParams;
                } else {
                    localVarRequestOptions.form = localVarFormParams;
                }
            }
            return new Promise<{ response: http.IncomingMessage; body: V1APIResourceList;  }>((resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1APIResourceList");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            });
        }


(resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1APIResourceList");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            }


(error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1APIResourceList");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                }


() => {
            if (Object.keys(localVarFormParams).length) {
                if (localVarUseFormData) {
                    (<any>localVarRequestOptions).formData = localVarFormParams;
                } else {
                    localVarRequestOptions.form = localVarFormParams;
                }
            }
            return new Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClassList;  }>((resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1alpha1PriorityClassList");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            });
        }


(resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1alpha1PriorityClassList");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            }


(error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1alpha1PriorityClassList");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                }


// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================
export enum SchedulingV1alpha1ApiApiKeys {
    BearerToken,
}


public setDefaultAuthentication(auth: Authentication) {
        this.authentications.default = auth;
    }


public setApiKey(key: SchedulingV1alpha1ApiApiKeys, value: string) {
        (this.authentications as any)[SchedulingV1alpha1ApiApiKeys[key]].apiKey = value;
    }


public addInterceptor(interceptor: Interceptor) {
        this.interceptors.push(interceptor);
    }


/**
     * create a PriorityClass
     * @param body
     * @param pretty If \'true\', then the output is pretty printed.
     * @param dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
     * @param fieldManager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
     */
public async createPriorityClass (body: V1alpha1PriorityClass, pretty?: string, dryRun?: string, fieldManager?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClass;  }> {
        const localVarPath = this.basePath + '/apis/scheduling.k8s.io/v1alpha1/priorityclasses';
        let localVarQueryParameters: any = {};
        let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
        const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'];
        // give precedence to 'application/json'
        if (produces.indexOf('application/json') >= 0) {
            localVarHeaderParams.Accept = 'application/json';
        } else {
            localVarHeaderParams.Accept = produces.join(',');
        }
        let localVarFormParams: any = {};

        // verify required parameter 'body' is not null or undefined
        if (body === null || body === undefined) {
            throw new Error('Required parameter body was null or undefined when calling createPriorityClass.');
        }

        if (pretty !== undefined) {
            localVarQueryParameters['pretty'] = ObjectSerializer.serialize(pretty, "string");
        }

        if (dryRun !== undefined) {
            localVarQueryParameters['dryRun'] = ObjectSerializer.serialize(dryRun, "string");
        }

        if (fieldManager !== undefined) {
            localVarQueryParameters['fieldManager'] = ObjectSerializer.serialize(fieldManager, "string");
        }

        (<any>Object).assign(localVarHeaderParams, options.headers);

        let localVarUseFormData = false;

        let localVarRequestOptions: localVarRequest.Options = {
            method: 'POST',
            qs: localVarQueryParameters,
            headers: localVarHeaderParams,
            uri: localVarPath,
            useQuerystring: this._useQuerystring,
            json: true,
            body: ObjectSerializer.serialize(body, "V1alpha1PriorityClass")
        };

        let authenticationPromise = Promise.resolve();
        if (this.authentications.BearerToken.apiKey) {
            authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
        }
        authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));

        let interceptorPromise = authenticationPromise;
        for (const interceptor of this.interceptors) {
            interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
        }

        return interceptorPromise.then(() => {
            if (Object.keys(localVarFormParams).length) {
                if (localVarUseFormData) {
                    (<any>localVarRequestOptions).formData = localVarFormParams;
                } else {
                    localVarRequestOptions.form = localVarFormParams;
                }
            }
            return new Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClass;  }>((resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1alpha1PriorityClass");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            });
        });
    }


/**
     * delete a PriorityClass
     * @param name name of the PriorityClass
     * @param pretty If \'true\', then the output is pretty printed.
     * @param dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
     * @param gracePeriodSeconds The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
     * @param orphanDependents Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object\'s finalizers list. Either this field or PropagationPolicy may be set, but not both.
     * @param propagationPolicy Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: \'Orphan\' - orphan the dependents; \'Background\' - allow the garbage collector to delete the dependents in the background; \'Foreground\' - a cascading policy that deletes all dependents in the foreground.
     * @param body
     */
public async deletePriorityClass (name: string, pretty?: string, dryRun?: string, gracePeriodSeconds?: number, orphanDependents?: boolean, propagationPolicy?: string, body?: V1DeleteOptions, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: V1Status;  }> {
        const localVarPath = this.basePath + '/apis/scheduling.k8s.io/v1alpha1/priorityclasses/{name}'
            .replace('{' + 'name' + '}', encodeURIComponent(String(name)));
        let localVarQueryParameters: any = {};
        let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
        const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'];
        // give precedence to 'application/json'
        if (produces.indexOf('application/json') >= 0) {
            localVarHeaderParams.Accept = 'application/json';
        } else {
            localVarHeaderParams.Accept = produces.join(',');
        }
        let localVarFormParams: any = {};

        // verify required parameter 'name' is not null or undefined
        if (name === null || name === undefined) {
            throw new Error('Required parameter name was null or undefined when calling deletePriorityClass.');
        }

        if (pretty !== undefined) {
            localVarQueryParameters['pretty'] = ObjectSerializer.serialize(pretty, "string");
        }

        if (dryRun !== undefined) {
            localVarQueryParameters['dryRun'] = ObjectSerializer.serialize(dryRun, "string");
        }

        if (gracePeriodSeconds !== undefined) {
            localVarQueryParameters['gracePeriodSeconds'] = ObjectSerializer.serialize(gracePeriodSeconds, "number");
        }

        if (orphanDependents !== undefined) {
            localVarQueryParameters['orphanDependents'] = ObjectSerializer.serialize(orphanDependents, "boolean");
        }

        if (propagationPolicy !== undefined) {
            localVarQueryParameters['propagationPolicy'] = ObjectSerializer.serialize(propagationPolicy, "string");
        }

        (<any>Object).assign(localVarHeaderParams, options.headers);

        let localVarUseFormData = false;

        let localVarRequestOptions: localVarRequest.Options = {
            method: 'DELETE',
            qs: localVarQueryParameters,
            headers: localVarHeaderParams,
            uri: localVarPath,
            useQuerystring: this._useQuerystring,
            json: true,
            body: ObjectSerializer.serialize(body, "V1DeleteOptions")
        };

        let authenticationPromise = Promise.resolve();
        if (this.authentications.BearerToken.apiKey) {
            authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
        }
        authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));

        let interceptorPromise = authenticationPromise;
        for (const interceptor of this.interceptors) {
            interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
        }

        return interceptorPromise.then(() => {
            if (Object.keys(localVarFormParams).length) {
                if (localVarUseFormData) {
                    (<any>localVarRequestOptions).formData = localVarFormParams;
                } else {
                    localVarRequestOptions.form = localVarFormParams;
                }
            }
            return new Promise<{ response: http.IncomingMessage; body: V1Status;  }>((resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1Status");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            });
        });
    }


/**
     * get available resources
     */
public async getAPIResources (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: V1APIResourceList;  }> {
        const localVarPath = this.basePath + '/apis/scheduling.k8s.io/v1alpha1/';
        let localVarQueryParameters: any = {};
        let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
        const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'];
        // give precedence to 'application/json'
        if (produces.indexOf('application/json') >= 0) {
            localVarHeaderParams.Accept = 'application/json';
        } else {
            localVarHeaderParams.Accept = produces.join(',');
        }
        let localVarFormParams: any = {};

        (<any>Object).assign(localVarHeaderParams, options.headers);

        let localVarUseFormData = false;

        let localVarRequestOptions: localVarRequest.Options = {
            method: 'GET',
            qs: localVarQueryParameters,
            headers: localVarHeaderParams,
            uri: localVarPath,
            useQuerystring: this._useQuerystring,
            json: true,
        };

        let authenticationPromise = Promise.resolve();
        if (this.authentications.BearerToken.apiKey) {
            authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
        }
        authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));

        let interceptorPromise = authenticationPromise;
        for (const interceptor of this.interceptors) {
            interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
        }

        return interceptorPromise.then(() => {
            if (Object.keys(localVarFormParams).length) {
                if (localVarUseFormData) {
                    (<any>localVarRequestOptions).formData = localVarFormParams;
                } else {
                    localVarRequestOptions.form = localVarFormParams;
                }
            }
            return new Promise<{ response: http.IncomingMessage; body: V1APIResourceList;  }>((resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1APIResourceList");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            });
        });
    }


/**
     * list or watch objects of kind PriorityClass
     * @param pretty If \'true\', then the output is pretty printed.
     * @param allowWatchBookmarks allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server\'s discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.
     * @param _continue The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
     * @param fieldSelector A selector to restrict the list of returned objects by their fields. Defaults to everything.
     * @param labelSelector A selector to restrict the list of returned objects by their labels. Defaults to everything.
     * @param limit limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
     * @param resourceVersion When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it\'s 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
     * @param timeoutSeconds Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
     * @param watch Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
     */
public async listPriorityClass (pretty?: string, allowWatchBookmarks?: boolean, _continue?: string, fieldSelector?: string, labelSelector?: string, limit?: number, resourceVersion?: string, timeoutSeconds?: number, watch?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClassList;  }> {
        const localVarPath = this.basePath + '/apis/scheduling.k8s.io/v1alpha1/priorityclasses';
        let localVarQueryParameters: any = {};
        let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
        const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf', 'application/json;stream=watch', 'application/vnd.kubernetes.protobuf;stream=watch'];
        // give precedence to 'application/json'
        if (produces.indexOf('application/json') >= 0) {
            localVarHeaderParams.Accept = 'application/json';
        } else {
            localVarHeaderParams.Accept = produces.join(',');
        }
        let localVarFormParams: any = {};

        if (pretty !== undefined) {
            localVarQueryParameters['pretty'] = ObjectSerializer.serialize(pretty, "string");
        }

        if (allowWatchBookmarks !== undefined) {
            localVarQueryParameters['allowWatchBookmarks'] = ObjectSerializer.serialize(allowWatchBookmarks, "boolean");
        }

        if (_continue !== undefined) {
            localVarQueryParameters['continue'] = ObjectSerializer.serialize(_continue, "string");
        }

        if (fieldSelector !== undefined) {
            localVarQueryParameters['fieldSelector'] = ObjectSerializer.serialize(fieldSelector, "string");
        }

        if (labelSelector !== undefined) {
            localVarQueryParameters['labelSelector'] = ObjectSerializer.serialize(labelSelector, "string");
        }

        if (limit !== undefined) {
            localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
        }

        if (resourceVersion !== undefined) {
            localVarQueryParameters['resourceVersion'] = ObjectSerializer.serialize(resourceVersion, "string");
        }

        if (timeoutSeconds !== undefined) {
            localVarQueryParameters['timeoutSeconds'] = ObjectSerializer.serialize(timeoutSeconds, "number");
        }

        if (watch !== undefined) {
            localVarQueryParameters['watch'] = ObjectSerializer.serialize(watch, "boolean");
        }

        (<any>Object).assign(localVarHeaderParams, options.headers);

        let localVarUseFormData = false;

        let localVarRequestOptions: localVarRequest.Options = {
            method: 'GET',
            qs: localVarQueryParameters,
            headers: localVarHeaderParams,
            uri: localVarPath,
            useQuerystring: this._useQuerystring,
            json: true,
        };

        let authenticationPromise = Promise.resolve();
        if (this.authentications.BearerToken.apiKey) {
            authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
        }
        authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));

        let interceptorPromise = authenticationPromise;
        for (const interceptor of this.interceptors) {
            interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
        }

        return interceptorPromise.then(() => {
            if (Object.keys(localVarFormParams).length) {
                if (localVarUseFormData) {
                    (<any>localVarRequestOptions).formData = localVarFormParams;
                } else {
                    localVarRequestOptions.form = localVarFormParams;
                }
            }
            return new Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClassList;  }>((resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1alpha1PriorityClassList");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            });
        });
    }


/**
     * partially update the specified PriorityClass
     * @param name name of the PriorityClass
     * @param body
     * @param pretty If \'true\', then the output is pretty printed.
     * @param dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
     * @param fieldManager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
     * @param force Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
     */
public async patchPriorityClass (name: string, body: object, pretty?: string, dryRun?: string, fieldManager?: string, force?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClass;  }> {
        const localVarPath = this.basePath + '/apis/scheduling.k8s.io/v1alpha1/priorityclasses/{name}'
            .replace('{' + 'name' + '}', encodeURIComponent(String(name)));
        let localVarQueryParameters: any = {};
        let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
        const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'];
        // give precedence to 'application/json'
        if (produces.indexOf('application/json') >= 0) {
            localVarHeaderParams.Accept = 'application/json';
        } else {
            localVarHeaderParams.Accept = produces.join(',');
        }
        let localVarFormParams: any = {};

        // verify required parameter 'name' is not null or undefined
        if (name === null || name === undefined) {
            throw new Error('Required parameter name was null or undefined when calling patchPriorityClass.');
        }

        // verify required parameter 'body' is not null or undefined
        if (body === null || body === undefined) {
            throw new Error('Required parameter body was null or undefined when calling patchPriorityClass.');
        }

        if (pretty !== undefined) {
            localVarQueryParameters['pretty'] = ObjectSerializer.serialize(pretty, "string");
        }

        if (dryRun !== undefined) {
            localVarQueryParameters['dryRun'] = ObjectSerializer.serialize(dryRun, "string");
        }

        if (fieldManager !== undefined) {
            localVarQueryParameters['fieldManager'] = ObjectSerializer.serialize(fieldManager, "string");
        }

        if (force !== undefined) {
            localVarQueryParameters['force'] = ObjectSerializer.serialize(force, "boolean");
        }

        (<any>Object).assign(localVarHeaderParams, options.headers);

        let localVarUseFormData = false;

        let localVarRequestOptions: localVarRequest.Options = {
            method: 'PATCH',
            qs: localVarQueryParameters,
            headers: localVarHeaderParams,
            uri: localVarPath,
            useQuerystring: this._useQuerystring,
            json: true,
            body: ObjectSerializer.serialize(body, "object")
        };

        let authenticationPromise = Promise.resolve();
        if (this.authentications.BearerToken.apiKey) {
            authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
        }
        authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));

        let interceptorPromise = authenticationPromise;
        for (const interceptor of this.interceptors) {
            interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
        }

        return interceptorPromise.then(() => {
            if (Object.keys(localVarFormParams).length) {
                if (localVarUseFormData) {
                    (<any>localVarRequestOptions).formData = localVarFormParams;
                } else {
                    localVarRequestOptions.form = localVarFormParams;
                }
            }
            return new Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClass;  }>((resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1alpha1PriorityClass");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            });
        });
    }


/**
     * read the specified PriorityClass
     * @param name name of the PriorityClass
     * @param pretty If \'true\', then the output is pretty printed.
     * @param exact Should the export be exact.  Exact export maintains cluster-specific fields like \'Namespace\'. Deprecated. Planned for removal in 1.18.
     * @param _export Should this value be exported.  Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18.
     */
public async readPriorityClass (name: string, pretty?: string, exact?: boolean, _export?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClass;  }> {
        const localVarPath = this.basePath + '/apis/scheduling.k8s.io/v1alpha1/priorityclasses/{name}'
            .replace('{' + 'name' + '}', encodeURIComponent(String(name)));
        let localVarQueryParameters: any = {};
        let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
        const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'];
        // give precedence to 'application/json'
        if (produces.indexOf('application/json') >= 0) {
            localVarHeaderParams.Accept = 'application/json';
        } else {
            localVarHeaderParams.Accept = produces.join(',');
        }
        let localVarFormParams: any = {};

        // verify required parameter 'name' is not null or undefined
        if (name === null || name === undefined) {
            throw new Error('Required parameter name was null or undefined when calling readPriorityClass.');
        }

        if (pretty !== undefined) {
            localVarQueryParameters['pretty'] = ObjectSerializer.serialize(pretty, "string");
        }

        if (exact !== undefined) {
            localVarQueryParameters['exact'] = ObjectSerializer.serialize(exact, "boolean");
        }

        if (_export !== undefined) {
            localVarQueryParameters['export'] = ObjectSerializer.serialize(_export, "boolean");
        }

        (<any>Object).assign(localVarHeaderParams, options.headers);

        let localVarUseFormData = false;

        let localVarRequestOptions: localVarRequest.Options = {
            method: 'GET',
            qs: localVarQueryParameters,
            headers: localVarHeaderParams,
            uri: localVarPath,
            useQuerystring: this._useQuerystring,
            json: true,
        };

        let authenticationPromise = Promise.resolve();
        if (this.authentications.BearerToken.apiKey) {
            authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
        }
        authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));

        let interceptorPromise = authenticationPromise;
        for (const interceptor of this.interceptors) {
            interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
        }

        return interceptorPromise.then(() => {
            if (Object.keys(localVarFormParams).length) {
                if (localVarUseFormData) {
                    (<any>localVarRequestOptions).formData = localVarFormParams;
                } else {
                    localVarRequestOptions.form = localVarFormParams;
                }
            }
            return new Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClass;  }>((resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1alpha1PriorityClass");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            });
        });
    }


/**
     * replace the specified PriorityClass
     * @param name name of the PriorityClass
     * @param body
     * @param pretty If \'true\', then the output is pretty printed.
     * @param dryRun When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
     * @param fieldManager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
     */
public async replacePriorityClass (name: string, body: V1alpha1PriorityClass, pretty?: string, dryRun?: string, fieldManager?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClass;  }> {
        const localVarPath = this.basePath + '/apis/scheduling.k8s.io/v1alpha1/priorityclasses/{name}'
            .replace('{' + 'name' + '}', encodeURIComponent(String(name)));
        let localVarQueryParameters: any = {};
        let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
        const produces = ['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'];
        // give precedence to 'application/json'
        if (produces.indexOf('application/json') >= 0) {
            localVarHeaderParams.Accept = 'application/json';
        } else {
            localVarHeaderParams.Accept = produces.join(',');
        }
        let localVarFormParams: any = {};

        // verify required parameter 'name' is not null or undefined
        if (name === null || name === undefined) {
            throw new Error('Required parameter name was null or undefined when calling replacePriorityClass.');
        }

        // verify required parameter 'body' is not null or undefined
        if (body === null || body === undefined) {
            throw new Error('Required parameter body was null or undefined when calling replacePriorityClass.');
        }

        if (pretty !== undefined) {
            localVarQueryParameters['pretty'] = ObjectSerializer.serialize(pretty, "string");
        }

        if (dryRun !== undefined) {
            localVarQueryParameters['dryRun'] = ObjectSerializer.serialize(dryRun, "string");
        }

        if (fieldManager !== undefined) {
            localVarQueryParameters['fieldManager'] = ObjectSerializer.serialize(fieldManager, "string");
        }

        (<any>Object).assign(localVarHeaderParams, options.headers);

        let localVarUseFormData = false;

        let localVarRequestOptions: localVarRequest.Options = {
            method: 'PUT',
            qs: localVarQueryParameters,
            headers: localVarHeaderParams,
            uri: localVarPath,
            useQuerystring: this._useQuerystring,
            json: true,
            body: ObjectSerializer.serialize(body, "V1alpha1PriorityClass")
        };

        let authenticationPromise = Promise.resolve();
        if (this.authentications.BearerToken.apiKey) {
            authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
        }
        authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));

        let interceptorPromise = authenticationPromise;
        for (const interceptor of this.interceptors) {
            interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
        }

        return interceptorPromise.then(() => {
            if (Object.keys(localVarFormParams).length) {
                if (localVarUseFormData) {
                    (<any>localVarRequestOptions).formData = localVarFormParams;
                } else {
                    localVarRequestOptions.form = localVarFormParams;
                }
            }
            return new Promise<{ response: http.IncomingMessage; body: V1alpha1PriorityClass;  }>((resolve, reject) => {
                localVarRequest(localVarRequestOptions, (error, response, body) => {
                    if (error) {
                        reject(error);
                    } else {
                        body = ObjectSerializer.deserialize(body, "V1alpha1PriorityClass");
                        if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
                            resolve({ response: response, body: body });
                        } else {
                            reject(new HttpError(response, body, response.statusCode));
                        }
                    }
                });
            });
        });
    }


function reportError(message: string) {
  console.error(require('chalk').white.bgRed.bold(message));
  process.exit(1);
}


() => {
  let exec = require('child_process').exec;
  let semver = require('semver');

  exec('npm --version',
    function(error: Error, stdout: NodeBuffer, stderr: NodeBuffer) {
      if (error !== null) {
        reportError('npm preinstall error: ' + error + stderr);
      }

      if (!semver.gte(stdout, VERSION_NPM)) {
        reportError('NPM is not in required version! Required is ' + VERSION_NPM + ' and you\'re using ' + stdout);
      }
    });

  exec('node --version',
    function(error: Error, stdout: NodeBuffer, stderr: NodeBuffer) {
      if (error !== null) {
        reportError('npm preinstall error: ' + error + stderr);
      }

      if (!semver.gte(stdout, VERSION_NODE)) {
        reportError('NODE is not in required version! Required is ' + VERSION_NODE + ' and you\'re using ' + stdout);
      }
    });
}


() => {
    return (
        <NavigationContainer>
            <AppStack.Navigator
            headerMode="none"
            screenOptions={{
                cardStyle: {
                    backgroundColor: '#f0f0f5'
                }
            }}


/**
 *
An SaaS partner can use this operation to list details about a partner event source that
 *       they have created. Amazon Web Services customers do not use this operation. Instead, Amazon Web Services customers can use DescribeEventSource
 *       to see details about a partner event source that is
 *       shared with them.

 * @example
 * Use a bare-bones client and the command you need to make an API call.
 * ```javascript
 * import { EventBridgeClient, DescribePartnerEventSourceCommand } from "@aws-sdk/client-eventbridge"; // ES Modules import
 * // const { EventBridgeClient, DescribePartnerEventSourceCommand } = require("@aws-sdk/client-eventbridge"); // CommonJS import
 * const client = new EventBridgeClient(config);
 * const command = new DescribePartnerEventSourceCommand(input);
 * const response = await client.send(command);
 * ```
 *
 * @see {@link DescribePartnerEventSourceCommandInput} for command's `input` shape.
 * @see {@link DescribePartnerEventSourceCommandOutput} for command's `response` shape.
 * @see {@link EventBridgeClientResolvedConfig | config} for EventBridgeClient's `config` shape.
 *
 */
export class DescribePartnerEventSourceCommand extends $Command<
  DescribePartnerEventSourceCommandInput,
  DescribePartnerEventSourceCommandOutput,
  EventBridgeClientResolvedConfig
> {
  // Start section: command_properties
  // End section: command_properties

  constructor(readonly input: DescribePartnerEventSourceCommandInput) {
    // Start section: command_constructor
    super();
    // End section: command_constructor
  }

  /**
   * @internal
   */
  resolveMiddleware(
    clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
    configuration: EventBridgeClientResolvedConfig,
    options?: __HttpHandlerOptions
  ): Handler<DescribePartnerEventSourceCommandInput, DescribePartnerEventSourceCommandOutput> {
    this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

    const stack = clientStack.concat(this.middlewareStack);

    const { logger } = configuration;
    const clientName = "EventBridgeClient";
    const commandName = "DescribePartnerEventSourceCommand";
    const handlerExecutionContext: HandlerExecutionContext = {
      logger,
      clientName,
      commandName,
      inputFilterSensitiveLog: DescribePartnerEventSourceRequest.filterSensitiveLog,
      outputFilterSensitiveLog: DescribePartnerEventSourceResponse.filterSensitiveLog,
    };
    const { requestHandler } = configuration;
    return stack.resolve(
      (request: FinalizeHandlerArguments<any>) =>
        requestHandler.handle(request.request as __HttpRequest, options || {}),
      handlerExecutionContext
    );
  }

  private serialize(input: DescribePartnerEventSourceCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
    return serializeAws_json1_1DescribePartnerEventSourceCommand(input, context);
  }

  private deserialize(
    output: __HttpResponse,
    context: __SerdeContext
  ): Promise<DescribePartnerEventSourceCommandOutput> {
    return deserializeAws_json1_1DescribePartnerEventSourceCommand(output, context);
  }

  // Start section: command_body_extra
  // End section: command_body_extra
}


export interface DescribePartnerEventSourceCommandInput extends DescribePartnerEventSourceRequest {}


export interface DescribePartnerEventSourceCommandOutput extends DescribePartnerEventSourceResponse, __MetadataBearer {}


/**
   * @internal
   */
resolveMiddleware(
    clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
    configuration: EventBridgeClientResolvedConfig,
    options?: __HttpHandlerOptions
  ): Handler<DescribePartnerEventSourceCommandInput, DescribePartnerEventSourceCommandOutput> {
    this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

    const stack = clientStack.concat(this.middlewareStack);

    const { logger } = configuration;
    const clientName = "EventBridgeClient";
    const commandName = "DescribePartnerEventSourceCommand";
    const handlerExecutionContext: HandlerExecutionContext = {
      logger,
      clientName,
      commandName,
      inputFilterSensitiveLog: DescribePartnerEventSourceRequest.filterSensitiveLog,
      outputFilterSensitiveLog: DescribePartnerEventSourceResponse.filterSensitiveLog,
    };
    const { requestHandler } = configuration;
    return stack.resolve(
      (request: FinalizeHandlerArguments<any>) =>
        requestHandler.handle(request.request as __HttpRequest, options || {}),
      handlerExecutionContext
    );
  }


private serialize(input: DescribePartnerEventSourceCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
    return serializeAws_json1_1DescribePartnerEventSourceCommand(input, context);
  }


private deserialize(
    output: __HttpResponse,
    context: __SerdeContext
  ): Promise<DescribePartnerEventSourceCommandOutput> {
    return deserializeAws_json1_1DescribePartnerEventSourceCommand(output, context);
  }