UNPKG

913 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.ContextBuilder = void 0;
4const context_1 = require("./context");
5class ContextBuilder {
6 constructor() {
7 this.stack = [];
8 this.fields = [];
9 this.locations = [];
10 this.optional = false;
11 }
12 setFields(fields) {
13 this.fields = fields;
14 return this;
15 }
16 setLocations(locations) {
17 this.locations = locations;
18 return this;
19 }
20 setMessage(message) {
21 this.message = message;
22 return this;
23 }
24 addItem(...items) {
25 this.stack.push(...items);
26 return this;
27 }
28 setOptional(options) {
29 this.optional = options;
30 return this;
31 }
32 build() {
33 return new context_1.Context(this.fields, this.locations, this.stack, this.optional, this.message);
34 }
35}
36exports.ContextBuilder = ContextBuilder;