"use strict";
var _a;
exports.__esModule = true;
exports.DEFAULT_MIGRATION_CONTENT = exports.DEFAULT_MIGRATION_SCRIPT_NAME = exports.NEW_LINE = exports.PERMIT_CRUD = exports.PERMIT_DELETE = exports.PERMIT_UPDATE = exports.PERMIT_READ = exports.PERMIT_CREATE = exports.BAD_GRPC_BIND = exports.BAD_CONFIG_COMPLEX_RESOURCE = exports.UNSUPPORTED_CHARACTER_IN_DB = exports.UNIQUE_RECORD_NOT_FOUND_WITH_KEYS = exports.NON_RETURNING_FAILURE_RESPONSE = exports.NON_RETURNING_SUCCESS_RESPONSE = exports.COMPLEX_RESOLVER_SEPERATOR = exports.SERVICE_RESOURCE_NOT_FOUND_BODY = exports.SERVICE_VERSION = exports.DEFAULT_PAGINATION_LIMIT = exports.REGEX_NON_DIGIT = exports.REGEX_CHAR = exports.HEADER_COUNT = exports.HEADER_GET_COUNT = exports.HEADER_SQL = exports.HEADER_GET_SQL = exports.HEADER_REQUEST_ID = exports.SERVICE = exports.DEBUG = exports.URL_ROOT_SERVICE = exports.STARTUP_FAILED = exports.DB_CALL_FAILED = exports.RESOURCE_CALL = exports.RESOURCE_RESPONSE = exports.VALIDATION_ERROR = exports.CONTEXT_ERRORS = exports.BASIC_QUERY_OPERATIONS = exports.DD_BASE = exports.SRID = exports.SEARCH_QUERY_CONTEXT_DESCRIPTION = exports.SEARCH_SUBQUERY_CONTEXT = exports.SEARCH_QUERY_CONTEXT = exports.REQUIRED_FLAG = exports.FALSEY_STRING_VALUES = exports.SYMBOL_CREATE_DISABLED = exports.SYMBOL_CREATE_REQUIRED = exports.SYMBOL_UPDATE_DISABLED = exports.SYMBOL_UNIQUE_KEY_COMPONENT = exports.SYMBOL_SOFT_DELETE = exports.SYMBOLS_GEO_CIRCLE = exports.SYMBOLS_GEO_POLYGON = exports.SYMBOLS_GEO_PATH = exports.SYMBOLS_GEO_BOX = exports.SYMBOLS_GEO_LSEG = exports.SYMBOLS_GEO_LINE = exports.SYMBOLS_GEO_POINT = exports.SYMBOL_GEOQUERY_CIRCLE = exports.SYMBOL_GEOQUERY_POLYGON = exports.SYMBOL_GEOQUERY_PATH = exports.SYMBOL_GEOQUERY_BOX = exports.SYMBOL_GEOQUERY_LSEG = exports.SYMBOL_GEOQUERY_LINE = exports.SYMBOL_GEOQUERY_POINT = exports.SYMBOL_GEOQUERY = exports.SYMBOL_JSON = exports.DEFINED_ARG_LENGTHS = exports.SUPPORTED_OPERATIONS = exports.SEPERATOR = exports.PIPE_SEPERATOR = exports.GEOMETRYCOLLECTION = exports.MULTIPOLYGON = exports.MULTILINESTRING = exports.MULTIPOINT = exports.LINESTRING = exports.GEOMETRY = exports.YEAR = exports.INTEGER = exports.INT = exports.MEDIUMINT = exports.SMALLINT = exports.TINYINT = exports.BIT = exports.JSONB = exports.JSON = exports.GEO_POLYGON = exports.GEO_RADIUS = exports.GEO_BBOX = exports.NOT_NULL = exports.NULL = exports.NOT_IN = exports.IN = exports.NOT_RANGE = exports.RANGE = exports.POLYGON = exports.POINT = exports.ASC = exports.DESC = exports.NOTWHERE = exports.LIMIT = exports.PAGE = exports.DISTINCT = exports.ORDERBY = exports.FIELDS = exports.QUOTED_VALUE = exports.EQUAL = exports.BOOLEAN = exports.NUMBER = exports.STRING = exports.COLON = exports.COMMA = exports.EMPTY_STRING = exports.PIPE = exports.DOT = exports.CHILDREN = exports.UNDERSCORE_INNER = exports.UNDERSCORE_BYKEY = exports.UNDERSCORE_IDS = exports.PATCH = exports.PUT = exports.POST = exports.GET = exports.SUBQUERY = exports.SEARCH = exports.DELETE = exports.UPDATE = exports.READ = exports.CREATE = exports.DEFAULT_REST_PORT = exports.DEFAULT_GRPC_PORT = void 0;
exports.DEFAULT_GRPC_PORT = 50051;
exports.DEFAULT_REST_PORT = 8080;
exports.CREATE = "create";
exports.READ = "read";
exports.UPDATE = "update";
exports.DELETE = "delete";
exports.SEARCH = "search";
exports.SUBQUERY = "subquery";
exports.GET = "GET";
exports.POST = "POST";
exports.PUT = "PUT";
exports.PATCH = "PATCH";
exports.UNDERSCORE_IDS = "_ids";
exports.UNDERSCORE_BYKEY = "_byKey";
exports.UNDERSCORE_INNER = "_inner";
exports.CHILDREN = "children";
exports.DOT = ".";
exports.PIPE = "|";
exports.EMPTY_STRING = "";
exports.COMMA = ",";
exports.COLON = ":";
exports.STRING = "string";
exports.NUMBER = "number";
exports.BOOLEAN = "boolean";
exports.EQUAL = "equal";
exports.QUOTED_VALUE = '"value"';
exports.FIELDS = "fields";
exports.ORDERBY = "orderBy";
exports.DISTINCT = "distinct";
exports.PAGE = "page";
exports.LIMIT = "limit";
exports.NOTWHERE = "notWhere";
exports.DESC = "desc";
exports.ASC = "asc";
exports.POINT = "point";
exports.POLYGON = "polygon";
exports.RANGE = "range";
exports.NOT_RANGE = "not_range";
exports.IN = "in";
exports.NOT_IN = "not_in";
exports.NULL = "null";
exports.NOT_NULL = "not_null";
exports.GEO_BBOX = "geo_bbox";
exports.GEO_RADIUS = "geo_radius";
exports.GEO_POLYGON = "geo_polygon";
exports.JSON = "json";
exports.JSONB = "jsonb";
exports.BIT = "bit";
exports.TINYINT = "tinyint";
exports.SMALLINT = "smallint";
exports.MEDIUMINT = "mediumint";
exports.INT = "int";
exports.INTEGER = "integer";
exports.YEAR = "year";
exports.GEOMETRY = "geometry";
exports.LINESTRING = "linestring";
exports.MULTIPOINT = "multipoint";
exports.MULTILINESTRING = "multilinestring";
exports.MULTIPOLYGON = "multipolygon";
exports.GEOMETRYCOLLECTION = "geometrycollection";
exports.PIPE_SEPERATOR = "|seperator";
exports.SEPERATOR = "seperator";
// values are weither they support multiple values seperated by commas
exports.SUPPORTED_OPERATIONS = (_a = {},
    _a[exports.EQUAL] = false,
    _a.gt = false,
    _a.gte = false,
    _a.lt = false,
    _a.lte = false,
    _a.not = false,
    _a.like = false,
    _a["null"] = false,
    _a.not_null = false,
    _a["in"] = true,
    _a.not_in = true,
    _a.range = true,
    _a.not_range = true,
    _a.geo_bbox = true,
    _a.geo_radius = true,
    _a.geo_polygon = false,
    _a);
exports.DEFINED_ARG_LENGTHS = {
    range: 2,
    not_range: 2,
    geo_bbox: 4,
    geo_radius: 3
};
exports.SYMBOL_JSON = Symbol("json");
exports.SYMBOL_GEOQUERY = Symbol("geoquery");
exports.SYMBOL_GEOQUERY_POINT = Symbol("geoquery-point");
exports.SYMBOL_GEOQUERY_LINE = Symbol("geoquery-line");
exports.SYMBOL_GEOQUERY_LSEG = Symbol("geoquery-lseg");
exports.SYMBOL_GEOQUERY_BOX = Symbol("geoquery-box");
exports.SYMBOL_GEOQUERY_PATH = Symbol("geoquery-path");
exports.SYMBOL_GEOQUERY_POLYGON = Symbol("geoquery-polygon");
exports.SYMBOL_GEOQUERY_CIRCLE = Symbol("geoquery-circle");
exports.SYMBOLS_GEO_POINT = [exports.SYMBOL_GEOQUERY, exports.SYMBOL_GEOQUERY_POINT];
exports.SYMBOLS_GEO_LINE = [exports.SYMBOL_GEOQUERY, exports.SYMBOL_GEOQUERY_LINE];
exports.SYMBOLS_GEO_LSEG = [exports.SYMBOL_GEOQUERY, exports.SYMBOL_GEOQUERY_LSEG];
exports.SYMBOLS_GEO_BOX = [exports.SYMBOL_GEOQUERY, exports.SYMBOL_GEOQUERY_BOX];
exports.SYMBOLS_GEO_PATH = [exports.SYMBOL_GEOQUERY, exports.SYMBOL_GEOQUERY_PATH];
exports.SYMBOLS_GEO_POLYGON = [exports.SYMBOL_GEOQUERY, exports.SYMBOL_GEOQUERY_POLYGON];
exports.SYMBOLS_GEO_CIRCLE = [exports.SYMBOL_GEOQUERY, exports.SYMBOL_GEOQUERY_CIRCLE];
exports.SYMBOL_SOFT_DELETE = Symbol("soft_delete");
exports.SYMBOL_UNIQUE_KEY_COMPONENT = Symbol("symbol_unique_key_component");
exports.SYMBOL_UPDATE_DISABLED = Symbol("update_disabled");
exports.SYMBOL_CREATE_REQUIRED = Symbol("create_required");
exports.SYMBOL_CREATE_DISABLED = Symbol("create_disabled");
exports.FALSEY_STRING_VALUES = ["", "f", "false", "0"];
exports.REQUIRED_FLAG = { presence: "required" };
exports.SEARCH_QUERY_CONTEXT = {
    fields: undefined,
    seperator: exports.COMMA,
    notWhere: undefined,
    statementContext: "and",
    orderBy: undefined,
    distinct: undefined,
    page: undefined,
    limit: undefined
};
exports.SEARCH_SUBQUERY_CONTEXT = {
    seperator: exports.COMMA,
    notWhere: undefined,
    statementContext: "and"
};
exports.SEARCH_QUERY_CONTEXT_DESCRIPTION = {
    fields: "record fields to return in results",
    seperator: "character to be used as seperator in context & operations values. default is pipe `|`",
    notWhere: "SQL query context. Apply query components to where OR get the inverse. Default is false.",
    statementContext: "SQL query context. Apply query components all together (and each) OR select any matching (OR).",
    orderBy: "seperated list of orderBy fields + direction (field desc || field asc). acs is default.",
    distinct: "return distinct records from result set",
    page: "pagination page",
    limit: "pagination limit",
    "x-get-count": "Request Search Query count(*) be sent back in a response header.",
    "x-get-sql": "Request plaintext SQL be sent back in a response header."
};
exports.SRID = 4326;
exports.DD_BASE = 1113200;
exports.BASIC_QUERY_OPERATIONS = new Map();
exports.BASIC_QUERY_OPERATIONS.set("gt", ">");
exports.BASIC_QUERY_OPERATIONS.set("gte", ">=");
exports.BASIC_QUERY_OPERATIONS.set("lt", "<");
exports.BASIC_QUERY_OPERATIONS.set("lte", "<=");
exports.BASIC_QUERY_OPERATIONS.set("equal", "=");
exports.BASIC_QUERY_OPERATIONS.set("like", "like");
exports.BASIC_QUERY_OPERATIONS.set("not", "<>");
exports.CONTEXT_ERRORS = "context_errors";
exports.VALIDATION_ERROR = "validation_error";
exports.RESOURCE_RESPONSE = "resource_response";
exports.RESOURCE_CALL = "resource_call";
exports.DB_CALL_FAILED = "db_call_failed";
exports.STARTUP_FAILED = "startup_failed";
exports.URL_ROOT_SERVICE = "/service";
exports.DEBUG = "debug";
exports.SERVICE = "service";
exports.HEADER_REQUEST_ID = "x-request-id";
exports.HEADER_GET_SQL = "x-get-sql";
exports.HEADER_SQL = "x-sql";
exports.HEADER_GET_COUNT = "x-get-count";
exports.HEADER_COUNT = "x-count";
exports.REGEX_CHAR = /(character|varchar|nchar|varying)\((?<len>\d+)\)/;
exports.REGEX_NON_DIGIT = /\D/g;
exports.DEFAULT_PAGINATION_LIMIT = 250;
exports.SERVICE_VERSION = process.env.APP_VERSION || process.env.npm_package_version || "99.98.976"; // get app version
exports.SERVICE_RESOURCE_NOT_FOUND_BODY = {
    message: "use the checklist below to determine why you have received this response",
    checklist: [
        "db resource (table, view, matView) must exist",
        "db resources are enabled via configured permissions: check systemPermissions & resourcePermissions",
        "category must be \"debug\" or \"service\"",
        "url structure \"/:category/:resource/record\" does not have a trailing slash",
        "HTTP method does not map to supported db CRUD operation for this resource",
    ]
};
exports.COMPLEX_RESOLVER_SEPERATOR = "_subquery_";
exports.NON_RETURNING_SUCCESS_RESPONSE = { success: true };
exports.NON_RETURNING_FAILURE_RESPONSE = { success: false };
exports.UNIQUE_RECORD_NOT_FOUND_WITH_KEYS = "Unique Record Not Found with those keys";
exports.UNSUPPORTED_CHARACTER_IN_DB = "DB resource name or field contains character unsupported in GraphQL SDL (schema definition language). Supported characters are limited to `[0-9a-zA-Z_]` in all three `fieldsOfConcern`. Review each field within the `problemResources` records. Solutions would include updating the DDL to a name that is supported of omitting the resource from this service via a startup config";
exports.BAD_CONFIG_COMPLEX_RESOURCE = "one of the resources provided for a complexResource does not exist. Make sure both are reflected in the DB as tables, views or materialized views. They must exist at boot so this system can auto generate the appropriate JOI validators -- which drive all of the REST & GraphQL interfaces (and auto documentation)";
exports.BAD_GRPC_BIND = "gRPC Service not bound to ports";
exports.PERMIT_CREATE = 1;
exports.PERMIT_READ = 2;
exports.PERMIT_UPDATE = 4;
exports.PERMIT_DELETE = 8;
// tslint:disable: no-bitwise
exports.PERMIT_CRUD = exports.PERMIT_CREATE | exports.PERMIT_READ | exports.PERMIT_UPDATE | exports.PERMIT_DELETE;
exports.NEW_LINE = "\n        ";
exports.DEFAULT_MIGRATION_SCRIPT_NAME = "migration_by_sql_dir";
exports.DEFAULT_MIGRATION_CONTENT = {
    up: [],
    down: []
};
//# sourceMappingURL=const.js.map