UNPKG

harperdb

Version:

HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.

8 lines 838 kB
#!/usr/bin/env node "use strict";var O2=Object.create;var Of=Object.defineProperty;var N2=Object.getOwnPropertyDescriptor;var w2=Object.getOwnPropertyNames;var I2=Object.getPrototypeOf,C2=Object.prototype.hasOwnProperty;var a=(e,t)=>Of(e,"name",{value:t,configurable:!0});var be=(e,t)=>()=>(e&&(t=e(e=0)),t);var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Be=(e,t)=>{for(var r in t)Of(e,r,{get:t[r],enumerable:!0})},pD=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of w2(t))!C2.call(e,s)&&s!==r&&Of(e,s,{get:()=>t[s],enumerable:!(n=N2(t,s))||n.enumerable});return e};var M=(e,t,r)=>(r=e!=null?O2(I2(e)):{},pD(t||!e||!e.__esModule?Of(r,"default",{value:e,enumerable:!0}):r,e)),D=e=>pD(Of({},"__esModule",{value:!0}),e);var it=P((Qye,ED)=>{var{join:P2,dirname:hD}=require("node:path"),{existsSync:D2,readFileSync:L2}=require("node:fs");function M2(){let t=__dirname,r,n=0;for(;!D2(r=P2(t,"package.json"));)if(t===(t=hD(t))||n++>10)throw new Error("Could not find package root");return r}a(M2,"findPackageJson");var mD=M2(),v2=JSON.parse(L2(mD,"utf8")),U2=hD(mD);ED.exports={packageJson:v2,PACKAGE_ROOT:U2}});var om=P((Zye,gD)=>{if(__filename.endsWith("dev.js")){let e=require("fast-glob"),{tmpdir:t}=require("node:os"),{relative:r,join:n}=require("node:path"),{existsSync:s,statSync:i,readFileSync:o,writeFileSync:c,unlinkSync:l}=require("node:fs"),{isMainThread:u}=require("node:worker_threads"),{spawnSync:f,spawn:d}=require("node:child_process");process.setSourceMapsEnabled(!0);let{PACKAGE_ROOT:p}=it(),_=["bin","components","dataLayer","resources","server","sqlTranslator","upgrade","utility","validation"],h="ts-build";if(u){let R=!1,E=!1;if(E=s(n(p,h))){let T=new Set;e.sync(_.map(O=>`${O}/**/*.ts`),{cwd:p}).forEach(O=>{let v=0,F=0;try{T.add(O),v=i(n(p,O)).mtimeMs-5e3,F=i(n(p,h,O.replace(/.ts$/,".js"))).mtimeMs}catch{}v>F&&(R=!0)}),e.sync(_.map(O=>`${O}/**/*.js`),{cwd:n(p,h)}).forEach(O=>{if(!T.has(O.replace(/.js$/,".ts")))try{l(n(p,h,O))}catch{}})}else R=!0;if(R){console.log("Compiling TypeScript...");let T=f("npx",["tsc"],{cwd:p});if(T.stdout?.length&&console.log(T.stdout.toString()),T.stderr?.length&&console.log(T.stderr.toString()),E){let O=n(t(),"harperdb-tsc.pid"),v=!1;if(s(O))try{process.kill(+o(O,"utf8"),0),v=!0}catch{}if(!v){console.log("Starting background TypeScript compilation...");let F=d("npx",["tsc","--watch"],{detached:!0,cwd:p,stdio:"ignore"});F.on("error",$=>{console.error("Error trying to compile TypeScript",$)}),F.pid&&c(O,String(F.pid),"utf-8"),F.unref()}}}}let S=gD.constructor,g=S._findPath;S._findPath=function(R,E,T){if(R.startsWith(".")&&!T&&E.length===1&&E[0].startsWith(p)&&!E[0].includes("node_modules")){let O=r(p,E[0]),v;O.startsWith(h)?v=n(p,r(h,O)):v=n(p,h,O);let F=n(v,R),$=F+".js";if(s($))return $;if(F.includes(".")&&s(F))return F}return g(R,E,T)}}});var q={};Be(q,{AUTH_AUDIT_STATUS:()=>Xs,AUTH_AUDIT_TYPES:()=>pa,BOOT_PROPS_FILE_NAME:()=>oQ,BOOT_PROP_PARAMS:()=>AD,CLUSTERING_FLAG:()=>LQ,CLUSTERING_PROCESSES:()=>K2,CLUSTER_MESSAGE_TYPE_ENUM:()=>sR,CLUSTER_OPERATIONS:()=>RQ,CONFIG_PARAMS:()=>B,CONFIG_PARAM_MAP:()=>RD,DATABASES_DIR_NAME:()=>Lc,DATABASES_PARAM_CONFIG:()=>NQ,DEFAULT_DATABASE_NAME:()=>W2,ESCAPED_FORWARD_SLASH_REGEX:()=>nQ,FORWARD_SLASH_REGEX:()=>tQ,FUNC_VAL:()=>HQ,GEO_CONVERSION_ENUM:()=>bQ,HDB_COMPONENT_CONFIG_FILE:()=>H2,HDB_CONFIG_FILE:()=>x2,HDB_DEFAULT_CONFIG_FILE:()=>B2,HDB_FILE_PERMISSIONS:()=>cQ,HDB_HOME_DIR_NAME:()=>iQ,HDB_PID_FILE:()=>Y2,HDB_PROCESS_SERVICES:()=>V2,HDB_PROC_NAME:()=>k2,HDB_RESTART_SCRIPT:()=>F2,HDB_ROOT_DIR_NAME:()=>ZA,HDB_SETTINGS_NAMES:()=>nR,HDB_SUPPORT_ADDRESS:()=>TD,INFO_TABLE_HASH_ATTRIBUTE:()=>pQ,INSERT_MAX_CHARACTER_SIZE:()=>fQ,INSTALL_PROMPTS:()=>dQ,ITC_EVENT_TYPES:()=>oR,JOB_STATUS_ENUM:()=>gQ,JOB_TYPE_ENUM:()=>wQ,JWT_ENUM:()=>wf,LAUNCH_SERVICE_SCRIPTS:()=>J2,LEGACY_CONFIG_PARAMS:()=>OQ,LEGACY_DATABASES_DIR_NAME:()=>lm,LICENSE_FILE_NAME:()=>EQ,LICENSE_KEY_DIR_NAME:()=>rR,LICENSE_VALUES:()=>IQ,LOG_LEVELS:()=>j2,LOG_NAMES:()=>z2,MEM_SETTING_KEY:()=>sQ,METADATA_PROPERTY:()=>DQ,NODE_ERROR_CODES:()=>PQ,OPERATIONS_ENUM:()=>zt,PERMS_CRUD_ENUM:()=>xQ,PERMS_UPDATE_RELEASE_TIMESTAMP:()=>UQ,PRE_4_0_0_VERSION:()=>kQ,PROCESS_DESCRIPTORS:()=>$2,PROCESS_NAME_ENV_PROP:()=>uQ,RAM_ALLOCATION_ENUM:()=>CQ,READ_AUDIT_LOG_SEARCH_TYPES_ENUM:()=>dm,REG_KEY_FILE_NAME:()=>mQ,RESTART_TIMEOUT_MS:()=>aQ,ROLE_TYPES_ENUM:()=>Q2,S3_BUCKET_AUTH_KEYS:()=>TQ,SEARCH_NOT_FOUND_MESSAGE:()=>Z2,SEARCH_WILDCARDS:()=>BQ,SERVICE_ACTIONS_ENUM:()=>yQ,SUPPORT_HELP_MSG:()=>X2,SYSTEM_DEFAULT_ATTRIBUTE_NAMES:()=>hQ,SYSTEM_SCHEMA_NAME:()=>Nf,SYSTEM_TABLE_NAMES:()=>_u,THREAD_TYPES:()=>aR,TIME_STAMP_NAMES:()=>vQ,TIME_STAMP_NAMES_ENUM:()=>MQ,TRANSACTIONS_DIR_NAME:()=>lQ,UNICODE_FORWARD_SLASH:()=>rQ,UNICODE_PERIOD:()=>eQ,UPGRADE_JSON_FIELD_NAMES_ENUM:()=>_Q,VALID_S3_FILE_TYPES:()=>SQ,VALID_SQL_OPS_ENUM:()=>AQ,VALUE_SEARCH_COMPARATORS:()=>um,VALUE_SEARCH_COMPARATORS_REVERSE_LOOKUP:()=>iR});var am,cm,x2,B2,ZA,H2,k2,F2,SD,XA,eR,tR,G2,q2,$2,V2,K2,Y2,W2,z2,j2,J2,Q2,TD,X2,Z2,eQ,tQ,rQ,nQ,sQ,Nf,iQ,rR,oQ,aQ,cQ,Lc,lm,lQ,uQ,AD,dQ,fQ,_Q,_u,pQ,hQ,mQ,EQ,gQ,zt,SQ,TQ,AQ,RQ,yQ,bQ,nR,OQ,B,RD,NQ,wQ,sR,IQ,CQ,PQ,DQ,LQ,yD,bD,MQ,vQ,UQ,um,iR,xQ,BQ,HQ,dm,wf,oR,aR,kQ,Xs,pa,G=be(()=>{am=require("node:path"),cm=M(it()),x2="harperdb-config.yaml",B2="defaultConfig.yaml",ZA="hdb",H2="config.yaml",k2="harperdb.js",F2="restartHdb.js",SD="HarperDB",XA="Custom Functions",eR="Clustering Hub",tR="Clustering Leaf",G2="Clustering Ingest Service",q2="Clustering Reply Service",$2={HDB:SD,CLUSTERING_HUB:eR,CLUSTERING_LEAF:tR,CLUSTERING_INGEST_SERVICE:G2,CLUSTERING_REPLY_SERVICE:q2,CUSTOM_FUNCTIONS:XA,RESTART_HDB:"Restart HDB",INSTALL:"Install",RUN:"Run",STOP:"Stop",UPGRADE:"Upgrade",REGISTER:"Register",JOB:"Job",CLUSTERING_UPGRADE_4_0_0:"Upgrade-4-0-0"},V2={harperdb:SD,"clustering hub":eR,"clustering leaf":tR,"custom functions":XA,custom_functions:XA,clustering:"clustering","clustering config":"clustering config",clustering_config:"clustering_config",http_workers:"http_workers",http:"http"},K2={CLUSTERING_HUB_PROC_DESCRIPTOR:eR,CLUSTERING_LEAF_PROC_DESCRIPTOR:tR},Y2="hdb.pid",W2="data",z2={HDB:"hdb.log",INSTALL:"install.log",CLUSTERING_HUB:"clustering_hub.log",CLUSTERING_LEAF:"clustering_leaf.log"},j2={NOTIFY:"notify",FATAL:"fatal",ERROR:"error",WARN:"warn",INFO:"info",DEBUG:"debug",TRACE:"trace"},J2={MAIN:"bin/harperdb.js",NATS_INGEST_SERVICE:(0,am.join)(cm.PACKAGE_ROOT,"launchServiceScripts/launchNatsIngestService.js"),NATS_REPLY_SERVICE:(0,am.join)(cm.PACKAGE_ROOT,"launchServiceScripts/launchNatsReplyService.js"),NODES_UPGRADE_4_0_0:(0,am.join)(cm.PACKAGE_ROOT,"launchServiceScripts/launchUpdateNodes4-0-0.js")},Q2={SUPER_USER:"super_user",CLUSTER_USER:"cluster_user"},TD="support@harperdb.io",X2=`For support, please submit a request at https://harperdbhelp.zendesk.com/hc/en-us/requests/new or contact ${TD}`,Z2="None of the specified records were found.",eQ="U+002E",tQ=/\//g,rQ="U+002F",nQ=/U\+002F/g,sQ="--max-old-space-size=",Nf="system",iQ=".harperdb",rR="keys",oQ="hdb_boot_properties.file",aQ=6e4,cQ=448,Lc="database",lm="schema",lQ="transactions",uQ="PROCESS_NAME",AD={SETTINGS_PATH_KEY:"settings_path"},dQ={TC_AGREEMENT:"TC_AGREEMENT",CLUSTERING_USER:"CLUSTERING_USER",CLUSTERING_PASSWORD:"CLUSTERING_PASSWORD",HDB_ADMIN_USERNAME:"HDB_ADMIN_USERNAME",HDB_ADMIN_PASSWORD:"HDB_ADMIN_PASSWORD",OPERATIONSAPI_ROOT:"OPERATIONSAPI_ROOT",ROOTPATH:"ROOTPATH",CLUSTERING_NODENAME:"CLUSTERING_NODENAME",CLUSTERING_ENABLED:"CLUSTERING_ENABLED",HDB_CONFIG:"HDB_CONFIG",DEFAULTS_MODE:"DEFAULTS_MODE",REPLICATION_HOSTNAME:"REPLICATION_HOSTNAME",CLUSTERING_PORT:"CLUSTERING_PORT",HDB_ROOT:"HDB_ROOT",SERVER_PORT:"SERVER_PORT",NODE_NAME:"NODE_NAME",CLUSTERING:"CLUSTERING"},fQ=250,_Q={DATA_VERSION:"data_version",UPGRADE_VERSION:"upgrade_version"},_u={JOB_TABLE_NAME:"hdb_job",NODE_TABLE_NAME:"hdb_nodes",ATTRIBUTE_TABLE_NAME:"hdb_attribute",LICENSE_TABLE_NAME:"hdb_license",ROLE_TABLE_NAME:"hdb_role",SCHEMA_TABLE_NAME:"hdb_schema",TABLE_TABLE_NAME:"hdb_table",USER_TABLE_NAME:"hdb_user",INFO_TABLE_NAME:"hdb_info"},pQ="info_id",hQ={ATTR_ATTRIBUTE_KEY:"attribute",ATTR_CREATEDDATE_KEY:"createddate",ATTR_HASH_ATTRIBUTE_KEY:"hash_attribute",ATTR_ID_KEY:"id",ATTR_NAME_KEY:"name",ATTR_PASSWORD_KEY:"password",ATTR_RESIDENCE_KEY:"residence",ATTR_ROLE_KEY:"role",ATTR_SCHEMA_KEY:"schema",ATTR_SCHEMA_TABLE_KEY:"schema_table",ATTR_TABLE_KEY:"table",ATTR_USERNAME_KEY:"username"},mQ="060493.ks",EQ=".license",gQ={CREATED:"CREATED",IN_PROGRESS:"IN_PROGRESS",COMPLETE:"COMPLETE",ERROR:"ERROR"},zt={INSERT:"insert",UPDATE:"update",UPSERT:"upsert",SEARCH_BY_CONDITIONS:"search_by_conditions",SEARCH_BY_HASH:"search_by_hash",SEARCH_BY_ID:"search_by_id",SEARCH_BY_VALUE:"search_by_value",SEARCH:"search",SQL:"sql",CSV_DATA_LOAD:"csv_data_load",CSV_FILE_LOAD:"csv_file_load",CSV_URL_LOAD:"csv_url_load",CREATE_SCHEMA:"create_schema",CREATE_DATABASE:"create_database",CREATE_TABLE:"create_table",CREATE_ATTRIBUTE:"create_attribute",DROP_SCHEMA:"drop_schema",DROP_DATABASE:"drop_database",DROP_TABLE:"drop_table",DESCRIBE_SCHEMA:"describe_schema",DESCRIBE_DATABASE:"describe_database",DESCRIBE_TABLE:"describe_table",DESCRIBE_ALL:"describe_all",DELETE:"delete",ADD_USER:"add_user",ALTER_USER:"alter_user",DROP_USER:"drop_user",LIST_USERS:"list_users",LIST_ROLES:"list_roles",ADD_ROLE:"add_role",ALTER_ROLE:"alter_role",DROP_ROLE:"drop_role",USER_INFO:"user_info",READ_LOG:"read_log",ADD_NODE:"add_node",UPDATE_NODE:"update_node",SET_NODE_REPLICATION:"set_node_replication",EXPORT_TO_S3:"export_to_s3",IMPORT_FROM_S3:"import_from_s3",DELETE_FILES_BEFORE:"delete_files_before",DELETE_RECORDS_BEFORE:"delete_records_before",EXPORT_LOCAL:"export_local",SEARCH_JOBS_BY_START_DATE:"search_jobs_by_start_date",GET_JOB:"get_job",DELETE_JOB:"delete_job",UPDATE_JOB:"update_job",GET_FINGERPRINT:"get_fingerprint",SET_LICENSE:"set_license",GET_REGISTRATION_INFO:"registration_info",CONFIGURE_CLUSTER:"configure_cluster",SET_CONFIGURATION:"set_configuration",CLUSTER_STATUS:"cluster_status",CLUSTER_NETWORK:"cluster_network",DROP_ATTRIBUTE:"drop_attribute",REMOVE_NODE:"remove_node",RESTART:"restart",RESTART_SERVICE:"restart_service",CATCHUP:"catchup",SYSTEM_INFORMATION:"system_information",DELETE_AUDIT_LOGS_BEFORE:"delete_audit_logs_before",READ_AUDIT_LOG:"read_audit_log",CREATE_AUTHENTICATION_TOKENS:"create_authentication_tokens",LOGIN:"login",LOGOUT:"logout",REFRESH_OPERATION_TOKEN:"refresh_operation_token",GET_CONFIGURATION:"get_configuration",CUSTOM_FUNCTIONS_STATUS:"custom_functions_status",GET_CUSTOM_FUNCTIONS:"get_custom_functions",GET_CUSTOM_FUNCTION:"get_custom_function",SET_CUSTOM_FUNCTION:"set_custom_function",GET_COMPONENTS:"get_components",GET_COMPONENT_FILE:"get_component_file",SET_COMPONENT_FILE:"set_component_file",DROP_COMPONENT:"drop_component",DROP_CUSTOM_FUNCTION:"drop_custom_function",ADD_CUSTOM_FUNCTION_PROJECT:"add_custom_function_project",ADD_COMPONENT:"add_component",DROP_CUSTOM_FUNCTION_PROJECT:"drop_custom_function_project",PACKAGE_CUSTOM_FUNCTION_PROJECT:"package_custom_function_project",DEPLOY_CUSTOM_FUNCTION_PROJECT:"deploy_custom_function_project",PACKAGE_COMPONENT:"package_component",DEPLOY_COMPONENT:"deploy_component",CLUSTER_SET_ROUTES:"cluster_set_routes",CLUSTER_DELETE_ROUTES:"cluster_delete_routes",CLUSTER_GET_ROUTES:"cluster_get_routes",READ_TRANSACTION_LOG:"read_transaction_log",DELETE_TRANSACTION_LOGS_BEFORE:"delete_transaction_logs_before",INSTALL_NODE_MODULES:"install_node_modules",AUDIT_NODE_MODULES:"audit_node_modules",PURGE_STREAM:"purge_stream",GET_BACKUP:"get_backup",SIGN_CERTIFICATE:"sign_certificate",CREATE_CSR:"create_csr",LIST_CERTIFICATES:"list_certificates",ADD_CERTIFICATES:"add_certificate",REMOVE_CERTIFICATE:"remove_certificate",ADD_NODE_BACK:"add_node_back",REMOVE_NODE_BACK:"remove_node_back",ADD_SSH_KEY:"add_ssh_key",UPDATE_SSH_KEY:"update_ssh_key",DELETE_SSH_KEY:"delete_ssh_key",LIST_SSH_KEYS:"list_ssh_keys",SET_SSH_KNOWN_HOSTS:"set_ssh_known_hosts",GET_SSH_KNOWN_HOSTS:"get_ssh_known_hosts",GET_KEY:"get_key"},SQ={CSV:".csv",JSON:".json"},TQ={AWS_ACCESS_KEY:"aws_access_key_id",AWS_SECRET:"aws_secret_access_key",AWS_BUCKET:"bucket",AWS_FILE_KEY:"key",REGION:"region"},AQ={SELECT:"select",INSERT:"insert",UPDATE:"update",DELETE:"delete"},RQ={[zt.INSERT]:zt.INSERT,[zt.UPDATE]:zt.UPDATE,[zt.UPSERT]:zt.UPSERT,[zt.DELETE]:zt.DELETE},yQ={DEV:"dev",RUN:"run",START:"start",INSTALL:"install",REGISTER:"register",STOP:"stop",RESTART:"restart",VERSION:"version",UPGRADE:"upgrade",HELP:"help",STATUS:"status",OPERATION:"operation",RENEWCERTS:"renew-certs",COPYDB:"copy-db"},bQ={point:"point",lineString:"lineString",multiLineString:"multiLineString",multiPoint:"multiPoint",multiPolygon:"multiPolygon",polygon:"polygon"},nR={HDB_ROOT_KEY:"HDB_ROOT",SERVER_PORT_KEY:"SERVER_PORT",CERT_KEY:"CERTIFICATE",PRIVATE_KEY_KEY:"PRIVATE_KEY",HTTP_SECURE_ENABLED_KEY:"HTTPS_ON",CORS_ENABLED_KEY:"CORS_ON",CORS_WHITELIST_KEY:"CORS_WHITELIST",LOG_LEVEL_KEY:"LOG_LEVEL",LOGGER_KEY:"LOGGER",LOG_PATH_KEY:"LOG_PATH",LOG_ROTATE:"LOG_ROTATE",LOG_ROTATE_MAX_SIZE:"LOG_ROTATE_MAX_SIZE",LOG_ROTATE_RETAIN:"LOG_ROTATE_RETAIN",LOG_ROTATE_COMPRESS:"LOG_ROTATE_COMPRESS",LOG_ROTATE_DATE_FORMAT:"LOG_ROTATE_DATE_FORMAT",LOG_ROTATE_ROTATE_MODULE:"LOG_ROTATE_ROTATE_MODULE",LOG_ROTATE_WORKER_INTERVAL:"LOG_ROTATE_WORKER_INTERVAL",LOG_ROTATE_ROTATE_INTERVAL:"LOG_ROTATE_ROTATE_INTERVAL",LOG_ROTATE_TIMEZONE:"LOG_ROTATE_TIMEZONE",LOG_DAILY_ROTATE_KEY:"LOG_DAILY_ROTATE",LOG_MAX_DAILY_FILES_KEY:"LOG_MAX_DAILY_FILES",PROPS_ENV_KEY:"NODE_ENV",SETTINGS_PATH_KEY:"settings_path",CLUSTERING_PORT_KEY:"CLUSTERING_PORT",CLUSTERING_NODE_NAME_KEY:"NODE_NAME",CLUSTERING_ENABLED_KEY:"CLUSTERING",ALLOW_SELF_SIGNED_SSL_CERTS:"ALLOW_SELF_SIGNED_SSL_CERTS",MAX_HDB_PROCESSES:"MAX_HDB_PROCESSES",INSTALL_USER:"install_user",CLUSTERING_USER_KEY:"CLUSTERING_USER",MAX_CLUSTERING_PROCESSES:"MAX_CLUSTERING_PROCESSES",SERVER_TIMEOUT_KEY:"SERVER_TIMEOUT_MS",SERVER_KEEP_ALIVE_TIMEOUT_KEY:"SERVER_KEEP_ALIVE_TIMEOUT",SERVER_HEADERS_TIMEOUT_KEY:"SERVER_HEADERS_TIMEOUT",DISABLE_TRANSACTION_LOG_KEY:"DISABLE_TRANSACTION_LOG",OPERATION_TOKEN_TIMEOUT_KEY:"OPERATION_TOKEN_TIMEOUT",REFRESH_TOKEN_TIMEOUT_KEY:"REFRESH_TOKEN_TIMEOUT",CUSTOM_FUNCTIONS_ENABLED_KEY:"CUSTOM_FUNCTIONS",CUSTOM_FUNCTIONS_PORT_KEY:"CUSTOM_FUNCTIONS_PORT",CUSTOM_FUNCTIONS_DIRECTORY_KEY:"CUSTOM_FUNCTIONS_DIRECTORY",MAX_CUSTOM_FUNCTION_PROCESSES:"MAX_CUSTOM_FUNCTION_PROCESSES",LOG_TO_FILE:"LOG_TO_FILE",LOG_TO_STDSTREAMS:"LOG_TO_STDSTREAMS",RUN_IN_FOREGROUND:"RUN_IN_FOREGROUND",LOCAL_STUDIO_ON:"LOCAL_STUDIO_ON",STORAGE_WRITE_ASYNC:"STORAGE_WRITE_ASYNC"},OQ={CUSTOMFUNCTIONS_ENABLED:"customFunctions_enabled",CUSTOMFUNCTIONS_NETWORK_PORT:"customFunctions_network_port",CUSTOMFUNCTIONS_TLS_CERTIFICATE:"customFunctions_tls_certificate",CUSTOMFUNCTIONS_NETWORK_CORS:"customFunctions_network_cors",CUSTOMFUNCTIONS_NETWORK_CORSACCESSLIST:"customFunctions_network_corsAccessList",CUSTOMFUNCTIONS_NETWORK_HEADERSTIMEOUT:"customFunctions_network_headersTimeout",CUSTOMFUNCTIONS_NETWORK_HTTPS:"customFunctions_network_https",CUSTOMFUNCTIONS_NETWORK_KEEPALIVETIMEOUT:"customFunctions_network_keepAliveTimeout",CUSTOMFUNCTIONS_TLS_PRIVATEKEY:"customFunctions_tls_privateKey",CUSTOMFUNCTIONS_TLS_CERT_AUTH:"customFunctions_tls_certificateAuthority",CUSTOMFUNCTIONS_NETWORK_TIMEOUT:"customFunctions_network_timeout",CUSTOMFUNCTIONS_NODEENV:"customFunctions_nodeEnv",CUSTOMFUNCTIONS_ROOT:"customFunctions_root"},B={ANALYTICS_AGGREGATEPERIOD:"analytics_aggregatePeriod",AUTHENTICATION_AUTHORIZELOCAL:"authentication_authorizeLocal",AUTHENTICATION_CACHETTL:"authentication_cacheTTL",AUTHENTICATION_COOKIE_DOMAINS:"authentication_cookie_domains",AUTHENTICATION_COOKIE_EXPIRES:"authentication_cookie_expires",AUTHENTICATION_ENABLESESSIONS:"authentication_enableSessions",AUTHENTICATION_OPERATIONTOKENTIMEOUT:"authentication_operationTokenTimeout",AUTHENTICATION_REFRESHTOKENTIMEOUT:"authentication_refreshTokenTimeout",AUTHENTICATION_HASHFUNCTION:"authentication_hashFunction",CLUSTERING_USER:"clustering_user",CLUSTERING_ENABLED:"clustering_enabled",CLUSTERING_HUBSERVER_CLUSTER_NAME:"clustering_hubServer_cluster_name",CLUSTERING_HUBSERVER_CLUSTER_NETWORK_PORT:"clustering_hubServer_cluster_network_port",CLUSTERING_HUBSERVER_CLUSTER_NETWORK_ROUTES:"clustering_hubServer_cluster_network_routes",CLUSTERING_HUBSERVER_LEAFNODES_NETWORK_PORT:"clustering_hubServer_leafNodes_network_port",CLUSTERING_HUBSERVER_NETWORK_PORT:"clustering_hubServer_network_port",CLUSTERING_LEAFSERVER_NETWORK_PORT:"clustering_leafServer_network_port",CLUSTERING_LEAFSERVER_NETWORK_ROUTES:"clustering_leafServer_network_routes",CLUSTERING_LEAFSERVER_STREAMS_MAXAGE:"clustering_leafServer_streams_maxAge",CLUSTERING_LEAFSERVER_STREAMS_MAXBYTES:"clustering_leafServer_streams_maxBytes",CLUSTERING_LEAFSERVER_STREAMS_MAXMSGS:"clustering_leafServer_streams_maxMsgs",CLUSTERING_LEAFSERVER_STREAMS_MAXCONSUMEMSGS:"clustering_leafServer_streams_maxConsumeMsgs",CLUSTERING_LEAFSERVER_STREAMS_MAXINGESTTHREADS:"clustering_leafServer_streams_maxIngestThreads",CLUSTERING_LEAFSERVER_STREAMS_PATH:"clustering_leafServer_streams_path",CLUSTERING_NODENAME:"clustering_nodeName",CLUSTERING_TLS_CERTIFICATE:"clustering_tls_certificate",CLUSTERING_TLS_PRIVATEKEY:"clustering_tls_privateKey",CLUSTERING_TLS_CERT_AUTH:"clustering_tls_certificateAuthority",CLUSTERING_TLS_INSECURE:"clustering_tls_insecure",CLUSTERING_TLS_VERIFY:"clustering_tls_verify",CLUSTERING_LOGLEVEL:"clustering_logLevel",CLUSTERING_REPUBLISHMESSAGES:"clustering_republishMessages",CLUSTERING_DATABASELEVEL:"clustering_databaseLevel",CUSTOMFUNCTIONS_NETWORK_HTTPS:"customFunctions_network_https",THREADS:"threads",THREADS_COUNT:"threads_count",THREADS_DEBUG:"threads_debug",THREADS_DEBUG_STARTINGPORT:"threads_debug_startingPort",THREADS_DEBUG_PORT:"threads_debug_port",THREADS_DEBUG_HOST:"threads_debug_host",THREADS_DEBUG_WAITFORDEBUGGER:"threads_debug_waitForDebugger",THREADS_MAXHEAPMEMORY:"threads_maxHeapMemory",HTTP_SESSIONAFFINITY:"http_sessionAffinity",HTTP_COMPRESSIONTHRESHOLD:"http_compressionThreshold",HTTP_CORS:"http_cors",HTTP_CORSACCESSLIST:"http_corsAccessList",HTTP_CORSACCESSCONTROLALLOWHEADERS:"http_corsAccessControlAllowHeaders",HTTP_HEADERSTIMEOUT:"http_headersTimeout",HTTP_KEEPALIVETIMEOUT:"http_keepAliveTimeout",HTTP_MAXPARAMLENGTH:"http_maxParamLength",HTTP_TIMEOUT:"http_timeout",HTTP_PORT:"http_port",HTTP_SECUREPORT:"http_securePort",HTTP_MTLS:"http_mtls",HTTP_MTLS_REQUIRED:"http_mtls_required",HTTP_MTLS_USER:"http_mtls_user",HTTP_MAXHEADERSIZE:"http_maxHeaderSize",HTTP_THREADRANGE:"http_threadRange",HTTP_HTTP2:"http_http2",LOCALSTUDIO_ENABLED:"localStudio_enabled",LOGGING_CONSOLE:"logging_console",LOGGING_FILE:"logging_file",LOGGING_LEVEL:"logging_level",LOGGING_ROOT:"logging_root",LOGGING_ROTATION_ENABLED:"logging_rotation_enabled",LOGGING_ROTATION_COMPRESS:"logging_rotation_compress",LOGGING_ROTATION_INTERVAL:"logging_rotation_interval",LOGGING_ROTATION_MAXSIZE:"logging_rotation_maxSize",LOGGING_ROTATION_PATH:"logging_rotation_path",LOGGING_ROTATION_RETENTION:"logging_rotation_retention",LOGGING_STDSTREAMS:"logging_stdStreams",LOGGING_AUDITLOG:"logging_auditLog",LOGGING_AUDITRETENTION:"logging_auditRetention",LOGGING_AUDITAUTHEVENTS_LOGFAILED:"logging_auditAuthEvents_logFailed",LOGGING_AUDITAUTHEVENTS_LOGSUCCESSFUL:"logging_auditAuthEvents_logSuccessful",OPERATIONSAPI_NETWORK_CORS:"operationsApi_network_cors",OPERATIONSAPI_NETWORK_CORSACCESSLIST:"operationsApi_network_corsAccessList",OPERATIONSAPI_NETWORK_HEADERSTIMEOUT:"operationsApi_network_headersTimeout",OPERATIONSAPI_NETWORK_HTTPS:"operationsApi_network_https",OPERATIONSAPI_NETWORK_KEEPALIVETIMEOUT:"operationsApi_network_keepAliveTimeout",OPERATIONSAPI_NETWORK_PORT:"operationsApi_network_port",OPERATIONSAPI_NETWORK_DOMAINSOCKET:"operationsApi_network_domainSocket",OPERATIONSAPI_NETWORK_SECUREPORT:"operationsApi_network_securePort",OPERATIONSAPI_NETWORK_HTTP2:"operationsApi_network_http2",OPERATIONSAPI_TLS:"operationsApi_tls",OPERATIONSAPI_TLS_CERTIFICATE:"operationsApi_tls_certificate",OPERATIONSAPI_TLS_PRIVATEKEY:"operationsApi_tls_privateKey",OPERATIONSAPI_TLS_CERTIFICATEAUTHORITY:"operationsApi_tls_certificateAuthority",OPERATIONSAPI_NETWORK_TIMEOUT:"operationsApi_network_timeout",OPERATIONSAPI_SYSINFO_NETWORK:"operationsApi_sysInfo_network",OPERATIONSAPI_SYSINFO_DISK:"operationsApi_sysInfo_disk",REPLICATION:"replication",REPLICATION_HOSTNAME:"replication_hostname",REPLICATION_URL:"replication_url",REPLICATION_PORT:"replication_port",REPLICATION_SECUREPORT:"replication_securePort",REPLICATION_ROUTES:"replication_routes",REPLICATION_DATABASES:"replication_databases",REPLICATION_ENABLEROOTCAS:"replication_enableRootCAs",REPLICATION_SHARD:"replication_shard",REPLICATION_BLOBTIMEOUT:"replication_blobTimeout",ROOTPATH:"rootPath",SERIALIZATION_BIGINT:"serialization_bigInt",STORAGE_WRITEASYNC:"storage_writeAsync",STORAGE_OVERLAPPINGSYNC:"storage_overlappingSync",STORAGE_CACHING:"storage_caching",STORAGE_COMPRESSION:"storage_compression",STORAGE_NOREADAHEAD:"storage_noReadAhead",STORAGE_PREFETCHWRITES:"storage_prefetchWrites",STORAGE_ENCRYPTION:"storage_encryption",STORAGE_MAXTRANSACTIONQUEUETIME:"storage_maxTransactionQueueTime",STORAGE_PATH:"storage_path",STORAGE_BLOBPATHS:"storage_blobPaths",STORAGE_AUDIT_PATH:"storage_audit_path",STORAGE_MAXFREESPACETOLOAD:"storage_maxFreeSpaceToLoad",STORAGE_MAXFREESPACETORETAIN:"storage_maxFreeSpaceToRetain",STORAGE_PAGESIZE:"storage_pageSize",STORAGE_COMPRESSION_DICTIONARY:"storage_compression_dictionary",STORAGE_COMPRESSION_THRESHOLD:"storage_compression_threshold",STORAGE_COMPACTONSTART:"storage_compactOnStart",STORAGE_COMPACTONSTARTKEEPBACKUP:"storage_compactOnStartKeepBackup",STORAGE_RECLAMATION_THRESHOLD:"storage_reclamation_threshold",STORAGE_RECLAMATION_INTERVAL:"storage_reclamation_interval",STORAGE_RECLAMATION_EVICTIONFACTOR:"storage_reclamation_evictionFactor",DATABASES:"databases",IGNORE_SCRIPTS:"ignoreScripts",MQTT_NETWORK_PORT:"mqtt_network_port",MQTT_WEBSOCKET:"mqtt_webSocket",MQTT_NETWORK_SECUREPORT:"mqtt_network_securePort",MQTT_NETWORK_MTLS:"mqtt_network_mtls",MQTT_NETWORK_MTLS_REQUIRED:"mqtt_network_mtls_required",MQTT_NETWORK_MTLS_CERTIFICATEAUTHORITY:"mqtt_network_mtls_certificateAuthority",MQTT_NETWORK_MTLS_USER:"mqtt_network_mtls_user",MQTT_REQUIREAUTHENTICATION:"mqtt_requireAuthentication",COMPONENTSROOT:"componentsRoot",TLS_CERTIFICATE:"tls_certificate",TLS_PRIVATEKEY:"tls_privateKey",TLS_CERTIFICATEAUTHORITY:"tls_certificateAuthority",TLS_CIPHERS:"tls_ciphers",TLS:"tls",CLONED:"cloned"},RD={settings_path:AD.SETTINGS_PATH_KEY,hdb_root_key:B.ROOTPATH,hdb_root:B.ROOTPATH,rootpath:B.ROOTPATH,server_port_key:B.OPERATIONSAPI_NETWORK_PORT,server_port:B.OPERATIONSAPI_NETWORK_PORT,cert_key:B.TLS_CERTIFICATE,certificate:B.TLS_CERTIFICATE,private_key_key:B.TLS_PRIVATEKEY,private_key:B.TLS_PRIVATEKEY,http_secure_enabled_key:B.OPERATIONSAPI_NETWORK_HTTPS,https_on:B.OPERATIONSAPI_NETWORK_HTTPS,cors_enabled_key:B.OPERATIONSAPI_NETWORK_CORS,cors_on:B.OPERATIONSAPI_NETWORK_CORS,cors_whitelist_key:B.OPERATIONSAPI_NETWORK_CORSACCESSLIST,cors_whitelist:B.OPERATIONSAPI_NETWORK_CORSACCESSLIST,cors_accesslist_key:B.OPERATIONSAPI_NETWORK_CORSACCESSLIST,cors_accesslist:B.OPERATIONSAPI_NETWORK_CORSACCESSLIST,log_level_key:B.LOGGING_LEVEL,log_level:B.LOGGING_LEVEL,log_path_key:B.LOGGING_ROOT,log_path:B.LOGGING_ROOT,clustering_node_name_key:B.CLUSTERING_NODENAME,node_name:B.CLUSTERING_NODENAME,clustering_enabled_key:B.CLUSTERING_ENABLED,clustering:B.CLUSTERING_ENABLED,max_http_threads:B.THREADS_COUNT,max_hdb_processes:B.THREADS_COUNT,server_timeout_key:B.OPERATIONSAPI_NETWORK_TIMEOUT,server_timeout_ms:B.OPERATIONSAPI_NETWORK_TIMEOUT,server_keep_alive_timeout_key:B.OPERATIONSAPI_NETWORK_KEEPALIVETIMEOUT,server_keep_alive_timeout:B.OPERATIONSAPI_NETWORK_KEEPALIVETIMEOUT,server_headers_timeout_key:B.OPERATIONSAPI_NETWORK_HEADERSTIMEOUT,server_headers_timeout:B.OPERATIONSAPI_NETWORK_HEADERSTIMEOUT,disable_transaction_log_key:B.LOGGING_AUDITLOG,disable_transaction_log:B.LOGGING_AUDITLOG,operation_token_timeout_key:B.AUTHENTICATION_OPERATIONTOKENTIMEOUT,operation_token_timeout:B.AUTHENTICATION_OPERATIONTOKENTIMEOUT,refresh_token_timeout_key:B.AUTHENTICATION_REFRESHTOKENTIMEOUT,refresh_token_timeout:B.AUTHENTICATION_REFRESHTOKENTIMEOUT,custom_functions_port_key:B.HTTP_PORT,custom_functions_port:B.HTTP_PORT,custom_functions_directory_key:B.COMPONENTSROOT,custom_functions_directory:B.COMPONENTSROOT,max_custom_function_processes:B.THREADS_COUNT,logging_console:B.LOGGING_CONSOLE,log_to_file:B.LOGGING_FILE,log_to_stdstreams:B.LOGGING_STDSTREAMS,local_studio_on:B.LOCALSTUDIO_ENABLED,clustering_port:B.CLUSTERING_HUBSERVER_CLUSTER_NETWORK_PORT,clustering_user:B.CLUSTERING_USER,customfunctions_network_port:B.HTTP_PORT,customfunctions_tls_certificate:B.TLS_CERTIFICATE,customfunctions_network_cors:B.HTTP_CORS,customfunctions_network_corsaccesslist:B.HTTP_CORSACCESSLIST,customfunctions_network_headerstimeout:B.HTTP_HEADERSTIMEOUT,customfunctions_network_https:B.CUSTOMFUNCTIONS_NETWORK_HTTPS,customfunctions_network_keepalivetimeout:B.HTTP_KEEPALIVETIMEOUT,customfunctions_tls_privatekey:B.TLS_PRIVATEKEY,customfunctions_tls_certificateauthority:B.TLS_CERTIFICATEAUTHORITY,customfunctions_network_timeout:B.HTTP_TIMEOUT,customfunctions_tls:B.TLS,http_threads:B.THREADS_COUNT,threads:B.THREADS_COUNT,threads_count:B.THREADS_COUNT,customfunctions_processes:B.THREADS_COUNT,customfunctions_root:B.COMPONENTSROOT,operationsapi_root:B.ROOTPATH};for(let e in B){let t=B[e];RD[t.toLowerCase()]=t}NQ={TABLES:"tables",PATH:"path",AUDIT_PATH:"auditPath"},wQ={csv_file_load:"csv_file_load",csv_data_load:zt.CSV_DATA_LOAD,csv_url_load:zt.CSV_URL_LOAD,delete_files_before:"delete_files_before",delete_records_before:"delete_records_before",delete_audit_logs_before:"delete_audit_logs_before",delete_transaction_logs_before:"delete_transaction_logs_before",empty_trash:"empty_trash",export_local:"export_local",export_to_s3:"export_to_s3",import_from_s3:"import_from_s3",restart_service:"restart_service"},sR={CLUSTERING_PAYLOAD:"clustering_payload",DELEGATE_THREAD_RESPONSE:"delegate_thread_response",CLUSTERING:"clustering",SCHEMA:"schema",CLUSTER_STATUS:"cluster_status",JOB:"job",CHILD_STARTED:"child_started",CHILD_STOPPED:"child_stopped",USER:"user",RESTART:"restart"},IQ={VERSION_DEFAULT:"2.2.0"},CQ={DEVELOPMENT:8192,DEFAULT:512},PQ={ENOENT:"ENOENT",EACCES:"EACCES",EEXIST:"EEXIST",ERR_INVALID_ARG_TYPE:"ERR_INVALID_ARG_TYPE"},DQ=Symbol("metadata"),LQ="__clustering__",yD="__createdtime__",bD="__updatedtime__",MQ={CREATED_TIME:yD,UPDATED_TIME:bD},vQ=[yD,bD],UQ=15984864e5,um={LESS:"<",LESS_OR_EQ:"<=",GREATER:">",GREATER_OR_EQ:">=",BETWEEN:"..."},iR={"<":"LESS","<=":"LESS_OR_EQ",">":"GREATER",">=":"GREATER_OR_EQ","...":"BETWEEN"},xQ={READ:"read",INSERT:"insert",UPDATE:"update",DELETE:"delete"},BQ=["*","%"],HQ="func_val",dm={HASH_VALUE:"hash_value",TIMESTAMP:"timestamp",USERNAME:"username"},wf={JWT_PRIVATE_KEY_NAME:".jwtPrivate.key",JWT_PUBLIC_KEY_NAME:".jwtPublic.key",JWT_PASSPHRASE_NAME:".jwtPass"},oR={SHUTDOWN:"shutdown",CHILD_STARTED:"child_started",CHILD_STOPPED:"child_stopped",SCHEMA:"schema",USER:"user",CLUSTER_STATUS_RESPONSE:"cluster_status_response",CLUSTER_STATUS_REQUEST:"cluster_status_request",METRICS:"metrics",GET_METRICS:"get_metrics",RESTART:"restart",START_JOB:"start_job",NATS_CONSUMER_UPDATE:"nats_consumer_update"},aR={HTTP:"http"},kQ="3.x.x",Xs={SUCCESS:"success",FAILURE:"failure"},pa={AUTHENTICATION:"authentication",AUTHORIZATION:"authorization"}});var ha=P((ebe,wD)=>{"use strict";var OD=require("minimist");wD.exports=FQ;function FQ(e=[],t=!1){if(!Array.isArray(e))return{};let r,n;t?(r=ND(process.env),n=ND(OD(process.argv))):(r=process.env,n=OD(process.argv));let s={};for(let i=0,o=e.length;i<o;i++){let c=e[i];n[c]!==void 0?s[c]=n[c].toString().trim():r[c]!==void 0&&(s[c]=r[c].toString().trim())}return s}a(FQ,"assignCMDENVVariables");function ND(e){let t,r=Object.keys(e),n=r.length,s={};for(;n--;)t=r[n],s[t.toLowerCase()]=e[t];return s}a(ND,"objKeysToLowerCase")});var bi=P(Zs=>{"use strict";global.Resource=Zs.Resource=void 0;global.tables=Zs.tables={};global.databases=Zs.databases={};global.getUser=Zs.getUser=void 0;global.authenticateUser=Zs.authenticateUser=void 0;global.server=Zs.server={};global.contentTypes=Zs.contentTypes=null;global.threads=Zs.threads=[];global.logger={};Zs._assignPackageExport=(e,t)=>{global[e]=Zs[e]=t}});var X=P((qD,$D)=>{"use strict";var lo=require("fs-extra"),{workerData:GQ,threadId:qQ,isMainThread:$Q}=require("worker_threads"),Ni=require("path"),DD=require("yaml"),LD=require("properties-reader"),jt=(G(),D(q)),ID=ha(),VQ=require("os"),{PACKAGE_ROOT:dR}=it(),{_assignPackageExport:KQ}=bi(),CD=process.stdout.nativeWrite||(process.stdout.nativeWrite=process.stdout.write),Er={notify:7,fatal:6,error:5,warn:4,info:3,debug:2,trace:1},MD={STDOUT:"stdOut",STDERR:"stdErr"},YQ=Ni.join(dR,"logs"),WQ=Ni.join(dR,"config/yaml/",jt.HDB_DEFAULT_CONFIG_FILE),zQ=1e4,cR,Oi,Ss,Lr,fm,If,_m,ma,Cf;Cf===void 0&&vD();Object.assign(qD,{notify:kD,fatal:FD,error:pm,warn:GD,info:xD,debug:HD,trace:BD,setLogLevel:r4,log_level:Lr,loggerWithTag:QQ,suppressLogging:XQ,initLogSettings:vD,logCustomLevel:e4,closeLogFile:fR,logsAtLevel:jQ,getLogFilePath:a(()=>_m,"getLogFilePath"),OUTPUTS:MD,AuthAuditLog:i4});KQ("logger",$D.exports);var lR;function jQ(e){return Er[Lr]<=Er[e]}a(jQ,"logsAtLevel");function vD(e=!1){try{if(Cf===void 0||e){fR();let t=t4(),r=ID(["ROOTPATH"]);try{Cf=LD(t)}catch(n){if(!r.ROOTPATH||r.ROOTPATH&&!lo.pathExistsSync(Ni.join(r.ROOTPATH,jt.HDB_CONFIG_FILE)))throw n}if({level:Lr,config_log_path:If,to_file:Oi,to_stream:Ss}=n4(r.ROOTPATH?Ni.join(r.ROOTPATH,jt.HDB_CONFIG_FILE):Cf.get("settings_path")),fm=jt.LOG_NAMES.HDB,_m=Ni.join(If,fm),$Q)try{require("segfault-handler").registerHandler(Ni.join(If,"crash.log"))}catch{}}}catch(t){if(Cf=void 0,t.code===jt.NODE_ERROR_CODES.ENOENT||t.code===jt.NODE_ERROR_CODES.ERR_INVALID_ARG_TYPE){let r=ID(Object.keys(jt.CONFIG_PARAM_MAP),!0);for(let o in r){let c=jt.CONFIG_PARAM_MAP[o];c&&c.toLowerCase();let l=r[o];if(c===jt.CONFIG_PARAMS.LOGGING_LEVEL){Lr=l;continue}if(c===jt.CONFIG_PARAMS.LOGGING_STDSTREAMS){Ss=l;continue}c===jt.CONFIG_PARAMS.LOGGING_FILE&&(Oi=c),c===jt.CONFIG_PARAMS.LOGGING_CONSOLE&&(cR=c)}let{default_level:n,default_to_file:s,default_to_stream:i}=s4();Oi=Oi===void 0?s:Oi,Oi=PD(Oi),Ss=Ss===void 0?i:Ss,Ss=PD(Ss),Lr=Lr===void 0?n:Lr,If=YQ,fm=jt.LOG_NAMES.INSTALL,_m=Ni.join(If,fm);return}throw pm("Error initializing log settings"),pm(t),t}process.env.DEV_MODE&&(Ss=!0),JQ()}a(vD,"initLogSettings");var Ea=!0;function JQ(){Oi&&(process.stdout.write=function(e){return typeof e=="string"&&Ea&&cR!==!1&&(uR(),e=e.toString(),e[e.length-1]===` `&&(e=e.slice(0,-1)),lo.appendFileSync(ma,ei("stdout",[e]))),CD.apply(process.stdout,arguments)},process.stderr.write=function(e){return typeof e=="string"&&Ea&&cR!==!1&&(uR(),e[e.length-1]===` `&&(e=e.slice(0,-1)),lo.appendFileSync(ma,ei("stderr",[e]))),CD.apply(process.stderr,arguments)})}a(JQ,"stdioLogging");function QQ(e,t){let r={tagName:e.replace(/ /g,"-")};return{notify:n(kD,"notify"),fatal:n(FD,"fatal"),error:n(pm,"error"),warn:n(GD,"warn"),info:n(xD,"info"),debug:n(HD,"debug"),trace:n(BD,"trace")};function n(s,i){return!t||Er[Lr]<=Er[i]?function(...o){return s(r,...o)}:null}}a(QQ,"loggerWithTag");function XQ(e){try{Ea=!1,e()}finally{Ea=!0}}a(XQ,"suppressLogging");var ZQ=GQ?.name?.replace(/ /g,"-")||"main";function ei(e,t){let r=new Date(Date.now()).toISOString(),n="",s=t.length,i=s-1,o=[e],c=0,l;for(typeof t[0]=="object"&&(t[0]?.tagName?(o.push(t[0]?.tagName),c++):t[0]?.serviceName&&(l=t[0]?.serviceName,c++)),o.unshift(l||ZQ+"/"+qQ);c<s;c++){let u=t[c];if(u instanceof Error&&u.stack)n+=u.stack,Object.keys(u).length>0&&(n+=` `+JSON.stringify(u)),u.cause&&(t[c--]=u.cause,u&&(n+=` Caused by:`));else if(typeof u=="object")try{n+=JSON.stringify(u)}catch{n+="Object ["+Object.keys(u)+"]"}else n+=u;c<i&&(n+=" ")}return`${r} [${o.join("] [")}]: ${n} `}a(ei,"createLogRecord");function Pf(e){if(Oi){if(UD(e),Ss){Ea=!1;try{process.stdout.write(e)}finally{Ea=!0}}}else Ss&&process.stdout.write(e)}a(Pf,"logStdOut");function hm(e){if(Oi){if(UD(e),Ss){Ea=!1;try{process.stderr.write(e)}finally{Ea=!0}}}else Ss&&process.stderr.write(e)}a(hm,"logStdErr");function UD(e){uR(),ma?lo.appendFileSync(ma,e):lR||console.log(e)}a(UD,"logToFile");function fR(){try{lo.closeSync(ma)}catch{}ma=null}a(fR,"closeLogFile");function uR(){if(!ma){try{ma=lo.openSync(_m,"a")}catch(e){lR||(lR=!0,console.error(e))}setTimeout(()=>{fR()},zQ).unref()}}a(uR,"openLogFile");function xD(...e){Er[Lr]<=Er.info&&Pf(ei("info",e))}a(xD,"info");function BD(...e){Er[Lr]<=Er.trace&&Pf(ei("trace",e))}a(BD,"trace");function pm(...e){Er[Lr]<=Er.error&&hm(ei("error",e))}a(pm,"error");function HD(...e){Er[Lr]<=Er.debug&&Pf(ei("debug",e))}a(HD,"debug");function kD(...e){Er[Lr]<=Er.notify&&Pf(ei("notify",e))}a(kD,"notify");function FD(...e){Er[Lr]<=Er.fatal&&hm(ei("fatal",e))}a(FD,"fatal");function GD(...e){Er[Lr]<=Er.warn&&hm(ei("warn",e))}a(GD,"warn");function e4(e,t,...r){t===MD.STDERR?hm(ei(e,r)):Pf(ei(e,r))}a(e4,"logCustomLevel");function t4(){let e;try{e=VQ.homedir()}catch{e=process.env.HOME}e||(e="~/");let t=Ni.join(e,jt.HDB_HOME_DIR_NAME,jt.BOOT_PROPS_FILE_NAME);return lo.existsSync(t)||(t=Ni.join(dR,"utility/hdb_boot_properties.file")),t}a(t4,"getPropsFilePath");function r4(e){Lr=e}a(r4,"setLogLevel");function PD(e){return e===!0||typeof e=="string"&&e.toLowerCase()==="true"}a(PD,"autoCastBoolean");function n4(e){try{if(e.includes("config/settings.js")){let o=LD(e);return{level:o.get(jt.HDB_SETTINGS_NAMES.LOG_LEVEL_KEY),config_log_path:Ni.dirname(o.get(jt.HDB_SETTINGS_NAMES.LOG_PATH_KEY)),to_file:o.get(jt.HDB_SETTINGS_NAMES.LOG_TO_FILE),to_stream:o.get(jt.HDB_SETTINGS_NAMES.LOG_TO_STDSTREAMS)}}let t=DD.parseDocument(lo.readFileSync(e,"utf8")),r=t.getIn(["logging","level"]),n=t.getIn(["logging","root"]),s=t.getIn(["logging","file"]),i=t.getIn(["logging","stdStreams"]);return{level:r,config_log_path:n,to_file:s,to_stream:i}}catch(t){if(t.code===jt.NODE_ERROR_CODES.ENOENT)throw t;console.error("Error accessing config file for logging"),console.error(t)}}a(n4,"getLogConfig");function s4(){try{let e=DD.parseDocument(lo.readFileSync(WQ,"utf8")),t=e.getIn(["logging","level"]),r=e.getIn(["logging","file"]),n=e.getIn(["logging","stdStreams"]);return{default_level:t,default_to_file:r,default_to_stream:n}}catch(e){console.error("Error accessing default config file for logging"),console.error(e)}}a(s4,"getDefaultConfig");function i4(e,t,r,n,s,i){this.username=e,this.status=t,this.type=r,this.originating_ip=n,this.request_method=s,this.path=i}a(i4,"AuthAuditLog")});var _R=P((sbe,VD)=>{"use strict";var o4=require("util"),a4=require("path"),c4=require("child_process"),l4=o4.promisify(c4.execFile),u4=1e3*1e3*10;VD.exports={findPs:d4};async function d4(e){let t={};try{await Promise.all(["comm","args","ppid","uid","%cpu","%mem"].map(async r=>{let{stdout:n}=await l4("ps",["wwxo",`pid,${r}`],{maxBuffer:u4});for(let s of n.trim().split(` `).slice(1)){s=s.trim();let[i]=s.split(" ",1),o=s.slice(i.length+1).trim();t[i]===void 0&&(t[i]={}),t[i][r]=o}}))}catch(r){throw r}return Object.entries(t).filter(([,r])=>r.comm&&r.args&&r.ppid&&r.uid&&r["%cpu"]&&r["%mem"]&&r.args.includes(e)).map(([r,n])=>({pid:Number.parseInt(r,10),name:a4.basename(n.comm),cmd:n.args,ppid:Number.parseInt(n.ppid,10),uid:Number.parseInt(n.uid,10),cpu:Number.parseFloat(n["%cpu"]),memory:Number.parseFloat(n["%mem"])}))}a(d4,"findPs")});var Gt=P((obe,YD)=>{"use strict";var f4="__dbis__",_4="__txns__",p4="__environment_name__",h4="__dbi_defintion__",m4={EQUALS:"equals",STARTS_WITH:"startsWith",_STARTS_WITH:"starts_with",ENDS_WITH:"endsWith",_ENDS_WITH:"ends_with",CONTAINS:"contains",SEARCH_ALL:"searchAll",SEARCH_ALL_TO_MAP:"searchAllToMap",BATCH_SEARCH_BY_HASH:"batchSearchByHash",BATCH_SEARCH_BY_HASH_TO_MAP:"batchSearchByHashToMap",GREATER_THAN:"greaterThan",_GREATER_THAN:"greater_than",GREATER_THAN_EQUAL:"greaterThanEqual",_GREATER_THAN_EQUAL:"greater_than_equal",LESS_THAN:"lessThan",_LESS_THAN:"less_than",LESS_THAN_EQUAL:"lessThanEqual",_LESS_THAN_EQUAL:"less_than_equal",BETWEEN:"between"},E4=["__createdtime__","__updatedtime__"],g4="\uFFFF",KD={TIMESTAMP:"timestamp",HASH_VALUE:"hash_value",USER_NAME:"user_name"},S4=Object.values(KD);YD.exports={AUDIT_STORE_NAME:_4,INTERNAL_DBIS_NAME:f4,DBI_DEFINITION_NAME:h4,SEARCH_TYPES:m4,TIMESTAMP_NAMES:E4,MAX_SEARCH_KEY_LENGTH:256,ENVIRONMENT_NAME_KEY:p4,TRANSACTIONS_DBI_NAMES_ENUM:KD,TRANSACTIONS_DBIS:S4,OVERFLOW_MARKER:g4}});var kn=P((abe,tL)=>{"use strict";var WD=(G(),D(q)),zD=Gt(),jD={CONTINUE:100,OK:200,CREATED:201,BAD_REQUEST:400,UNAUTHORIZED:401,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,REQUEST_TIMEOUT:408,CONFLICT:409,TOO_MANY_REQUESTS:429,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,INSUFFICIENT_STORAGE:507,NETWORK_AUTHENTICATION_REQUIRED:511},JD=a(e=>`${e} Check logs and try again.`,"CHECK_LOGS_WRAPPER"),QD={500:JD("There was an error processing your request."),400:"Invalid request"},T4=QD[jD.INTERNAL_SERVER_ERROR],A4={OP_NOT_SUPPORTED_FOR_FS:a(e=>`${e} is not available for this instance because it uses the File System data store.`,"OP_NOT_SUPPORTED_FOR_FS"),MISSING_VALUE:a(e=>`${e} is missing.`,"MISSING_VALUE"),INVALID_VALUE:a(e=>`${e} is invalid.`,"INVALID_VALUE"),NOT_FOUND:a(e=>`${e} not found.`,"NOT_FOUND")},R4={CONFIG_VALIDATION:a(e=>`HarperDB config file validation error: ${e}`,"CONFIG_VALIDATION")},y4={DEFAULT_BULK_LOAD_ERR:"There was an error during your bulk load into HarperDB.",DOWNLOAD_FILE_ERR:a(e=>`There was an error downloading '${e}'.`,"DOWNLOAD_FILE_ERR"),INSERT_JSON_ERR:"There was an error inserting the downloaded JSON data.",INSERT_CSV_ERR:"There was an error inserting the downloaded CSV data.",INVALID_ACTION_PARAM_ERR:a(e=>`Bulk load operation failed - ${e} is not a valid 'action' parameter`,"INVALID_ACTION_PARAM_ERR"),INVALID_FILE_EXT_ERR:a(e=>`Error selecting correct parser - valid file type not found in json - ${e}`,"INVALID_FILE_EXT_ERR"),MAX_FILE_SIZE_ERR:a((e,t)=>`File size is ${e} bytes, which exceeded the maximum size allowed of: ${t} bytes`,"MAX_FILE_SIZE_ERR"),PAPA_PARSE_ERR:"There was an error parsing the downloaded CSV data.",S3_DOWNLOAD_ERR:a(e=>`There was an error downloading '${e}' from AWS.`,"S3_DOWNLOAD_ERR"),WRITE_TEMP_FILE_ERR:"Error writing temporary file to storage"},b4={BASE_PATH_REQUIRED:"base_path is required",DESTINATION_PATH_REQUIRED:"destination_path is required",ENV_NAME_REQUIRED:"env_name is required",INVALID_BASE_PATH:"invalid base_path",INVALID_DESTINATION_PATH:"invalid destination_path",INVALID_ENVIRONMENT:"invalid environment",ENV_REQUIRED:"env is required",DBI_NAME_REQUIRED:"dbi_name is required",DBI_DOES_NOT_EXIST:"dbi does not exist",HASH_ATTRIBUTE_REQUIRED:"hash_attribute is required",ID_REQUIRED:"id is required",IDS_REQUIRED:"ids is required",IDS_MUST_BE_ITERABLE:"ids must be iterable",FETCH_ATTRIBUTES_REQUIRED:"fetch_attributes is required",FETCH_ATTRIBUTES_MUST_BE_ARRAY:"fetch_attributes must be an array",ATTRIBUTE_REQUIRED:"attribute is required",SEARCH_VALUE_REQUIRED:"search_value is required",SEARCH_VALUE_TOO_LARGE:"search_value is too long",WRITE_ATTRIBUTES_REQUIRED:"write_attributes is required",WRITE_ATTRIBUTES_MUST_BE_ARRAY:"write_attributes must be an array",RECORDS_REQUIRED:"records is required",RECORDS_MUST_BE_ARRAY:"records must be an array",CANNOT_CREATE_INTERNAL_DBIS_NAME:`cannot create a dbi named ${zD.INTERNAL_DBIS_NAME}`,CANNOT_DROP_INTERNAL_DBIS_NAME:`cannot drop a dbi named ${zD.INTERNAL_DBIS_NAME}`,START_VALUE_REQUIRED:"start_value is required",END_VALUE_REQUIRED:"end_value is required",CANNOT_COMPARE_STRING_TO_NUMERIC_KEYS:"cannot compare a string to numeric keys",END_VALUE_MUST_BE_GREATER_THAN_START_VALUE:"end_value must be greater than or equal to start_value",UNKNOWN_SEARCH_TYPE:"unknown search type",CANNOT_DROP_TABLE_HASH_ATTRIBUTE:"cannot drop a table's hash attribute"},O4={ATTR_NAME_LENGTH_ERR:a(e=>`transaction aborted due to attribute name ${e} being too long. Attribute names cannot be longer than ${WD.INSERT_MAX_CHARACTER_SIZE} bytes.`,"ATTR_NAME_LENGTH_ERR"),ATTR_NAME_NULLISH_ERR:"transaction aborted due to record(s) with an attribute name that is null, undefined or empty string",HASH_VAL_LENGTH_ERR:`transaction aborted due to record(s) with a hash value that exceeds ${WD.INSERT_MAX_CHARACTER_SIZE} bytes, check log for more info`,INVALID_FORWARD_SLASH_IN_HASH_ERR:"transaction aborted due to record(s) with a hash value that contains a forward slash, check log for more info",RECORD_MISSING_HASH_ERR:"transaction aborted due to record(s) with no hash value, check log for more info"},XD={GENERIC_AUTH_FAIL:"Login failed",USER_INACTIVE:"Cannot complete request: User is inactive",INVALID_TOKEN:"invalid token",NO_ENCRYPTION_KEYS:"unable to generate JWT as there are no encryption keys. please contact your administrator",INVALID_CREDENTIALS:"invalid credentials",PASSWORD_REQUIRED:"password is required",USERNAME_REQUIRED:"username is required",REFRESH_TOKEN_REQUIRED:"refresh_token is required",INVALID_AUTH_OBJECT:"invalid auth_object",INVALID_BODY:"invalid body",TOKEN_EXPIRED:"token expired",REFRESH_TOKEN_SAVE_FAILED:"unable to store refresh_token"},N4={DEFAULT_INVALID_REQUEST:"Invalid request",OP_AUTH_PERMS_ERROR:"This operation is not authorized due to role restrictions and/or invalid database items",OP_IS_SU_ONLY:a(e=>`Operation '${e}' is restricted to 'super_user' roles`,"OP_IS_SU_ONLY"),OP_NOT_FOUND:a(e=>`Operation '${e}' not found`,"OP_NOT_FOUND"),SYSTEM_TIMESTAMP_PERMS_ERR:"Internal timestamp attributes - '__createdtime_' and '__updatedtime__' - cannot be inserted to or updated by HDB users.",UNKNOWN_OP_AUTH_ERROR:a((e,t,r)=>`There was an error authorizing ${e} op on table '${t}.${r}'`,"UNKNOWN_OP_AUTH_ERROR"),USER_HAS_NO_PERMS:a(e=>`User ${e} has no role or permissions. Please assign the user a valid role.`,"USER_HAS_NO_PERMS"),DROP_SYSTEM:"The 'system' database, tables and records are used internally by HarperDB and cannot be updated or removed."},w4={ATTR_PERM_MISSING:a((e,t)=>`${e.toUpperCase()} attribute permission missing for '${t}'`,"ATTR_PERM_MISSING"),ATTR_PERM_MISSING_NAME:"Permission object in 'attribute_permission' missing an 'attribute_name'",ATTR_PERM_NOT_BOOLEAN:a((e,t)=>`${e.toUpperCase()} attribute permission for '${t}' must be a boolean`,"ATTR_PERM_NOT_BOOLEAN"),ATTR_PERMS_ARRAY_MISSING:"Missing 'attribute_permissions' array",ATTR_PERMS_NOT_ARRAY:"Value for 'attribute_permissions' must be an array",INVALID_ATTRIBUTE_IN_PERMS:a(e=>`Invalid attribute '${e}' in 'attribute_permissions'`,"INVALID_ATTRIBUTE_IN_PERMS"),INVALID_PERM_KEY:a(e=>`Invalid table permission key value '${e}'`,"INVALID_PERM_KEY"),INVALID_ATTR_PERM_KEY:a(e=>`Invalid attribute permission key value '${e}'`,"INVALID_ATTR_PERM_KEY"),INVALID_ROLE_JSON_KEYS:a(e=>`Invalid ${e.length>1?"keys":"key"} in JSON body - '${e.join("', '")}'`,"INVALID_ROLE_JSON_KEYS"),MISMATCHED_TABLE_ATTR_PERMS:a(e=>`You have a conflict with TABLE permissions for '${e}' being false and ATTRIBUTE permissions being true`,"MISMATCHED_TABLE_ATTR_PERMS"),OUTDATED_PERMS_TRANSLATION_ERROR:"This instance was recently upgraded and uses our new role permissions structure. Please login to this instance in HarperDB Studio, go to 'Roles', and click 'Update Role Permission' for all standard roles to migrate them to the new structure.",ROLE_ALREADY_EXISTS:a(e=>`A role with name '${e}' already exists`,"ROLE_ALREADY_EXISTS"),ROLE_NOT_FOUND:"Role not found",ROLE_PERMS_ERROR:"Errors in the role permissions JSON provided",SCHEMA_PERM_ERROR:a(e=>`Your role does not have permission to view database metadata for '${e}'`,"SCHEMA_PERM_ERROR"),SCHEMA_TABLE_PERM_ERROR:a((e,t)=>`Your role does not have permission to view database.table metadata for '${e}.${t}'`,"SCHEMA_TABLE_PERM_ERROR"),SU_ROLE_MISSING_ERROR:"Missing 'super_user' key/value in permission set",SU_CU_ROLE_BOOLEAN_ERROR:a(e=>`Value for '${e}' permission must be a boolean`,"SU_CU_ROLE_BOOLEAN_ERROR"),STRUCTURE_USER_ROLE_TYPE_ERROR:a(e=>`Value for '${e}' permission must be a boolean or Array`,"STRUCTURE_USER_ROLE_TYPE_ERROR"),SU_CU_ROLE_NO_PERMS_ALLOWED:a(e=>`Roles with '${e}' set to true cannot have other permissions set.`,"SU_CU_ROLE_NO_PERMS_ALLOWED"),SU_CU_ROLE_COMBINED_ERROR:"Roles cannot have both 'super_user' and 'cluster_user' values included in their permissions set.",TABLE_PERM_MISSING:a(e=>`Missing table ${e.toUpperCase()} permission`,"TABLE_PERM_MISSING"),TABLE_PERM_NOT_BOOLEAN:a(e=>`Table ${e.toUpperCase()} permission must be a boolean`,"TABLE_PERM_NOT_BOOLEAN")},I4={ATTR_NOT_FOUND:a((e,t,r)=>`Attribute '${r}' does not exist on '${e}.${t}'`,"ATTR_NOT_FOUND"),ATTR_EXISTS_ERR:a((e,t,r)=>`Attribute '${r}' already exists in ${e}.${t}'`,"ATTR_EXISTS_ERR"),DESCRIBE_ALL_ERR:"There was an error during describeAll. Please check the logs and try again.",INVALID_TABLE_ERR:a(e=>`Invalid table ${JSON.stringify(e)}`,"INVALID_TABLE_ERR"),SCHEMA_NOT_FOUND:a(e=>`database '${e}' does not exist`,"SCHEMA_NOT_FOUND"),SCHEMA_EXISTS_ERR:a(e=>`database '${e}' already exists`,"SCHEMA_EXISTS_ERR"),TABLE_EXISTS_ERR:a((e,t)=>`Table '${t}' already exists in '${e}'`,"TABLE_EXISTS_ERR"),SCHEMA_REQUIRED_ERR:"database is required",TABLE_NOT_FOUND:a((e,t)=>`Table '${e}.${t}' does not exist`,"TABLE_NOT_FOUND"),TABLE_REQUIRED_ERR:"table is required"},C4={OUTER_JOIN_TRANSLATION_ERROR:"There was an error translating the final SQL outer join data."},P4={ALTER_USER_DUP_ROLES:a(e=>`Update failed. There are duplicates for the '${e}' role which is not allowed. Update your roles and try again.`,"ALTER_USER_DUP_ROLES"),ALTER_USER_ROLE_NOT_FOUND:a(e=>`Update failed. Requested '${e}' role not found.`,"ALTER_USER_ROLE_NOT_FOUND"),DUP_ROLES_FOUND:a(e=>`Multiple ${e} roles found. Roles must have unique 'role' value. Please update and try again.`,"DUP_ROLES_FOUND"),ROLE_NAME_NOT_FOUND:a(e=>`${e} role not found`,"ROLE_NAME_NOT_FOUND"),USER_ALREADY_EXISTS:a(e=>`User ${e} already exists`,"USER_ALREADY_EXISTS"),USER_NOT_EXIST:a(e=>`User ${e} does not exist`,"USER_NOT_EXIST")},ZD={INVALID_DATE:"Invalid date, must be in ISO-8601 format (YYYY-MM-DD).",SEARCH_CONDITIONS_INVALID_SORT_ATTRIBUTE:a(e=>`invalid sort attribute '${e}', the attribute must either be the table's hash attribute or an attribute used in conditions.`,"SEARCH_CONDITIONS_INVALID_SORT_ATTRIBUTE")},eL={INVALID_ITC_DATA_TYPE:"Invalid ITC event data type, must be an object",MISSING_TYPE:"ITC event missing 'type'",MISSING_MSG:"ITC event missing 'message'",MISSING_ORIGIN:"ITC event message missing 'originator' property",INVALID_EVENT:a(e=>`ITC server received invalid event type: ${e}`,"INVALID_EVENT")},D4={FUNCTION_STATUS:"Error getting custom function status, check the log for more details",GET_FUNCTIONS:"Error getting custom functions, check the log for more details",GET_FUNCTION:"Error getting custom function, check the log for more details",SET_FUNCTION:"Error setting custom function, check the log for more details",NO_PROJECT:"Project does not exist. Create one using 'add_custom_function_project'",PROJECT_EXISTS:"Project already exists",VALIDATION_ERR:"Error validating request, check the log for more details",NO_FILE:"File does not exist",BAD_FILE_NAME:"File name can only contain alphanumeric, dash and underscore characters",BAD_PROJECT_NAME:"Project name can only contain alphanumeric, dash and underscores characters",BAD_PACKAGE:"Packaged project must be base64-encoded tar file of project directory",DROP_FUNCTION:"Error dropping custom function, check the log for more details",ADD_FUNCTION:"Error adding custom function project, check the log for more details",DROP_FUNCTION_PROJECT:"Error dropping custom function project, check the log for more details",BAD_FILE_PATH:"Filepath must be valid, and contain the name of the tarball you wish to write",NOT_ENABLED:"Custom functions is not enabled, to enable set fastifyRoutes enabled to true in hdb/harperdb-config.yaml file.",BAD_SSH_KEY_NAME:"SSH key name can only contain alphanumeric, dash and underscore characters"},L4={CLUSTERING_NOT_ENABLED:"Clustering must be enabled to perform this operation."},M4={...XD,...y4,...A4,...N4,...w4,...I4,...C4,...P4,...O4,...ZD,...eL,...D4,...L4,...R4};tL.exports={CHECK_LOGS_WRAPPER:JD,HDB_ERROR_MSGS:M4,DEFAULT_ERROR_MSGS:QD,DEFAULT_ERROR_RESP:T4,HTTP_STATUS_CODES:jD,LMDB_ERRORS_ENUM:b4,AUTHENTICATION_ERROR_MSGS:XD,VALIDATION_ERROR_MSGS:ZD,ITC_ERRORS:eL}});var pe=P((lbe,sL)=>{"use strict";var pu=kn(),v4=X(),U4=(G(),D(q)),mm=class extends Error{static{a(this,"HdbError")}constructor(t,r,n,s,i){super(),Error.captureStackTrace(this,rL),this.statusCode=n||pu.HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR,this.http_resp_msg=r||(pu.DEFAULT_ERROR_MSGS[n]?pu.DEFAULT_ERROR_MSGS[n]:pu.DEFAULT_ERROR_MSGS[pu.HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR]),this.message=t.message?t.message:this.http_resp_msg,this.type=t.name,s&&(this.logLevel=s),typeof this.message!="string"&&(this.stack=t.stack),i&&v4[s](i)}},pR=class extends Error{static{a(this,"ClientError")}constructor(t,r){if(t instanceof Error)return t.statusCode=r||400,t;super(t),this.statusCode=r||400}},hR=class extends Error{static{a(this,"ServerError")}constructor(t,r){super(t),this.statusCode=r||500}};function rL(e,t,r,n=U4.LOG_LEVELS.ERROR,s=null,i=!1){if(nL(e))return e;let o=new mm(e,t,r,n,s);return i&&delete o.stack,o}a(rL,"handleHDBError");function nL(e){return e.__proto__.constructor.name===mm.name}a(nL,"isHDBError");sL.exports={isHDBError:nL,handleHDBError:rL,ClientError:pR,ServerError:hR,hdb_errors:pu}});var gt=P((dbe,dL)=>{"use strict";var Uf=(G(),D(q)),x4=ie(),fn=ae(),xf=require("path"),B4=require("minimist"),iL=require("fs-extra"),oL=require("lodash");fn.initSync();var{CONFIG_PARAMS:ga,DATABASES_PARAM_CONFIG:Df,SYSTEM_SCHEMA_NAME:Em}=Uf,Lf,Mf,