UNPKG

@minimaltech/ra-infra

Version:

Minimal Technology ReactJS Infrastructure

92 lines 2.56 kB
export class App { static TIMEZONE = Intl.DateTimeFormat().resolvedOptions().timeZone; static TIMEZONE_OFFSET = -(new Date().getTimezoneOffset() / 60); static DEFAULT_LOCALE = 'en.UTF-8'; static DEFAULT_DEBOUNCE_TIME = 500; } //-------------------------------------------------- export class Authentication { // Jwt static TYPE_BASIC = 'Basic'; static TYPE_BEARER = 'Bearer'; // Strategy static STRATEGY_BASIC = 'basic'; static STRATEGY_JWT = 'jwt'; } //-------------------------------------------------- export class RequestMethods { static HEAD = 'HEAD'; static OPTIONS = 'OPTIONS'; static GET = 'GET'; static POST = 'POST'; static PUT = 'PUT'; static PATCH = 'PATCH'; static DELETE = 'DELETE'; static SCHEME_SET = new Set([ this.HEAD, this.OPTIONS, this.GET, this.POST, this.PUT, this.PATCH, this.DELETE, ]); static isValid(input) { return this.SCHEME_SET.has(input); } } export class RequestTypes { static SEND = 'SEND'; // react-admin static GET_LIST = 'GET_LIST'; static GET_ONE = 'GET_ONE'; static GET_MANY = 'GET_MANY'; static GET_MANY_REFERENCE = 'GET_MANY_REFERENCE'; static CREATE = 'CREATE'; static UPDATE = 'UPDATE'; static UPDATE_MANY = 'UPDATE_MANY'; static DELETE = 'DELETE'; static DELETE_MANY = 'DELETE_MANY'; static SCHEME_SET = new Set([ this.SEND, this.GET_ONE, this.GET_LIST, this.GET_MANY, this.GET_MANY_REFERENCE, this.CREATE, this.UPDATE, this.UPDATE_MANY, this.DELETE, this.DELETE_MANY, ]); static isValid(input) { return this.SCHEME_SET.has(input); } } export class RequestBodyTypes { static NONE = 'none'; static FORM_DATA = 'form-data'; static FORM_URL_ENCODED = 'x-www-form-urlencoded'; static JSON = 'json'; static BINARY = 'binary'; static SCHEME_SET = new Set([ this.NONE, this.FORM_DATA, this.FORM_URL_ENCODED, this.JSON, this.BINARY, ]); static isValid(input) { return this.SCHEME_SET.has(input); } } //-------------------------------------------------- export class Environments { static DEVELOPMENT = 'development'; static PRODUCTION = 'production'; static SCHEME_SET = new Set([this.DEVELOPMENT, this.PRODUCTION]); static isValid(input) { return this.SCHEME_SET.has(input); } } //# sourceMappingURL=constants.js.map