harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
1 lines • 937 kB
JavaScript
"use strict";var r5=Object.create;var hm=Object.defineProperty;var n5=Object.getOwnPropertyDescriptor;var s5=Object.getOwnPropertyNames;var i5=Object.getPrototypeOf,o5=Object.prototype.hasOwnProperty;var a=(e,t)=>hm(e,"name",{value:t,configurable:!0});var oe=(e,t)=>()=>(e&&(t=e(e=0)),t);var M=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ye=(e,t)=>{for(var r in t)hm(e,r,{get:t[r],enumerable:!0})},dU=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of s5(t))!o5.call(e,s)&&s!==r&&hm(e,s,{get:()=>t[s],enumerable:!(n=n5(t,s))||n.enumerable});return e};var R=(e,t,r)=>(r=e!=null?r5(i5(e)):{},dU(t||!e||!e.__esModule?hm(r,"default",{value:e,enumerable:!0}):r,e)),L=e=>dU(hm({},"__esModule",{value:!0}),e);var Lt=M((jCe,pU)=>{var{join:a5,dirname:fU}=require("node:path"),{existsSync:c5,readFileSync:l5}=require("node:fs");function u5(){let t=__dirname,r,n=0;for(;!c5(r=a5(t,"package.json"));)if(t===(t=fU(t))||n++>10)throw new Error("Could not find package root");return r}a(u5,"findPackageJson");var mU=u5(),d5=JSON.parse(l5(mU,"utf8")),f5=fU(mU);pU.exports={packageJson:d5,PACKAGE_ROOT:f5}});var J={};ye(J,{AUTH_AUDIT_STATUS:()=>di,AUTH_AUDIT_TYPES:()=>za,BACKUP_DIR_NAME:()=>lA,BOOT_PROPS_FILE_NAME:()=>U5,BOOT_PROP_PARAMS:()=>_U,CLUSTERING_FLAG:()=>dA,CLUSTERING_PROCESSES:()=>R5,CLUSTER_MESSAGE_TYPE_ENUM:()=>uA,CLUSTER_OPERATIONS:()=>J5,CONFIG_PARAMS:()=>U,CONFIG_PARAM_MAP:()=>gU,DATABASES_DIR_NAME:()=>il,DATABASES_PARAM_CONFIG:()=>t8,DEFAULT_DATABASE_NAME:()=>A5,ESCAPED_FORWARD_SLASH_REGEX:()=>v5,FORWARD_SLASH_REGEX:()=>L5,FUNC_VAL:()=>f8,GEO_CONVERSION_ENUM:()=>Z5,HDB_COMPONENT_CONFIG_FILE:()=>h5,HDB_CONFIG_FILE:()=>m5,HDB_DEFAULT_CONFIG_FILE:()=>p5,HDB_FILE_PERMISSIONS:()=>B5,HDB_HOME_DIR_NAME:()=>M5,HDB_PID_FILE:()=>b5,HDB_PROCESS_SERVICES:()=>y5,HDB_PROC_NAME:()=>E5,HDB_RESTART_SCRIPT:()=>_5,HDB_ROOT_DIR_NAME:()=>iA,HDB_SETTINGS_NAMES:()=>gm,HDB_SUPPORT_ADDRESS:()=>EU,INFO_TABLE_HASH_ATTRIBUTE:()=>$5,INSERT_MAX_CHARACTER_SIZE:()=>G5,INSTALL_PROMPTS:()=>H5,ITC_EVENT_TYPES:()=>A_,JOB_STATUS_ENUM:()=>W5,JOB_TYPE_ENUM:()=>r8,JWT_ENUM:()=>Sm,LAUNCH_SERVICE_SCRIPTS:()=>w5,LEGACY_CONFIG_PARAMS:()=>e8,LEGACY_DATABASES_DIR_NAME:()=>y_,LICENSE_FILE_NAME:()=>Y5,LICENSE_KEY_DIR_NAME:()=>cA,LICENSE_VALUES:()=>n8,LOG_LEVELS:()=>Em,LOG_NAMES:()=>I5,METADATA_PROPERTY:()=>o8,NODE_ERROR_CODES:()=>i8,OPERATIONS_ENUM:()=>W,PERMS_CRUD_ENUM:()=>u8,PERMS_UPDATE_RELEASE_TIMESTAMP:()=>l8,PRE_4_0_0_VERSION:()=>m8,PROCESS_DESCRIPTORS:()=>T5,PROCESS_NAME_ENV_PROP:()=>k5,RAM_ALLOCATION_ENUM:()=>s8,READ_AUDIT_LOG_SEARCH_TYPES_ENUM:()=>b_,REG_KEY_FILE_NAME:()=>K5,RESTART_TIMEOUT_MS:()=>x5,ROLE_TYPES_ENUM:()=>N5,S3_BUCKET_AUTH_KEYS:()=>z5,SEARCH_NOT_FOUND_MESSAGE:()=>O5,SEARCH_WILDCARDS:()=>d8,SERVICE_ACTIONS_ENUM:()=>X5,SUPPORT_HELP_MSG:()=>C5,SYSTEM_DEFAULT_ATTRIBUTE_NAMES:()=>V5,SYSTEM_SCHEMA_NAME:()=>_m,SYSTEM_TABLE_NAMES:()=>ku,THREAD_TYPES:()=>mA,TIME_STAMP_NAMES:()=>c8,TIME_STAMP_NAMES_ENUM:()=>a8,TRANSACTIONS_DIR_NAME:()=>F5,UNICODE_FORWARD_SLASH:()=>D5,UNICODE_PERIOD:()=>P5,UPGRADE_JSON_FIELD_NAMES_ENUM:()=>q5,VALID_S3_FILE_TYPES:()=>j5,VALID_SQL_OPS_ENUM:()=>Q5,VALUE_SEARCH_COMPARATORS:()=>R_,VALUE_SEARCH_COMPARATORS_REVERSE_LOOKUP:()=>fA});var S_,T_,m5,p5,iA,h5,E5,_5,hU,sA,oA,aA,g5,S5,T5,y5,R5,b5,A5,I5,Em,w5,N5,EU,C5,O5,P5,L5,D5,v5,_m,M5,cA,U5,x5,B5,il,y_,F5,lA,k5,_U,H5,G5,q5,ku,$5,V5,K5,Y5,W5,W,j5,z5,Q5,J5,X5,Z5,gm,e8,U,gU,t8,r8,uA,n8,s8,i8,o8,dA,SU,TU,a8,c8,l8,R_,fA,u8,d8,f8,b_,Sm,A_,mA,m8,di,za,G=oe(()=>{S_=require("node:path"),T_=R(Lt()),m5="harperdb-config.yaml",p5="defaultConfig.yaml",iA="hdb",h5="config.yaml",E5="harperdb.js",_5="restartHdb.js",hU="HarperDB",sA="Custom Functions",oA="Clustering Hub",aA="Clustering Leaf",g5="Clustering Ingest Service",S5="Clustering Reply Service",T5={HDB:hU,CLUSTERING_HUB:oA,CLUSTERING_LEAF:aA,CLUSTERING_INGEST_SERVICE:g5,CLUSTERING_REPLY_SERVICE:S5,CUSTOM_FUNCTIONS:sA,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"},y5={harperdb:hU,"clustering hub":oA,"clustering leaf":aA,"custom functions":sA,custom_functions:sA,clustering:"clustering","clustering config":"clustering config",clustering_config:"clustering_config",http_workers:"http_workers",http:"http"},R5={CLUSTERING_HUB_PROC_DESCRIPTOR:oA,CLUSTERING_LEAF_PROC_DESCRIPTOR:aA},b5="hdb.pid",A5="data",I5={HDB:"hdb.log",INSTALL:"install.log",CLUSTERING_HUB:"clustering_hub.log",CLUSTERING_LEAF:"clustering_leaf.log"},Em={NOTIFY:"notify",FATAL:"fatal",ERROR:"error",WARN:"warn",INFO:"info",DEBUG:"debug",TRACE:"trace"},w5={MAIN:"bin/harperdb.js",NATS_INGEST_SERVICE:(0,S_.join)(T_.PACKAGE_ROOT,"launchServiceScripts/launchNatsIngestService.js"),NATS_REPLY_SERVICE:(0,S_.join)(T_.PACKAGE_ROOT,"launchServiceScripts/launchNatsReplyService.js"),NODES_UPGRADE_4_0_0:(0,S_.join)(T_.PACKAGE_ROOT,"launchServiceScripts/launchUpdateNodes4-0-0.js")},N5={SUPER_USER:"super_user",CLUSTER_USER:"cluster_user"},EU="support@harperdb.io",C5=`For support, please submit a request at https://harperdbhelp.zendesk.com/hc/en-us/requests/new or contact ${EU}`,O5="None of the specified records were found.",P5="U+002E",L5=/\//g,D5="U+002F",v5=/U\+002F/g,_m="system",M5=".harperdb",cA="keys",U5="hdb_boot_properties.file",x5=6e4,B5=448,il="database",y_="schema",F5="transactions",lA="backup",k5="PROCESS_NAME",_U={SETTINGS_PATH_KEY:"settings_path"},H5={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"},G5=250,q5={DATA_VERSION:"data_version",UPGRADE_VERSION:"upgrade_version"},ku={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"},$5="info_id",V5={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"},K5="060493.ks",Y5=".license",W5={CREATED:"CREATED",IN_PROGRESS:"IN_PROGRESS",COMPLETE:"COMPLETE",ERROR:"ERROR"},W={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",DESCRIBE_METRIC:"describe_metric",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_REGISTRATION_INFO:"registration_info",GET_FINGERPRINT:"get_fingerprint",SET_LICENSE:"set_license",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",CLEANUP_ORPHAN_BLOBS:"cleanup_orphan_blobs",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",GET_SSH_KEY:"get_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",GET_ANALYTICS:"get_analytics",LIST_METRICS:"list_metrics",GET_STATUS:"get_status",SET_STATUS:"set_status",CLEAR_STATUS:"clear_status",INSTALL_USAGE_LICENSE:"install_usage_license",GET_USAGE_LICENSES:"get_usage_licenses"},j5={CSV:".csv",JSON:".json"},z5={AWS_ACCESS_KEY:"aws_access_key_id",AWS_SECRET:"aws_secret_access_key",AWS_BUCKET:"bucket",AWS_FILE_KEY:"key",REGION:"region"},Q5={SELECT:"select",INSERT:"insert",UPDATE:"update",DELETE:"delete"},J5={[W.INSERT]:W.INSERT,[W.UPDATE]:W.UPDATE,[W.UPSERT]:W.UPSERT,[W.DELETE]:W.DELETE},X5={DEV:"dev",RUN:"run",START:"start",INSTALL:"install",STOP:"stop",RESTART:"restart",VERSION:"version",UPGRADE:"upgrade",HELP:"help",STATUS:"status",OPERATION:"operation",RENEWCERTS:"renew-certs",COPYDB:"copy-db"},Z5={point:"point",lineString:"lineString",multiLineString:"multiLineString",multiPoint:"multiPoint",multiPolygon:"multiPolygon",polygon:"polygon"},gm={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"},e8={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"},U={ANALYTICS_AGGREGATEPERIOD:"analytics_aggregatePeriod",ANALYTICS_REPLICATE:"analytics_replicate",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",THREADS_HEAPSNAPSHOTNEARLIMIT:"threads_heapSnapshotNearLimit",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_MTLS_CERTIFICATEVERIFICATION:"http_mtls_certificateVerification",HTTP_MTLS_CERTIFICATEVERIFICATION_FAILUREMODE:"http_mtls_certificateVerification_failureMode",HTTP_MTLS_CERTIFICATEVERIFICATION_CRL:"http_mtls_certificateVerification_crl",HTTP_MTLS_CERTIFICATEVERIFICATION_CRL_TIMEOUT:"http_mtls_certificateVerification_crl_timeout",HTTP_MTLS_CERTIFICATEVERIFICATION_CRL_CACHETTL:"http_mtls_certificateVerification_crl_cacheTtl",HTTP_MTLS_CERTIFICATEVERIFICATION_CRL_FAILUREMODE:"http_mtls_certificateVerification_crl_failureMode",HTTP_MTLS_CERTIFICATEVERIFICATION_CRL_GRACEPERIOD:"http_mtls_certificateVerification_crl_gracePeriod",HTTP_MTLS_CERTIFICATEVERIFICATION_OCSP:"http_mtls_certificateVerification_ocsp",HTTP_MTLS_CERTIFICATEVERIFICATION_OCSP_TIMEOUT:"http_mtls_certificateVerification_ocsp_timeout",HTTP_MTLS_CERTIFICATEVERIFICATION_OCSP_CACHETTL:"http_mtls_certificateVerification_ocsp_cacheTtl",HTTP_MTLS_CERTIFICATEVERIFICATION_OCSP_ERRORCACHETTL:"http_mtls_certificateVerification_ocsp_errorCacheTtl",HTTP_MTLS_CERTIFICATEVERIFICATION_OCSP_FAILUREMODE:"http_mtls_certificateVerification_ocsp_failureMode",HTTP_MAXHEADERSIZE:"http_maxHeaderSize",HTTP_THREADRANGE:"http_threadRange",HTTP_REQUESTQUEUELIMIT:"http_requestQueueLimit",HTTP_MAXREQUESTBODYSIZE:"http_maxRequestBodySize",HTTP_HTTP2:"http_http2",LICENSE_MODE:"license_mode",LICENSE_REGION:"license_region",LOCALSTUDIO_ENABLED:"localStudio_enabled",LOGGING_COLORS:"logging_colors",LOGGING_CONSOLE:"logging_console",LOGGING_FILE:"logging_file",LOGGING_LEVEL:"logging_level",LOGGING_ROOT:"logging_root",LOGGING_EXTERNAL_LEVEL:"logging_external_level",LOGGING_EXTERNAL_TAG:"logging_external_tag",LOGGING_EXTERNAL_PATH:"logging_external_path",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_NETWORK_MAXREQUESTBODYSIZE:"operationsApi_network_maxRequestBodySize",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_MTLS_CERTIFICATEVERIFICATION:"replication_mtls_certificateVerification",REPLICATION_MTLS_CERTIFICATEVERIFICATION_FAILUREMODE:"replication_mtls_certificateVerification_failureMode",REPLICATION_MTLS_CERTIFICATEVERIFICATION_CRL:"replication_mtls_certificateVerification_crl",REPLICATION_MTLS_CERTIFICATEVERIFICATION_CRL_TIMEOUT:"replication_mtls_certificateVerification_crl_timeout",REPLICATION_MTLS_CERTIFICATEVERIFICATION_CRL_CACHETTL:"replication_mtls_certificateVerification_crl_cacheTtl",REPLICATION_MTLS_CERTIFICATEVERIFICATION_CRL_FAILUREMODE:"replication_mtls_certificateVerification_crl_failureMode",REPLICATION_MTLS_CERTIFICATEVERIFICATION_CRL_GRACEPERIOD:"replication_mtls_certificateVerification_crl_gracePeriod",REPLICATION_MTLS_CERTIFICATEVERIFICATION_OCSP:"replication_mtls_certificateVerification_ocsp",REPLICATION_MTLS_CERTIFICATEVERIFICATION_OCSP_TIMEOUT:"replication_mtls_certificateVerification_ocsp_timeout",REPLICATION_MTLS_CERTIFICATEVERIFICATION_OCSP_CACHETTL:"replication_mtls_certificateVerification_ocsp_cacheTtl",REPLICATION_MTLS_CERTIFICATEVERIFICATION_OCSP_ERRORCACHETTL:"replication_mtls_certificateVerification_ocsp_errorCacheTtl",REPLICATION_MTLS_CERTIFICATEVERIFICATION_OCSP_FAILUREMODE:"replication_mtls_certificateVerification_ocsp_failureMode",REPLICATION_SHARD:"replication_shard",REPLICATION_BLOBTIMEOUT:"replication_blobTimeout",REPLICATION_BLOBCONCURRENCY:"replication_blobConcurrency",REPLICATION_RECORDCONCURRENCY:"replication_recordConcurrency",REPLICATION_FAILOVER:"replication_failOver",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_MAXTRANSACTIONOPENTIME:"storage_maxTransactionOpenTime",STORAGE_DEBUGLONGTRANSACTIONS:"storage_debugLongTransactions",STORAGE_PATH:"storage_path",STORAGE_BLOBPATHS:"storage_blobPaths",STORAGE_BLOBCLEANUPSPEED:"storage_blobCleanupSpeed",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"},gU={settings_path:_U.SETTINGS_PATH_KEY,hdb_root_key:U.ROOTPATH,hdb_root:U.ROOTPATH,rootpath:U.ROOTPATH,server_port_key:U.OPERATIONSAPI_NETWORK_PORT,server_port:U.OPERATIONSAPI_NETWORK_PORT,cert_key:U.TLS_CERTIFICATE,certificate:U.TLS_CERTIFICATE,private_key_key:U.TLS_PRIVATEKEY,private_key:U.TLS_PRIVATEKEY,http_secure_enabled_key:U.OPERATIONSAPI_NETWORK_HTTPS,https_on:U.OPERATIONSAPI_NETWORK_HTTPS,cors_enabled_key:U.OPERATIONSAPI_NETWORK_CORS,cors_on:U.OPERATIONSAPI_NETWORK_CORS,cors_whitelist_key:U.OPERATIONSAPI_NETWORK_CORSACCESSLIST,cors_whitelist:U.OPERATIONSAPI_NETWORK_CORSACCESSLIST,cors_accesslist_key:U.OPERATIONSAPI_NETWORK_CORSACCESSLIST,cors_accesslist:U.OPERATIONSAPI_NETWORK_CORSACCESSLIST,log_level_key:U.LOGGING_LEVEL,log_level:U.LOGGING_LEVEL,log_path_key:U.LOGGING_ROOT,log_path:U.LOGGING_ROOT,clustering_node_name_key:U.CLUSTERING_NODENAME,node_name:U.CLUSTERING_NODENAME,clustering_enabled_key:U.CLUSTERING_ENABLED,clustering:U.CLUSTERING_ENABLED,max_http_threads:U.THREADS_COUNT,max_hdb_processes:U.THREADS_COUNT,server_timeout_key:U.OPERATIONSAPI_NETWORK_TIMEOUT,server_timeout_ms:U.OPERATIONSAPI_NETWORK_TIMEOUT,server_keep_alive_timeout_key:U.OPERATIONSAPI_NETWORK_KEEPALIVETIMEOUT,server_keep_alive_timeout:U.OPERATIONSAPI_NETWORK_KEEPALIVETIMEOUT,server_headers_timeout_key:U.OPERATIONSAPI_NETWORK_HEADERSTIMEOUT,server_headers_timeout:U.OPERATIONSAPI_NETWORK_HEADERSTIMEOUT,disable_transaction_log_key:U.LOGGING_AUDITLOG,disable_transaction_log:U.LOGGING_AUDITLOG,operation_token_timeout_key:U.AUTHENTICATION_OPERATIONTOKENTIMEOUT,operation_token_timeout:U.AUTHENTICATION_OPERATIONTOKENTIMEOUT,refresh_token_timeout_key:U.AUTHENTICATION_REFRESHTOKENTIMEOUT,refresh_token_timeout:U.AUTHENTICATION_REFRESHTOKENTIMEOUT,custom_functions_port_key:U.HTTP_PORT,custom_functions_port:U.HTTP_PORT,custom_functions_directory_key:U.COMPONENTSROOT,custom_functions_directory:U.COMPONENTSROOT,max_custom_function_processes:U.THREADS_COUNT,logging_console:U.LOGGING_CONSOLE,log_to_file:U.LOGGING_FILE,log_to_stdstreams:U.LOGGING_STDSTREAMS,local_studio_on:U.LOCALSTUDIO_ENABLED,clustering_port:U.CLUSTERING_HUBSERVER_CLUSTER_NETWORK_PORT,clustering_user:U.CLUSTERING_USER,customfunctions_network_port:U.HTTP_PORT,customfunctions_tls_certificate:U.TLS_CERTIFICATE,customfunctions_network_cors:U.HTTP_CORS,customfunctions_network_corsaccesslist:U.HTTP_CORSACCESSLIST,customfunctions_network_headerstimeout:U.HTTP_HEADERSTIMEOUT,customfunctions_network_https:U.CUSTOMFUNCTIONS_NETWORK_HTTPS,customfunctions_network_keepalivetimeout:U.HTTP_KEEPALIVETIMEOUT,customfunctions_tls_privatekey:U.TLS_PRIVATEKEY,customfunctions_tls_certificateauthority:U.TLS_CERTIFICATEAUTHORITY,customfunctions_network_timeout:U.HTTP_TIMEOUT,customfunctions_tls:U.TLS,http_threads:U.THREADS_COUNT,threads:U.THREADS_COUNT,threads_count:U.THREADS_COUNT,customfunctions_processes:U.THREADS_COUNT,customfunctions_root:U.COMPONENTSROOT,operationsapi_root:U.ROOTPATH};for(let e in U){let t=U[e];gU[t.toLowerCase()]=t}t8={TABLES:"tables",PATH:"path",AUDIT_PATH:"auditPath"},r8={csv_file_load:"csv_file_load",csv_data_load:W.CSV_DATA_LOAD,csv_url_load:W.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"},uA={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"},n8={VERSION_DEFAULT:"2.2.0"},s8={DEVELOPMENT:8192,DEFAULT:512},i8={ENOENT:"ENOENT",EACCES:"EACCES",EEXIST:"EEXIST",ERR_INVALID_ARG_TYPE:"ERR_INVALID_ARG_TYPE"},o8=Symbol("metadata"),dA="__clustering__",SU="__createdtime__",TU="__updatedtime__",a8={CREATED_TIME:SU,UPDATED_TIME:TU},c8=[SU,TU],l8=15984864e5,R_={LESS:"<",LESS_OR_EQ:"<=",GREATER:">",GREATER_OR_EQ:">=",BETWEEN:"..."},fA={"<":"LESS","<=":"LESS_OR_EQ",">":"GREATER",">=":"GREATER_OR_EQ","...":"BETWEEN"},u8={READ:"read",INSERT:"insert",UPDATE:"update",DELETE:"delete"},d8=["*","%"],f8="func_val",b_={HASH_VALUE:"hash_value",TIMESTAMP:"timestamp",USERNAME:"username"},Sm={JWT_PRIVATE_KEY_NAME:".jwtPrivate.key",JWT_PUBLIC_KEY_NAME:".jwtPublic.key",JWT_PASSPHRASE_NAME:".jwtPass"},A_={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",COMPONENT_STATUS_REQUEST:"component_status_request",COMPONENT_STATUS_RESPONSE:"component_status_response"},mA={HTTP:"http"},m8="3.x.x",di={SUCCESS:"success",FAILURE:"failure"},za={AUTHENTICATION:"authentication",AUTHORIZATION:"authorization"}});var Hu=M((QCe,bU)=>{"use strict";var yU=require("minimist");bU.exports=p8;function p8(e=[],t=!1){if(!Array.isArray(e))return{};let r,n;t?(r=RU(process.env),n=RU(yU(process.argv))):(r=process.env,n=yU(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(p8,"assignCMDENVVariables");function RU(e){let t,r=Object.keys(e),n=r.length,s={};for(;n--;)t=r[n],s[t.toLowerCase()]=e[t];return s}a(RU,"objKeysToLowerCase")});var fi=M(ss=>{"use strict";global.Resource=ss.Resource=void 0;global.tables=ss.tables={};global.databases=ss.databases={};global.getUser=ss.getUser=void 0;global.authenticateUser=ss.authenticateUser=void 0;global.server=ss.server={};global.contentTypes=ss.contentTypes=null;global.threads=ss.threads=[];global.logger={};global.RequestTarget=ss.RequestTarget=void 0;global.operation=ss.operation=void 0;ss._assignPackageExport=(e,t)=>{global[e]=ss[e]=t}});var pt=M((ZCe,AU)=>{"use strict";var Un=require("validate.js");Un.validators.type=function(e,t,r,n){return e===null||typeof e>"u"||Un.validators.type.checks[t](e)?null:` must be a '${t}' value`};Un.validators.type.checks={Object:a(function(e){return Un.isObject(e)&&!Un.isArray(e)},"Object"),Array:Un.isArray,Integer:Un.isInteger,Number:Un.isNumber,String:Un.isString,Date:Un.isDate,Boolean:a(function(e){return typeof e=="boolean"},"Boolean")};Un.validators.hasValidFileExt=function(e,t){return Un.isString(e)?e===""?"can't be blank":t.filter(r=>e.endsWith(r)).length>0?null:`must include one of the following valid file extensions - '${t.join("', '")}'`:null};AU.exports={validateObject:h8,validateObjectAsync:E8,validateBySchema:_8};function h8(e,t){if(!e||!t)return new Error("validateObject parameters were null");let r=Un(e,t,{format:"flat"});return r?new Error(r):null}a(h8,"validateObject");async function E8(e,t){if(!e||!t)return new Error("validateObject parameters were null");try{await Un.async(e,t,{format:"flat"})}catch(r){let n=r.join(",");return new Error(n)}return null}a(E8,"validateObjectAsync");function _8(e,t){let r=t.validate(e,{allowUnknown:!0,abortEarly:!1,errors:{wrap:{label:"'"}}});if(r.error)return new Error(r.error.message)}a(_8,"validateBySchema")});var hA=M((tOe,PU)=>{"use strict";var CU=require("fs-extra"),Re=require("joi"),g8=require("os"),{boolean:Ke,string:gt,number:pr,array:Qa}=Re.types(),{totalmem:IU}=require("os"),ol=require("path"),S8=Z(),pA=ue(),wU=(G(),L(J)),T8=pt(),NU="log",y8="components",R8="Invalid logging.rotation.maxSize unit. Available units are G, M or K",b8="Invalid logging.rotation.interval unit. Available units are D, H or M (minutes)",A8="Invalid logging.rotation.maxSize value. Value should be a number followed by unit e.g. '10M'",I8="Invalid logging.rotation.interval value. Value should be a number followed by unit e.g. '10D'",w8="rootPath config parameter is undefined",xn=Re.alternatives([pr.min(0),gt]).optional().empty(null),I_=Re.alternatives([Qa.items(gt,{host:gt.required(),port:xn},{hostname:gt.required(),port:xn}).empty(null),Qa.items(gt)]),Ki,OU=!1;PU.exports={configValidator:N8,routesValidator:v8,routeConstraints:I_};function N8(e,t=!1){if(OU=t,Ki=e.rootPath,pA.isEmpty(Ki))throw w8;let r=Ke.optional(),n=pr.min(0).max(1e3).empty(null).default(D8),s=gt.pattern(/^[\\/]$|([\\/a-zA-Z_0-9:-]+)+$/,"directory path").empty(null).default(Tm),i=gt.optional().empty(null),o=gt.pattern(/^[^\s.,*>]+$/).messages({"string.pattern.base":"{:#label} invalid, must not contain ., * or >"}).empty(null).required(),c=Re.string().empty(null).default(Tm),l=Re.custom(O8).empty(null).default(Tm),u=e.clustering?.enabled,d=Re.object({certificate:i,certificateAuthority:i,privateKey:i}),f;return u===!0?f=Re.object({enabled:r,hubServer:Re.object({cluster:Re.object({name:Re.required().empty(null),network:Re.object({port:xn,routes:I_}).required()}).required(),leafNodes:Re.object({network:Re.object({port:xn}).required()}).required(),network:Re.object({port:xn}).required()}).required(),leafServer:Re.object({network:Re.object({port:xn,routes:I_}).required(),streams:Re.object({maxAge:pr.min(120).allow(null).optional(),maxBytes:pr.min(1).allow(null).optional(),maxMsgs:pr.min(1).allow(null).optional(),path:c}).required()}).required(),logLevel:Re.valid("error","warn","info","debug","trace"),nodeName:o,republishMessages:Ke.optional(),databaseLevel:Ke.optional(),tls:Re.object({certificate:i,certificateAuthority:i,privateKey:i,insecure:Ke.required(),verify:Ke.optional()}),user:gt.optional().empty(null)}).optional():f=Re.object({enabled:r,tls:Re.object({certificate:i,certificateAuthority:i,privateKey:i,insecure:Ke.optional()})}).optional(),Re.object({authentication:Re.alternatives(Re.object({authorizeLocal:Ke,cacheTTL:pr.required(),cookie:Re.object({domains:Qa.items(gt).optional(),expires:gt.optional()}),enableSessions:Ke,hashFunction:gt.valid("md5","sha256","argon2id").optional().empty(null)}),Ke).optional(),analytics:Re.object({aggregatePeriod:pr,replicate:Ke.optional()}),replication:Re.object({hostname:Re.alternatives(gt,pr).optional().empty(null),url:gt.optional().empty(null),port:xn,securePort:xn,routes:Qa.optional().empty(null),databases:Re.alternatives(gt,Qa),enableRootCAs:Ke.optional(),copyTablesToCatchUp:Ke.optional()}).optional(),componentsRoot:s.optional(),clustering:f,localStudio:Re.object({enabled:r}).required(),logging:Re.object({auditAuthEvents:Re.object({logFailed:Ke,logSuccessful:Ke}),file:Ke.required(),level:Re.valid("notify","fatal","error","warn","info","debug","trace"),rotation:Re.object({enabled:Ke.optional(),compress:Ke.optional(),interval:gt.custom(L8).optional().empty(null),maxSize:gt.custom(P8).optional().empty(null),path:gt.optional().empty(null).default(Tm)}).required(),root:s,stdStreams:Ke.required(),auditLog:Ke.required()}).required(),operationsApi:Re.object({network:Re.object({cors:Ke.optional(),corsAccessList:Qa.optional(),headersTimeout:pr.min(1).optional(),keepAliveTimeout:pr.min(1).optional(),port:xn,domainSocket:Re.optional().empty("hdb/operations-server").default(Tm),securePort:xn,timeout:pr.min(1).optional()}).optional(),tls:Re.alternatives([Re.array().items(d),d])}).required(),rootPath:gt.pattern(/^[\\/]$|([\\/a-zA-Z_0-9:-]+)+$/,"directory path").required(),mqtt:Re.object({network:Re.object({port:xn,securePort:xn,mtls:Re.alternatives([Ke.optional(),Re.object({user:gt.optional(),certificateAuthority:i,required:Ke.optional()})])}).required(),webSocket:Ke.optional(),requireAuthentication:Ke.optional()}),http:Re.object({compressionThreshold:pr.optional(),cors:Ke.optional(),corsAccessList:Qa.optional(),headersTimeout:pr.min(1).optional(),port:xn,securePort:xn,maxHeaderSize:pr.optional(),mtls:Re.alternatives([Ke.optional(),Re.object({user:gt.optional(),certificateAuthority:i,required:Ke.optional()})]),threadRange:Re.alternatives([Qa.optional(),gt.optional()])}).required(),threads:Re.alternatives(n.optional(),Re.object({count:n.optional(),debug:Re.alternatives(Ke.optional(),Re.object({startingPort:pr.min(1).optional(),host:gt.optional(),waitForDebugger:Ke.optional()})),maxHeapMemory:pr.min(0).optional()})),storage:Re.object({writeAsync:Ke.required(),overlappingSync:Ke.optional(),caching:Ke.optional(),compression:Re.alternatives([Ke.optional(),Re.object({dictionary:gt.optional(),threshold:pr.optional()})]),compactOnStart:Ke.optional(),compactOnStartKeepBackup:Ke.optional(),noReadAhead:Ke.optional(),path:l,prefetchWrites:Ke.optional(),maxFreeSpaceToLoad:pr.optional(),maxFreeSpaceToRetain:pr.optional()}).required(),ignoreScripts:Ke.optional(),tls:Re.alternatives([Re.array().items(d),d])}).validate(e,{allowUnknown:!0,abortEarly:!1,errors:{wrap:{label:"'"}}})}a(N8,"configValidator");function C8(e){return OU||CU.existsSync(e)?null:`Specified path ${e} does not exist.`}a(C8,"doesPathExist");function O8(e,t){Re.assert(e,gt.pattern(/^[\\/]$|([\\/a-zA-Z_0-9:-]+)+$/,"directory path"));let r=C8(e);if(r)return t.message(r)}a(O8,"validatePath");function P8(e,t){let r=e.slice(-1);if(r!=="G"&&r!=="M"&&r!=="K")return t.message(R8);let n=e.slice(0,-1);return isNaN(parseInt(n))?t.message(A8):e}a(P8,"validateRotationMaxSize");function L8(e,t){let r=e.slice(-1);if(r!=="D"&&r!=="H"&&r!=="M")return t.message(b8);let n=e.slice(0,-1);return isNaN(parseInt(n))?t.message(I8):e}a(L8,"validateRotationInterval");function D8(e,t){let r=t.state.path.join("."),n=g8.cpus().length,s=n-1;s<=2&&(s=2);let i=process.constrainedMemory?.()||IU();return i=Math.round(Math.min(i,IU())/1e6),s=Math.max(Math.min(s,Math.round((i-750)/300)),1),S8.info(`Detected ${n} cores and ${i}MB on this machine, defaulting ${r} to ${s}`),s}a(D8,"setDefaultThreads");function Tm(e,t){let r=t.state.path.join(".");if(!pA.isEmpty(t.original)&&r!=="operationsApi.network.domainSocket")return t.original;if(pA.isEmpty(Ki))throw new Error(`Error setting default root for: ${r}. HDB root is not defined`);switch(r){case"componentsRoot":return ol.join(Ki,y8);case"logging.root":return ol.join(Ki,NU);case"clustering.leafServer.streams.path":return ol.join(Ki,"clustering","leaf");case"storage.path":let n=ol.join(Ki,wU.LEGACY_DATABASES_DIR_NAME);return CU.existsSync(n)?n:ol.join(Ki,wU.DATABASES_DIR_NAME);case"logging.rotation.path":return ol.join(Ki,NU);case"operationsApi.network.domainSocket":return r==null?null:ol.join(Ki,"operations-server");default:throw new Error(`Error setting default root for config parameter: ${r}. Unrecognized config parameter`)}}a(Tm,"setDefaultRoot");function v8(e){let t=Re.object({routes:I_});return T8.validateBySchema({routes:e},t)}a(v8,"routesValidator")});var Cr=M((nOe,DU)=>{"use strict";var M8="__dbis__",U8="__txns__",x8="__environment_name__",B8="__dbi_defintion__",F8={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"},k8=["__createdtime__","__updatedtime__"],H8="\uFFFF",LU={TIMESTAMP:"timestamp",HASH_VALUE:"hash_value",USER_NAME:"user_name"},G8=Object.values(LU);DU.exports={AUDIT_STORE_NAME:U8,INTERNAL_DBIS_NAME:M8,DBI_DEFINITION_NAME:B8,SEARCH_TYPES:F8,TIMESTAMP_NAMES:k8,MAX_SEARCH_KEY_LENGTH:256,ENVIRONMENT_NAME_KEY:x8,TRANSACTIONS_DBI_NAMES_ENUM:LU,TRANSACTIONS_DBIS:G8,OVERFLOW_MARKER:H8}});var En=M((sOe,GU)=>{"use strict";var vU=(G(),L(J)),MU=Cr(),UU={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},xU=a(e=>`${e} Check logs and try again.`,"CHECK_LOGS_WRAPPER"),BU={500:xU("There was an error processing your request."),400:"Invalid request"},q8=BU[UU.INTERNAL_SERVER_ERROR],$8={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")},V8={CONFIG_VALIDATION:a(e=>`HarperDB config file validation error: ${e}`,"CONFIG_VALIDATION")},K8={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"},Y8={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:"value is required",SEARCH_VALUE_TOO_LARGE:"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 ${MU.INTERNAL_DBIS_NAME}`,CANNOT_DROP_INTERNAL_DBIS_NAME:`cannot drop a dbi named ${MU.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"},W8={ATTR_NAME_LENGTH_ERR:a(e=>`transaction aborted due to attribute name ${e} being too long. Attribute names cannot be longer than ${vU.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 ${vU.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"},FU={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"},j8={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."},z8={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")},Q8={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"},J8={OUTER_JOIN_TRANSLATION_ERROR:"There was an error translating the final SQL outer join data."},X8={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")},kU={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.`,"S