From ae9066c16f461331253a660035563e96e8e858eb Mon Sep 17 00:00:00 2001 From: jclausen Date: Tue, 25 Mar 2025 20:53:38 +0000 Subject: [PATCH 01/24] Apply cfformat changes --- models/Task.cfc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models/Task.cfc b/models/Task.cfc index 697e6a9..d592278 100644 --- a/models/Task.cfc +++ b/models/Task.cfc @@ -54,13 +54,13 @@ component accessors="true" { variables.append( taskProperties ); // calculate our time - if ( taskProperties.keyExists( "start_time_in_millis" ) ){ - var epochDate = parseDateTime( "1970-01-01T00:00:00.000Z", "yyyy-MM-dd'T'HH:nn:ss.SSSX" ); + if ( taskProperties.keyExists( "start_time_in_millis" ) ) { + var epochDate = parseDateTime( "1970-01-01T00:00:00.000Z", "yyyy-MM-dd'T'HH:nn:ss.SSSX" ); variables.startTime = dateAdd( "s", round( taskProperties.start_time_in_millis / 1000 ), epochDate - ); + ); } else { variables.StartTime = now(); } From 5b86941bf6997dc6ee1b494d4ae98210f89650e1 Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Tue, 25 Mar 2025 17:34:55 -0400 Subject: [PATCH 02/24] add ACF2025 to matrix, remove 2018 support --- .github/workflows/tests.yml | 24 ++++++++++++------------ server-adobe@2025.json | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 server-adobe@2025.json diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a5cd3b9..5028e0a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,31 +18,31 @@ jobs: continue-on-error: ${{ matrix.experimental }} strategy: matrix: - cfengine: [ "lucee@5", "adobe@2018", "adobe@2021", "adobe@2023" ] + cfengine: [ "lucee@5", "adobe@2021", "adobe@2023", "adobe@2025" ] coldboxVersion: [ "^6", "^7" ] - javaVersion: [ "11" ] + javaVersion: [ "17" ] ELASTICSEARCH_VERSION: [ "7.17.10", "8.14.1" ] experimental: [ false ] - commandboxVersion: [ "6.1.0" ] + commandboxVersion: [ "6.2.0-alpha" ] include: - - cfengine: "lucee@6" - coldboxVersion: "^7" - javaVersion: "21" - ELASTICSEARCH_VERSION: "8.14.1" - experimental: true - commandboxVersion: "6.1.0" - cfengine: "boxlang@1" coldboxVersion: "be" javaVersion: "21" ELASTICSEARCH_VERSION: "8.14.1" - experimental: true - commandboxVersion: "6.1.0" + experimental: false + commandboxVersion: "6.2.0-alpha" - cfengine: "boxlang@1" coldboxVersion: "be" javaVersion: "21" ELASTICSEARCH_VERSION: "7.17.10" + experimental: false + commandboxVersion: "6.2.0-alpha" + - cfengine: "lucee@6" + coldboxVersion: "^7" + javaVersion: "17" + ELASTICSEARCH_VERSION: "8.14.1" experimental: true - commandboxVersion: "6.1.0" + commandboxVersion: "6.2.0-alpha" steps: - name: Checkout Repository uses: actions/checkout@v4 diff --git a/server-adobe@2025.json b/server-adobe@2025.json new file mode 100644 index 0000000..ab6c4cd --- /dev/null +++ b/server-adobe@2025.json @@ -0,0 +1,24 @@ +{ + "name":"cbelasticsearch-adobe@2025", + "app":{ + "serverHomeDirectory":".engine/adobe2025", + "cfengine":"adobe@2025" + }, + "web":{ + "http":{ + "port":"60299" + }, + "rewrites":{ + "enable":"true" + }, + "webroot":"test-harness", + "aliases":{ + "/moduleroot/cbelasticsearch":"../", + "/root":"./test-harness" + } + }, + "openBrowser":"false", + "scripts":{ + "onServerInstall":"cfpm install zip,debugger" + } +} From 834f3e42089c2deaee9dd9a3bf33b231a71256a1 Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Tue, 25 Mar 2025 17:43:56 -0400 Subject: [PATCH 03/24] fix java version for 2021 --- .github/workflows/tests.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5028e0a..393876b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: continue-on-error: ${{ matrix.experimental }} strategy: matrix: - cfengine: [ "lucee@5", "adobe@2021", "adobe@2023", "adobe@2025" ] + cfengine: [ "lucee@5", "adobe@2023", "adobe@2025" ] coldboxVersion: [ "^6", "^7" ] javaVersion: [ "17" ] ELASTICSEARCH_VERSION: [ "7.17.10", "8.14.1" ] @@ -37,6 +37,12 @@ jobs: ELASTICSEARCH_VERSION: "7.17.10" experimental: false commandboxVersion: "6.2.0-alpha" + - cfengine: "adobe@2021" + coldboxVersion: "^7" + javaVersion: "11" + ELASTICSEARCH_VERSION: "8.14.1" + experimental: false + commandboxVersion: "6.2.0-alpha" - cfengine: "lucee@6" coldboxVersion: "^7" javaVersion: "17" From ecc4e4ea57b8b52bbc54567798ee5bb172bd6ebf Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Tue, 25 Mar 2025 18:00:45 -0400 Subject: [PATCH 04/24] ACF2025 compat --- models/logging/AppenderService.cfc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/models/logging/AppenderService.cfc b/models/logging/AppenderService.cfc index 13b0d6e..aeecc7b 100644 --- a/models/logging/AppenderService.cfc +++ b/models/logging/AppenderService.cfc @@ -147,10 +147,12 @@ component accessors="true" singleton { } ); elasticsearchClient.processBulkOperation( - inserts.map( ( doc ) => [ - "operation": { "create" : createOptions }, - "source" : doc - ] ), + inserts.map( ( doc ) => { + return [ + "operation": { "create" : createOptions }, + "source" : doc + ]; + } ), { "refresh" : refresh } ); } else { From 91e558714e00e521c0f10b3f0b4b6a267bc24c7b Mon Sep 17 00:00:00 2001 From: Github Actions Date: Wed, 26 Mar 2025 00:13:04 +0000 Subject: [PATCH 05/24] Version bump [ci skip] --- box.json | 2 +- changelog.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/box.json b/box.json index 8212cb9..4928159 100644 --- a/box.json +++ b/box.json @@ -2,7 +2,7 @@ "name":"Elasticsearch for the Coldbox Framework", "author":"Ortus Solutions ", "location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/cbelasticsearch/@build.version@/cbelasticsearch-@build.version@+@build.number@.zip", - "version":"3.5.0", + "version":"3.5.1", "slug":"cbelasticsearch", "type":"modules", "homepage":"https://cbelasticsearch.ortusbooks.com", diff --git a/changelog.md b/changelog.md index 087eb2a..3acae85 100644 --- a/changelog.md +++ b/changelog.md @@ -8,10 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * * * ## [Unreleased] + +## [3.5.0] - 2025-03-26 + ### Added + - Boxlang runtime certification ### Removed + - `ensureNativeStruct` and `newHashMap` removed from `models.util.Util` - Removed custom routine for async logging as it conflicted with the logger implementation From 44ebf035830fd4f28f8911605d06ebdc7dc03ac7 Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Sat, 29 Mar 2025 12:13:09 -0400 Subject: [PATCH 06/24] Update server-lucee@6.json --- server-lucee@6.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-lucee@6.json b/server-lucee@6.json index ae894c8..c6f51ed 100644 --- a/server-lucee@6.json +++ b/server-lucee@6.json @@ -2,7 +2,7 @@ "name":"cbelasticsearch-lucee@6", "app":{ "serverHomeDirectory":".engine/lucee6", - "cfengine":"lucee@be" + "cfengine":"lucee@" }, "web":{ "http":{ From d6179ea107f7b20359895b877c103529b7095b3d Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Sat, 29 Mar 2025 12:13:30 -0400 Subject: [PATCH 07/24] Update server-lucee@6.json --- server-lucee@6.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-lucee@6.json b/server-lucee@6.json index c6f51ed..03b14e5 100644 --- a/server-lucee@6.json +++ b/server-lucee@6.json @@ -2,7 +2,7 @@ "name":"cbelasticsearch-lucee@6", "app":{ "serverHomeDirectory":".engine/lucee6", - "cfengine":"lucee@" + "cfengine":"lucee@6" }, "web":{ "http":{ From 1f4ceb78e884a3d4d96ec87e0c0a51e749d615a2 Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Mon, 7 Apr 2025 11:37:18 -0400 Subject: [PATCH 08/24] change to use ISO date for epoch --- models/cache/Provider.cfc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/cache/Provider.cfc b/models/cache/Provider.cfc index 4638e9f..59bf7ae 100644 --- a/models/cache/Provider.cfc +++ b/models/cache/Provider.cfc @@ -337,7 +337,7 @@ component local.keyStats.timeExpires = dateAdd( "s", local.stats[ "key_exptime" ], - dateConvert( "utc2Local", "January 1 1970 00:00" ) + dateConvert( "utc2Local", "1970-01-01T00:00:00Z" ) ); } // key_last_modification_time @@ -349,7 +349,7 @@ component local.keyStats.lastAccessed = dateAdd( "s", local.stats[ "key_last_modification_time" ], - dateConvert( "utc2Local", "January 1 1970 00:00" ) + dateConvert( "utc2Local", "1970-01-01T00:00:00Z" ) ); } // state From b134ff5f2722b57e2b21112e1643181651542ab0 Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Wed, 21 May 2025 11:47:52 -0400 Subject: [PATCH 09/24] Bump commandbox version --- .github/workflows/tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 393876b..f27528b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,32 +23,32 @@ jobs: javaVersion: [ "17" ] ELASTICSEARCH_VERSION: [ "7.17.10", "8.14.1" ] experimental: [ false ] - commandboxVersion: [ "6.2.0-alpha" ] + commandboxVersion: [ "6.2.1" ] include: - cfengine: "boxlang@1" coldboxVersion: "be" javaVersion: "21" ELASTICSEARCH_VERSION: "8.14.1" experimental: false - commandboxVersion: "6.2.0-alpha" + commandboxVersion: "6.2.1" - cfengine: "boxlang@1" coldboxVersion: "be" javaVersion: "21" ELASTICSEARCH_VERSION: "7.17.10" experimental: false - commandboxVersion: "6.2.0-alpha" + commandboxVersion: "6.2.1" - cfengine: "adobe@2021" coldboxVersion: "^7" javaVersion: "11" ELASTICSEARCH_VERSION: "8.14.1" experimental: false - commandboxVersion: "6.2.0-alpha" + commandboxVersion: "6.2.1" - cfengine: "lucee@6" coldboxVersion: "^7" javaVersion: "17" ELASTICSEARCH_VERSION: "8.14.1" experimental: true - commandboxVersion: "6.2.0-alpha" + commandboxVersion: "6.2.1" steps: - name: Checkout Repository uses: actions/checkout@v4 From 9099598bd821c1abbbc655b3fa1cfc7fa8861576 Mon Sep 17 00:00:00 2001 From: Gunnar Lieb Date: Fri, 11 Jul 2025 14:32:37 +0200 Subject: [PATCH 10/24] added getRealIp to util, added config setting trustUpstream, set to true if setup is behind a trusted proxy --- ModuleConfig.cfc | 4 +++- models/logging/AppenderService.cfc | 2 +- models/logging/LogstashAppender.cfc | 2 +- models/util/Util.cfc | 21 +++++++++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc index 944e4ab..4855983 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -68,7 +68,9 @@ component { // Read timeout - the read timeout in milliseconds readTimeout : getSystemSetting( "ELASTICSEARCH_READ_TIMEOUT", 3000 ), // Connection timeout - timeout attempts to connect to elasticsearch after this timeout - connectionTimeout : getSystemSetting( "ELASTICSEARCH_CONNECT_TIMEOUT", 3000 ) + connectionTimeout : getSystemSetting( "ELASTICSEARCH_CONNECT_TIMEOUT", 3000 ), + // used by util:getRealIp, trustUpstream If true, we check the forwarded headers first, else we don't + trustUpstream : false }; // Custom Declared Points diff --git a/models/logging/AppenderService.cfc b/models/logging/AppenderService.cfc index aeecc7b..d141189 100644 --- a/models/logging/AppenderService.cfc +++ b/models/logging/AppenderService.cfc @@ -182,7 +182,7 @@ component accessors="true" singleton { }, "http" : { "request" : { "referer" : CGI.HTTP_REFERER } }, "host" : { "name" : CGI.HTTP_HOST, "hostname" : CGI.SERVER_NAME }, - "client" : { "ip" : CGI.REMOTE_ADDR }, + "client" : { "ip" : util.getRealIp() }, "user" : {}, "user_agent" : { "original" : CGI.HTTP_USER_AGENT } }; diff --git a/models/logging/LogstashAppender.cfc b/models/logging/LogstashAppender.cfc index 57611b9..19cfa71 100644 --- a/models/logging/LogstashAppender.cfc +++ b/models/logging/LogstashAppender.cfc @@ -219,7 +219,7 @@ component "path" : expandPath( "/" ) }, "host" : { "name" : CGI.HTTP_HOST, "hostname" : CGI.SERVER_NAME }, - "client" : { "ip" : CGI.REMOTE_ADDR }, + "client" : { "ip" : util.getRealIp() }, "user" : {}, "user_agent" : { "original" : CGI.HTTP_USER_AGENT } }; diff --git a/models/util/Util.cfc b/models/util/Util.cfc index cd7dc51..ef59f9c 100644 --- a/models/util/Util.cfc +++ b/models/util/Util.cfc @@ -2,6 +2,7 @@ component accessors="true" singleton { property name="appEnvironment" inject="box:setting:environment"; property name="interceptorService" inject="coldbox:InterceptorService"; + property name="configStruct" inject="box:modulesettings:cbelasticsearch"; /** * Workaround for Adobe 2018 metadata mutation bug with GSON: https://tracker.adobe.com/#/view/CF-4206423 @@ -202,4 +203,24 @@ component accessors="true" singleton { return reReplace( arguments.script, "\n|\r|\t", "", "ALL" ); } + /** + * Get Real IP, by looking at clustered, proxy headers and locally. + * borrowed from cbSecurity + * + * @trustUpstream If true, we check the forwarded headers first, else we don't + */ + string function getRealIP( boolean trustUpstream = configStruct.trustUpstream ){ + // When going through a proxy, the IP can be a delimtied list, thus we take the last one in the list + if ( arguments.trustUpstream ) { + var headers = getHTTPRequestData( false ).headers; + if ( structKeyExists( headers, "x-cluster-client-ip" ) ) { + return trim( listLast( headers[ "x-cluster-client-ip" ] ) ); + } + if ( structKeyExists( headers, "X-Forwarded-For" ) ) { + return trim( listFirst( headers[ "X-Forwarded-For" ] ) ); + } + } + + return len( cgi.remote_addr ) ? trim( listFirst( cgi.remote_addr ) ) : "127.0.0.1"; + } } From 2e64c73a68fbd84509f33511dd45272350396966 Mon Sep 17 00:00:00 2001 From: jclausen Date: Thu, 24 Jul 2025 15:31:58 +0000 Subject: [PATCH 11/24] Apply cfformat changes --- ModuleConfig.cfc | 2 +- models/util/Util.cfc | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc index 4855983..8dbbeac 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -70,7 +70,7 @@ component { // Connection timeout - timeout attempts to connect to elasticsearch after this timeout connectionTimeout : getSystemSetting( "ELASTICSEARCH_CONNECT_TIMEOUT", 3000 ), // used by util:getRealIp, trustUpstream If true, we check the forwarded headers first, else we don't - trustUpstream : false + trustUpstream : false }; // Custom Declared Points diff --git a/models/util/Util.cfc b/models/util/Util.cfc index ef59f9c..67bc003 100644 --- a/models/util/Util.cfc +++ b/models/util/Util.cfc @@ -2,7 +2,7 @@ component accessors="true" singleton { property name="appEnvironment" inject="box:setting:environment"; property name="interceptorService" inject="coldbox:InterceptorService"; - property name="configStruct" inject="box:modulesettings:cbelasticsearch"; + property name="configStruct" inject="box:modulesettings:cbelasticsearch"; /** * Workaround for Adobe 2018 metadata mutation bug with GSON: https://tracker.adobe.com/#/view/CF-4206423 @@ -206,7 +206,7 @@ component accessors="true" singleton { /** * Get Real IP, by looking at clustered, proxy headers and locally. * borrowed from cbSecurity - * + * * @trustUpstream If true, we check the forwarded headers first, else we don't */ string function getRealIP( boolean trustUpstream = configStruct.trustUpstream ){ @@ -223,4 +223,5 @@ component accessors="true" singleton { return len( cgi.remote_addr ) ? trim( listFirst( cgi.remote_addr ) ) : "127.0.0.1"; } + } From edd080572f7c248b0c6f2ca8a7bd89316acc73ad Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Thu, 7 Aug 2025 16:46:14 -0400 Subject: [PATCH 12/24] add boxlang@be to matrix --- .github/workflows/tests.yml | 22 +++++++++----- server-boxlang@1.json | 60 ++++++++++++++++++------------------- server-boxlang@be.json | 34 +++++++++++++++++++++ 3 files changed, 78 insertions(+), 38 deletions(-) create mode 100644 server-boxlang@be.json diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f27528b..ba855ec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,12 +18,12 @@ jobs: continue-on-error: ${{ matrix.experimental }} strategy: matrix: - cfengine: [ "lucee@5", "adobe@2023", "adobe@2025" ] - coldboxVersion: [ "^6", "^7" ] - javaVersion: [ "17" ] - ELASTICSEARCH_VERSION: [ "7.17.10", "8.14.1" ] - experimental: [ false ] - commandboxVersion: [ "6.2.1" ] + cfengine: ["lucee@5", "adobe@2023", "adobe@2025"] + coldboxVersion: ["^6", "^7"] + javaVersion: ["17"] + ELASTICSEARCH_VERSION: ["7.17.10", "8.14.1"] + experimental: [false] + commandboxVersion: ["6.2.1"] include: - cfengine: "boxlang@1" coldboxVersion: "be" @@ -49,6 +49,12 @@ jobs: ELASTICSEARCH_VERSION: "8.14.1" experimental: true commandboxVersion: "6.2.1" + - cfengine: "boxlang@be" + coldboxVersion: "be" + javaVersion: "21" + ELASTICSEARCH_VERSION: "8.14.1" + experimental: true + commandboxVersion: "6.2.1" steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -72,7 +78,7 @@ jobs: - name: Install Dependencies run: | box run-script install:dependencies - + - name: Set ColdBox Version working-directory: ./test-harness run: | @@ -145,7 +151,7 @@ jobs: SLACK_CHANNEL: coding SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff' SLACK_ICON_EMOJI: ":bell:" - SLACK_MESSAGE: '${{ github.repository }} tests failed :cry:' + SLACK_MESSAGE: "${{ github.repository }} tests failed :cry:" SLACK_TITLE: ${{ github.repository }} Tests For ${{ matrix.cfengine }} failed SLACK_USERNAME: CI SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/server-boxlang@1.json b/server-boxlang@1.json index a6d684d..f5bf583 100644 --- a/server-boxlang@1.json +++ b/server-boxlang@1.json @@ -1,34 +1,34 @@ { - "app":{ - "cfengine":"boxlang@1.0.0-snapshot", - "serverHomeDirectory":".engine/boxlang" + "app": { + "cfengine": "boxlang@1", + "serverHomeDirectory": ".engine/boxlang" + }, + "name": "cbelasticsearch-boxlang@1", + "force": true, + "openBrowser": false, + "web": { + "directoryBrowsing": true, + "http": { + "port": "60299" }, - "name":"cbelasticsearch-boxlang@1", - "force":true, - "openBrowser":false, - "web":{ - "directoryBrowsing":true, - "http":{ - "port":"60299" - }, - "rewrites":{ - "enable":"true" - }, - "webroot":"test-harness", - "aliases":{ - "/moduleroot/cbelasticsearch":"./" - } + "rewrites": { + "enable": "true" }, - "fusionreactor":{ - "enable":"${FR_ENABLE:false}", - "port":"8088", - "licenseKey":"${FR_LICENSE_KEY}" - }, - "JVM":{ - "javaVersion":"openjdk21_jdk_x64", - "args":"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9999 -Dboxlang.debugMode=true" - }, - "scripts":{ - "onServerInitialInstall":"install bx-compat-cfml@be,bx-esapi --noSave" + "webroot": "test-harness", + "aliases": { + "/moduleroot/cbelasticsearch": "./" } -} \ No newline at end of file + }, + "fusionreactor": { + "enable": "${FR_ENABLE:false}", + "port": "8088", + "licenseKey": "${FR_LICENSE_KEY}" + }, + "JVM": { + "javaVersion": "openjdk21_jdk_x64", + "args": "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9999 -Dboxlang.debugMode=true" + }, + "scripts": { + "onServerInitialInstall": "install bx-compat-cfml,bx-esapi --noSave" + } +} diff --git a/server-boxlang@be.json b/server-boxlang@be.json new file mode 100644 index 0000000..c9221c8 --- /dev/null +++ b/server-boxlang@be.json @@ -0,0 +1,34 @@ +{ + "app": { + "cfengine": "boxlang@be", + "serverHomeDirectory": ".engine/boxlang" + }, + "name": "cbelasticsearch-boxlang@1", + "force": true, + "openBrowser": false, + "web": { + "directoryBrowsing": true, + "http": { + "port": "60299" + }, + "rewrites": { + "enable": "true" + }, + "webroot": "test-harness", + "aliases": { + "/moduleroot/cbelasticsearch": "./" + } + }, + "fusionreactor": { + "enable": "${FR_ENABLE:false}", + "port": "8088", + "licenseKey": "${FR_LICENSE_KEY}" + }, + "JVM": { + "javaVersion": "openjdk21_jdk_x64", + "args": "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9999 -Dboxlang.debugMode=true" + }, + "scripts": { + "onServerInitialInstall": "install bx-compat-cfml,bx-esapi --noSave" + } +} From e5c25a9fa8cfa5992895c7cf96357be84429b603 Mon Sep 17 00:00:00 2001 From: Michael Born Date: Tue, 26 Aug 2025 16:02:18 -0400 Subject: [PATCH 13/24] Revert hyper to valid version --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index 4928159..267c77c 100644 --- a/box.json +++ b/box.json @@ -29,7 +29,7 @@ "Luis Majano " ], "dependencies":{ - "hyper":"^8.0.0" + "hyper":"^7.5.3" }, "ignore":[ "**/.*", From d03d1c099c3209d9cdebcfc4c992e4c3c35754ba Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Fri, 19 Sep 2025 11:50:04 -0400 Subject: [PATCH 14/24] Coldbox 8 compat --- models/cache/Provider.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/cache/Provider.cfc b/models/cache/Provider.cfc index 59bf7ae..d29fcaf 100644 --- a/models/cache/Provider.cfc +++ b/models/cache/Provider.cfc @@ -10,7 +10,7 @@ component name ="ElasticsearchProvider" serializable="false" - implements ="coldbox.system.cache.ICacheProvider" + implements ="coldbox.system.cache.providers.ICacheProvider" accessors =true { From 4ff1dbe694c7977eea9b6ccd4de5f4ebd4240a83 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Sep 2025 18:20:43 +0000 Subject: [PATCH 15/24] Initial plan From 37b855fcba2e0bf1c3924824cf8ace33b4763a2d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Sep 2025 18:34:41 +0000 Subject: [PATCH 16/24] Add comprehensive GitHub Copilot development instructions Co-authored-by: jclausen <5255645+jclausen@users.noreply.github.com> --- .github/copilot-instructions.md | 275 ++++++++++++++++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..8abf76a --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,275 @@ +# CBElasticsearch Module Development Instructions + +CBElasticsearch is a CFML (ColdFusion/Lucee) module that provides a fluent API for Elasticsearch integration with the ColdBox Framework. It includes CacheBox cache providers and LogBox appenders for Elasticsearch. + +Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here. + +## Working Effectively + +### Prerequisites and Dependencies +- Install Java 17+ (OpenJDK Temurin recommended) +- Install Docker and Docker Compose +- Install CommandBox CLI for CFML development + +### Bootstrap and Setup Commands +Execute these commands in exact order to set up the development environment: + +```bash +# 1. Install CommandBox (if not available, use Docker approach below) +curl -fsSL https://downloads.ortussolutions.com/debs/gpg | sudo apt-key add - +echo "deb https://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a /etc/apt/sources.list.d/commandbox.list +sudo apt-get update && sudo apt-get install -y commandbox + +# 2. Install project dependencies (takes 2-5 minutes depending on network) +box install +cd test-harness && box install && cd ../ + +# 3. Start Elasticsearch with Docker Compose (takes 30-45 seconds) +# NEVER CANCEL: Elasticsearch startup takes 30-45 seconds. Set timeout to 90+ seconds. +docker compose up -d elasticsearch + +# 4. Wait for Elasticsearch to be ready (critical - wait for green status) +sleep 30 +curl -s http://localhost:9200/_cluster/health | jq '.status' # Should return "green" +``` + +### Alternative Setup (when CommandBox installation fails) +If CommandBox installation fails due to network restrictions: + +```bash +# Use Docker for CommandBox operations (NOTE: ForgeBox access may still fail) +docker run --rm -v $(pwd):/app ortussolutions/commandbox:lucee5 box install +cd test-harness && docker run --rm -v $(pwd):/app ortussolutions/commandbox:lucee5 box install && cd ../ + +# If ForgeBox access fails completely, document this limitation: +# "box install -- fails due to network restrictions preventing ForgeBox access" +``` + +### Build and Test Commands +- **NEVER CANCEL**: Build operations take 5-15 minutes. Set timeout to 30+ minutes. +- **NEVER CANCEL**: Test suite takes 3-8 minutes per engine. Set timeout to 20+ minutes. + +```bash +# Format code (always run before committing) +# NOTE: Requires cfformat module - may fail if dependencies unavailable +box run-script format + +# Check code formatting +# NOTE: Requires cfformat module - may fail if dependencies unavailable +box run-script format:check + +# Lint code (if cflint is available) +cflint + +# Start test server (takes 60-90 seconds to fully boot) +# NEVER CANCEL: Server startup takes 60-90 seconds. Set timeout to 180+ seconds. +box start + +# Run complete test suite (takes 3-8 minutes) +# NEVER CANCEL: Tests take 3-8 minutes to complete. Set timeout to 15+ minutes. +box testbox run + +# Build module for distribution (takes 5-15 minutes) +# NEVER CANCEL: Build takes 5-15 minutes. Set timeout to 30+ minutes. +box run-script build:module + +# Build documentation only +box run-script build:docs +``` + +### Development Workflow Commands +```bash +# Start development environment +docker compose up -d # Starts Elasticsearch + app containers +box start # Starts local CommandBox server + +# Run tests during development +box testbox run --verbose # Run all tests with verbose output +box testbox run --directory=tests/specs/unit # Run only unit tests + +# Stop everything +box stop # Stop CommandBox server +docker compose down # Stop all Docker services +``` + +## Validation + +### Required Validation Steps +ALWAYS run these validation steps after making code changes: + +1. **Elasticsearch Health Validation**: + ```bash + # Verify Elasticsearch is running and healthy (takes 5-10 seconds) + curl -s http://localhost:9200/_cluster/health | jq '.status' # Should return "green" + ``` + +2. **Code Quality Validation** (if dependencies available): + ```bash + box run-script format:check # Verify code formatting + box run-script format # Auto-fix formatting issues + ``` + +3. **Build Validation** (if dependencies available): + ```bash + # NEVER CANCEL: Build takes 5-15 minutes + box run-script build:module + ``` + +4. **Test Validation** (if dependencies available): + ```bash + # Ensure Elasticsearch is running first + curl -s http://localhost:9200/_cluster/health | jq '.status' + + # NEVER CANCEL: Tests take 3-8 minutes per engine + box testbox run --verbose + ``` + +4. **End-to-End Scenario Testing**: + After making changes, always test these core scenarios: + - **Search Operations**: Create index, add documents, search, retrieve results + - **Cache Operations**: Store/retrieve data via CacheBox provider + - **Logging**: Verify LogBox appender logs to Elasticsearch + - **Index Management**: Create/update/delete indices and mappings + +### CI/CD Validation +The GitHub Actions CI will fail if: +- Code formatting is incorrect (run `box run-script format`) +- Tests fail on any supported engine (Lucee 5/6, Adobe CF 2018/2021/2023/2025, BoxLang) +- Build process fails +- Security scans detect high-severity issues + +## Environment Configuration + +### Elasticsearch Configuration +The module supports both Elasticsearch 7.x and 8.x. Default configuration: +```ini +ELASTICSEARCH_PROTOCOL=http +ELASTICSEARCH_HOST=127.0.0.1 +ELASTICSEARCH_PORT=9200 +``` + +### Multi-Version Testing +The CI tests against multiple configurations: +- **Elasticsearch**: 7.17.10, 8.14.1, 8.17.1 +- **CFML Engines**: Lucee 5/6, Adobe CF 2018/2021/2023/2025, BoxLang 1.0 +- **ColdBox Versions**: 6.x, 7.x + +### Docker Compose Services +Available services via `docker compose up`: +- `elasticsearch`: Elasticsearch 8.17.1 on port 9200 +- `elasticsearch7`: Elasticsearch 7.17.6 on port 9201 +- `app`: Adobe CF 2018 with module on port 8080 +- `app-lucee5`: Lucee 5 with module on port 8081 + +## Critical Timing Information + +### Build Times and Timeouts +- **Elasticsearch startup**: 5-10 seconds (timeout: 30+ seconds) +- **CommandBox server startup**: 60-90 seconds (timeout: 180+ seconds) +- **Dependency installation**: 2-5 minutes (timeout: 10+ minutes) *[may fail due to network restrictions]* +- **Test suite execution**: 3-8 minutes per engine (timeout: 15+ minutes) +- **Module build**: 5-15 minutes (timeout: 30+ minutes) +- **Documentation build**: 2-5 minutes (timeout: 10+ minutes) +- **Docker Compose full startup**: 25-30 seconds (timeout: 60+ seconds) +- **Docker Compose shutdown**: 10-15 seconds (timeout: 30+ seconds) + +### **CRITICAL: NEVER CANCEL LONG-RUNNING OPERATIONS** +All build and test operations may take significant time. Canceling prematurely will result in incomplete builds and failed tests. + +## Key Project Structure + +### Core Module Files +- `ModuleConfig.cfc` - Module configuration and dependencies +- `models/` - Core module classes (SearchBuilder, IndexBuilder, etc.) +- `models/cache/` - CacheBox provider implementation +- `models/logging/` - LogBox appender implementation + +### Testing Infrastructure +- `test-harness/` - Complete test application +- `test-harness/tests/specs/unit/` - Unit tests +- `test-harness/config/Coldbox.cfc` - Test app configuration + +### Build System +- `box.json` - Project dependencies and scripts +- `build/Build.cfc` - Build automation scripts +- `build/release.boxr` - Release automation recipe +- `.github/workflows/` - CI/CD pipeline definitions + +### Configuration Files +- `docker-compose.yml` - Development environment setup +- `.cfformat.json` - Code formatting rules +- `.cflintrc` - Code linting configuration +- `.env.template` - Environment variable template + +## Common Tasks + +### Creating New Features +1. Write unit tests first in `test-harness/tests/specs/unit/` +2. Implement feature in appropriate `models/` subdirectory +3. Update `ModuleConfig.cfc` if adding new mappings +4. Run validation steps (format, build, test) +5. Update documentation in `docs/` if needed + +### Debugging Test Failures +1. Check Elasticsearch status: `curl http://localhost:9200/_cluster/health` +2. Review server logs: `box server log` +3. Check Docker logs: `docker compose logs elasticsearch` +4. Run specific test suites: `box testbox run --directory=tests/specs/unit/SpecificTest.cfc` + +### Adding Dependencies +1. Update `box.json` dependencies section +2. Run `box install` to install +3. Update test-harness: `cd test-harness && box install` +4. Test build process: `box run-script build:module` + +### Release Process +Releases are automated via GitHub Actions, but manual releases use: +```bash +# Update changelog.md with new version info +# Update box.json version number +box recipe build/release.boxr +``` + +## Network and Access Limitations + +If you encounter network restrictions preventing access to ForgeBox or other external resources: +- Use Docker-based CommandBox operations when possible +- Document any commands that fail due to network restrictions +- Focus on testing local functionality that doesn't require external dependencies +- The CI environment has full network access and will validate complete builds + +### Commands That May Fail Due to Network Restrictions +```bash +# These commands require ForgeBox/external access: +box install # "forgebox ran into an issue" +box run-script format # Requires cfformat module +box run-script format:check # Requires cfformat module +``` + +### Working Commands in Restricted Environments +```bash +# These commands work without external access: +docker compose up -d elasticsearch # Uses local/cached Docker images +docker compose logs elasticsearch # Local Docker logs +curl http://localhost:9200/_cluster/health # Local Elasticsearch API +docker run --rm -v $(pwd):/app ortussolutions/commandbox:lucee5 box version # Basic CommandBox +``` + +## Error Recovery + +### Common Issues and Solutions +1. **"CommandBox not found"** - Use Docker approach or install from GitHub releases +2. **"Elasticsearch connection failed"** - Verify `docker compose up -d elasticsearch` succeeded +3. **"ForgeBox connection failed"** - Network restrictions, use cached dependencies or Docker +4. **"Tests hanging"** - Increase timeout values, Elasticsearch may still be starting +5. **"Build fails"** - Check code formatting first: `box run-script format` + +### Recovery Commands +```bash +# Reset development environment +box stop +docker compose down +docker compose up -d elasticsearch +sleep 30 +box start +``` \ No newline at end of file From 89b4bbc13b1e8378e975afc0278f7ba85bf7cec6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Sep 2025 18:52:34 +0000 Subject: [PATCH 17/24] Emphasize format command must be run before committing files Co-authored-by: jclausen <5255645+jclausen@users.noreply.github.com> --- .github/copilot-instructions.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 8abf76a..6b6ef72 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -50,7 +50,8 @@ cd test-harness && docker run --rm -v $(pwd):/app ortussolutions/commandbox:luce - **NEVER CANCEL**: Test suite takes 3-8 minutes per engine. Set timeout to 20+ minutes. ```bash -# Format code (always run before committing) +# Format code (ALWAYS run before committing and pushing any files) +# CRITICAL: This command MUST be run before any commit to ensure code formatting compliance # NOTE: Requires cfformat module - may fail if dependencies unavailable box run-script format @@ -107,6 +108,7 @@ ALWAYS run these validation steps after making code changes: ```bash box run-script format:check # Verify code formatting box run-script format # Auto-fix formatting issues + # CRITICAL: Always run format command before committing any files ``` 3. **Build Validation** (if dependencies available): @@ -133,7 +135,7 @@ ALWAYS run these validation steps after making code changes: ### CI/CD Validation The GitHub Actions CI will fail if: -- Code formatting is incorrect (run `box run-script format`) +- Code formatting is incorrect (ALWAYS run `box run-script format` before committing) - Tests fail on any supported engine (Lucee 5/6, Adobe CF 2018/2021/2023/2025, BoxLang) - Build process fails - Security scans detect high-severity issues @@ -207,7 +209,7 @@ All build and test operations may take significant time. Canceling prematurely w 1. Write unit tests first in `test-harness/tests/specs/unit/` 2. Implement feature in appropriate `models/` subdirectory 3. Update `ModuleConfig.cfc` if adding new mappings -4. Run validation steps (format, build, test) +4. Run validation steps (ALWAYS run `box run-script format` before committing, then build, test) 5. Update documentation in `docs/` if needed ### Debugging Test Failures @@ -262,7 +264,7 @@ docker run --rm -v $(pwd):/app ortussolutions/commandbox:lucee5 box version # B 2. **"Elasticsearch connection failed"** - Verify `docker compose up -d elasticsearch` succeeded 3. **"ForgeBox connection failed"** - Network restrictions, use cached dependencies or Docker 4. **"Tests hanging"** - Increase timeout values, Elasticsearch may still be starting -5. **"Build fails"** - Check code formatting first: `box run-script format` +5. **"Build fails"** - Check code formatting first: `box run-script format` (ALWAYS run before committing) ### Recovery Commands ```bash From 91a9fbdae770583f81f5684f98896a9479e16b38 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Sep 2025 19:01:27 +0000 Subject: [PATCH 18/24] Remove Adobe 2018 references, update to Adobe 2021 as minimum version Co-authored-by: jclausen <5255645+jclausen@users.noreply.github.com> --- .github/copilot-instructions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 6b6ef72..a306457 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -136,7 +136,7 @@ ALWAYS run these validation steps after making code changes: ### CI/CD Validation The GitHub Actions CI will fail if: - Code formatting is incorrect (ALWAYS run `box run-script format` before committing) -- Tests fail on any supported engine (Lucee 5/6, Adobe CF 2018/2021/2023/2025, BoxLang) +- Tests fail on any supported engine (Lucee 5/6, Adobe CF 2021/2023/2025, BoxLang) - Build process fails - Security scans detect high-severity issues @@ -153,14 +153,14 @@ ELASTICSEARCH_PORT=9200 ### Multi-Version Testing The CI tests against multiple configurations: - **Elasticsearch**: 7.17.10, 8.14.1, 8.17.1 -- **CFML Engines**: Lucee 5/6, Adobe CF 2018/2021/2023/2025, BoxLang 1.0 +- **CFML Engines**: Lucee 5/6, Adobe CF 2021/2023/2025, BoxLang 1.0 - **ColdBox Versions**: 6.x, 7.x ### Docker Compose Services Available services via `docker compose up`: - `elasticsearch`: Elasticsearch 8.17.1 on port 9200 - `elasticsearch7`: Elasticsearch 7.17.6 on port 9201 -- `app`: Adobe CF 2018 with module on port 8080 +- `app`: Adobe CF 2021 with module on port 8080 - `app-lucee5`: Lucee 5 with module on port 8081 ## Critical Timing Information From 755e10054eb834e0f3da0c63bdf0834fd2b24366 Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Tue, 23 Sep 2025 15:20:59 -0400 Subject: [PATCH 19/24] interface updates --- models/cache/Provider.cfc | 103 +++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/models/cache/Provider.cfc b/models/cache/Provider.cfc index d29fcaf..1813c8b 100644 --- a/models/cache/Provider.cfc +++ b/models/cache/Provider.cfc @@ -104,70 +104,70 @@ component /** * get the cache name */ - any function getName() output="false"{ + any function getName(){ return this.name; } /** * get the cache provider version */ - any function getVersion() output="false"{ + any function getVersion(){ return this.version; } /** * set the cache name */ - void function setName( required name ) output="false"{ + function setName( required name ){ this.name = arguments.name; } /** * set the event manager */ - void function setEventManager( required any EventManager ) output="false"{ + function setEventManager( required any EventManager ){ this.eventManager = arguments.eventManager; } /** * get the event manager */ - any function getEventManager() output="false"{ + any function getEventManager(){ return this.eventManager; } /** * get the cache configuration structure */ - any function getConfiguration() output="false"{ + struct function getConfiguration(){ return this.config; } /** * set the cache configuration structure */ - void function setConfiguration( required any configuration ) output="false"{ + function setConfiguration( required struct configuration ){ this.config = arguments.configuration; } /** * get the associated cache factory */ - any function getCacheFactory() output="false"{ + coldbox.system.cache.CacheFactory function getCacheFactory(){ return this.cacheFactory; } /** * set the associated cache factory */ - void function setCacheFactory( required any cacheFactory ) output="false"{ + function setCacheFactory( required any cacheFactory ){ this.cacheFactory = arguments.cacheFactory; } /** * configure the cache for operation */ - void function configure() output="false"{ + function configure(){ var config = getConfiguration(); var props = []; var URIs = []; @@ -188,21 +188,21 @@ component /** * shutdown the cache */ - void function shutdown() output="false"{ + function shutdown(){ Logger.info( "Provider Cache: #getName()# has been shutdown." ); } /* * Indicates if cache is ready for operation */ - any function isEnabled() output="false"{ + boolean function isEnabled(){ return this.enabled; } /* * Indicates if cache is ready for reporting */ - any function isReportingEnabled() output="false"{ + boolean function isReportingEnabled(){ return this.reportingEnabled; } @@ -210,21 +210,21 @@ component * Get the cache statistics object as coldbox.system.cache.util.ICacheStats * @colddoc:generic coldbox.system.cache.util.ICacheStats */ - any function getStats() output="false"{ + any function getStats(){ // Not yet implmented } /** * clear the cache stats: */ - void function clearStatistics() output="false"{ + function clearStatistics(){ // Not yet implemented } /** * Returns the underlying cache engine represented by the module ElasticSearch client */ - any function getObjectStore() output="false"{ + any function getObjectStore(){ // This provider uses an external object store return getClient(); } @@ -233,7 +233,7 @@ component * get the cache's metadata report * @tested */ - any function getStoreMetadataReport() output="false"{ + struct function getStoreMetadataReport(){ var md = {}; var keys = getKeys(); var item = ""; @@ -248,7 +248,7 @@ component * Get a key lookup structure where cachebox can build the report on. Ex: [timeout=timeout,lastAccessTimeout=idleTimeout]. It is a way for the visualizer to construct the columns correctly on the reports * @tested */ - any function getStoreMetadataKeyMap() output="false"{ + struct function getStoreMetadataKeyMap(){ var keyMap = { LastAccessed : "LastAccessed", isExpired : "isExpired", @@ -264,7 +264,7 @@ component * get all the keys in this provider * @tested */ - any function getKeys() output="false"{ + array function getKeys(){ local.allView = get( this.designDocumentName ); if ( isNull( local.allView ) ) { @@ -279,7 +279,7 @@ component return local.allView; } - void function appendCacheKey( objectKey ){ + function appendCacheKey( objectKey ){ var result = get( this.designDocumentName ); if ( !isNull( result ) && isArray( result ) ) { @@ -298,7 +298,7 @@ component * get an object's cached metadata * @tested */ - any function getCachedObjectMetadata( required any objectKey ) output="false"{ + struct function getCachedObjectMetadata( required any objectKey ){ // lower case the keys for case insensitivity if ( !getConfiguration().caseSensitiveKeys ) arguments.objectKey = lCase( arguments.objectKey ); @@ -400,7 +400,7 @@ component * get an item from cache, returns null if not found. * @tested */ - any function get( required any objectKey ) output="false"{ + any function get( required any objectKey ){ return getQuiet( argumentCollection = arguments ); } @@ -408,7 +408,7 @@ component * get an item silently from cache, no stats advised: Stats not available on Elasticsearch * @tested */ - any function getQuiet( required any objectKey ) output="false"{ + any function getQuiet( required any objectKey ){ // lower case the keys for case insensitivity if ( !getConfiguration().caseSensitiveKeys ) arguments.objectKey = lCase( arguments.objectKey ); @@ -505,7 +505,7 @@ component /** * Checks if a value has expired */ - any function isExpired( required any objectKey ) output="false"{ + boolean function isExpired( required any objectKey ){ return isNull( getClient().get( arguments.objectKey ) ); } @@ -513,7 +513,7 @@ component * check if object in cache * @tested */ - any function lookup( required any objectKey ) output="false"{ + boolean function lookup( required any objectKey ){ return ( isNull( get( objectKey ) ) ? false : true ); } @@ -521,7 +521,7 @@ component * check if object in cache with no stats: Stats not available on Elasticsearch * @tested */ - any function lookupQuiet( required any objectKey ) output="false"{ + boolean function lookupQuiet( required any objectKey ){ return lookup( arguments.objectKey ); } @@ -535,8 +535,8 @@ component required any object, any timeout = this.config.objectDefaultTimeout, any lastAccessTimeout = 0, // Not in use for this provider - any extra = {} - ) output="false"{ + struct extra = {} + ){ var ts = getTickCount(); var future = setQuiet( argumentCollection = arguments ); @@ -572,13 +572,13 @@ component * lastAccessTimeout.hint Not used in this provider * @tested */ - any function setQuiet( + function setQuiet( required any objectKey, required any object, any timeout = this.config.objectDefaultTimeout, any lastAccessTimeout = 0, // Not in use for this provider - any extra = {} - ) output="false"{ + struct extra = {} + ){ return persistToCache( arguments.objectKey, formatCacheObject( argumentCollection = arguments ) ); } @@ -593,7 +593,7 @@ component any timeout = this.config.objectDefaultTimeout, any lastAccessTimeout = 0, // Not in use for this provider any extra = {} - ) output="false"{ + ){ var ts = getTickCount(); var documents = []; @@ -627,7 +627,7 @@ component any timeout = this.config.objectDefaultTimeout, any lastAccessTimeout = 0, // Not in use for this provider any extra = {} - ) output="false"{ + ){ // create storage element var sElement = { "createdDate" : dateFormat( now(), "mm/dd/yyyy" ) & " " & timeFormat( now(), "full" ), @@ -653,7 +653,7 @@ component required any cacheObject, boolean replaceItem = false any extra - ) output="false"{ + ){ if ( !getConfiguration().caseSensitiveKeys ) arguments.objectKey = lCase( arguments.objectKey ); @@ -683,7 +683,7 @@ component return future; } - void function updateObjectStats( required any objectKey, required any cacheObject ){ + function updateObjectStats( required any objectKey, required any cacheObject ){ if ( !getConfiguration().caseSensitiveKeys ) arguments.objectKey = lCase( arguments.objectKey ); if ( !structKeyExists( cacheObject, "hits" ) ) cacheObject[ "hits" ] = 0; @@ -704,15 +704,15 @@ component * get cache size * @tested */ - any function getSize() output="false"{ - // Not implemented + numeric function getSize(){ + return getKeys().len(); } /** * Not implemented by this cache * @tested */ - void function reap() output="false"{ + function reap(){ // Not implemented by this provider } @@ -720,7 +720,7 @@ component * clear all elements from cache * @tested */ - void function clearAll() output="false"{ + function clearAll(){ // If flush is not enabled for this bucket, no error will be thrown. The call will simply return and nothing will happen. // Be very careful calling this. It is an intensive asynch operation and the cache won't receive any new items until the flush // is finished which might take a few minutes. @@ -738,7 +738,7 @@ component * clear an element from cache and returns the Elasticsearch java future * @tested */ - any function clear( required any objectKey ) output="false"{ + boolean function clear( required any objectKey ){ // lower case the keys for case insensitivity if ( !getConfiguration().caseSensitiveKeys ) arguments.objectKey = lCase( arguments.objectKey ); @@ -751,13 +751,13 @@ component var document = newDocument().new( getConfiguration().index, getConfiguration().type ); document.setId( arguments.objectKey ); - var future = ElasticsearchClient.delete( document, true, { "refresh" : "wait_for" } ); + var deleteresult = ElasticsearchClient.delete( document, true, { "refresh" : "wait_for" } ); // ColdBox events var iData = { - cache : this, - cacheObjectKey : arguments.objectKey, - ElasticsearchFuture : future + cache : this, + cacheObjectKey : arguments.objectKey, + deleteResult : deleteresult }; getEventManager().processState( @@ -766,14 +766,14 @@ component async = true ); - return future; + return deleteresult; } /** * Clear with no advising to events and returns with the Elasticsearch java future * @tested */ - any function clearQuiet( required any objectKey ) output="false"{ + boolean function clearQuiet( required any objectKey ){ // normal clear, not implemented by Elasticsearch return clear( arguments.objectKey ); } @@ -781,11 +781,11 @@ component /** * Clear by key snippet */ - void function clearByKeySnippet( + function clearByKeySnippet( required keySnippet, regex = false, async = false - ) output="false"{ + ){ var threadName = "clearByKeySnippet_#replace( this.uuidHelper.randomUUID(), "-", "", "all" )#"; // Async? IF so, do checks @@ -802,15 +802,16 @@ component * Expiration not implemented by Elasticsearch so clears are issued * @tested */ - void function expireAll() output="false"{ + function expireAll(){ clearAll(); } /** * Expiration not implemented by Elasticsearch so clear is issued * @tested + * */ - void function expireObject( required any objectKey ) output="false"{ + function expireObject( required any objectKey ){ clear( arguments.objectKey ); } @@ -819,7 +820,7 @@ component /** * Validate the incoming configuration and make necessary defaults **/ - private void function validateConfiguration() output="false"{ + private function validateConfiguration(){ var cacheConfig = getConfiguration(); var key = ""; From d3abed5667b3ad99939c681da634245e7c003472 Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Tue, 23 Sep 2025 15:33:23 -0400 Subject: [PATCH 20/24] remove interface implementation as Coldbox 6 and 7 are different --- models/cache/Provider.cfc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/cache/Provider.cfc b/models/cache/Provider.cfc index 1813c8b..343d732 100644 --- a/models/cache/Provider.cfc +++ b/models/cache/Provider.cfc @@ -5,12 +5,13 @@ * @package cbElasticsearch.models.Cache * @author Jon Clausen * @license Apache v2.0 + * + * Note: We cannot implement the interface coldbox.system.cache.providers.ICacheProvider on the component declaration until we discontinue CF6 support * **/ component name ="ElasticsearchProvider" serializable="false" - implements ="coldbox.system.cache.providers.ICacheProvider" accessors =true { From a5ec8cb9570225ce8dadde8a44650eedeb79091f Mon Sep 17 00:00:00 2001 From: jclausen Date: Tue, 23 Sep 2025 19:34:10 +0000 Subject: [PATCH 21/24] Apply cfformat changes --- models/cache/Provider.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/cache/Provider.cfc b/models/cache/Provider.cfc index 343d732..74ea0e1 100644 --- a/models/cache/Provider.cfc +++ b/models/cache/Provider.cfc @@ -5,7 +5,7 @@ * @package cbElasticsearch.models.Cache * @author Jon Clausen * @license Apache v2.0 - * + * * Note: We cannot implement the interface coldbox.system.cache.providers.ICacheProvider on the component declaration until we discontinue CF6 support * **/ From bf8e947128500466e7bc314704ad0d150d8339af Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Tue, 23 Sep 2025 15:56:54 -0400 Subject: [PATCH 22/24] more inerface removal --- models/cache/ColdboxProvider.cfc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/models/cache/ColdboxProvider.cfc b/models/cache/ColdboxProvider.cfc index ae7b589..9820289 100644 --- a/models/cache/ColdboxProvider.cfc +++ b/models/cache/ColdboxProvider.cfc @@ -6,11 +6,12 @@ * @author Jon Clausen * @license Apache v2.0 * + * * Note: We cannot implement the interface coldbox.system.cache.IColdboxApplicationCache on the component declaration until we discontinue CF6 support + * **/ component serializable="false" extends ="Provider" - implements ="coldbox.system.cache.IColdboxApplicationCache" { ColdboxProvider function init() output=false{ @@ -38,7 +39,7 @@ component } // set the coldbox controller - void function setColdbox( required any coldbox ) output=false{ + function setColdbox( required any coldbox ) output=false{ variables.coldbox = arguments.coldbox; } @@ -55,7 +56,7 @@ component /** * Clear all events */ - void function clearAllEvents( async = false ) output=false{ + function clearAllEvents( async = false ) output=false{ var threadName = "clearAllEvents_#replace( instance.uuidHelper.randomUUID(), "-", @@ -76,7 +77,7 @@ component /** * Clear all views */ - void function clearAllViews( async = false ) output=false{ + function clearAllViews( async = false ) output=false{ var threadName = "clearAllViews_#replace( instance.uuidHelper.randomUUID(), "-", @@ -97,28 +98,28 @@ component /** * Clear event */ - void function clearEvent( required eventsnippet, queryString = "" ) output=false{ + function clearEvent( required eventsnippet, queryString = "" ) output=false{ instance.elementCleaner.clearEvent( arguments.eventsnippet, arguments.queryString ); } /** * Clear multiple events */ - void function clearEventMulti( required eventsnippets, queryString = "" ) output=false{ + function clearEventMulti( required eventsnippets, queryString = "" ) output=false{ instance.elementCleaner.clearEventMulti( arguments.eventsnippets, arguments.queryString ); } /** * Clear view */ - void function clearView( required viewSnippet ) output=false{ + function clearView( required viewSnippet ) output=false{ instance.elementCleaner.clearView( arguments.viewSnippet ); } /** * Clear multiple view */ - void function clearViewMulti( required viewsnippets ) output=false{ + function clearViewMulti( required viewsnippets ) output=false{ instance.elementCleaner.clearView( arguments.viewsnippets ); } From ee2daf387e77a4baefed30af1d4c079bc3048a7c Mon Sep 17 00:00:00 2001 From: jclausen Date: Tue, 23 Sep 2025 20:01:27 +0000 Subject: [PATCH 23/24] Apply cfformat changes --- models/cache/ColdboxProvider.cfc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/models/cache/ColdboxProvider.cfc b/models/cache/ColdboxProvider.cfc index 9820289..806ef42 100644 --- a/models/cache/ColdboxProvider.cfc +++ b/models/cache/ColdboxProvider.cfc @@ -7,12 +7,9 @@ * @license Apache v2.0 * * * Note: We cannot implement the interface coldbox.system.cache.IColdboxApplicationCache on the component declaration until we discontinue CF6 support - * + * **/ -component - serializable="false" - extends ="Provider" -{ +component serializable="false" extends="Provider" { ColdboxProvider function init() output=false{ super.init(); From f4580cfdc71baa7a9f4e9cee244f5a93fc814be4 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Wed, 1 Oct 2025 03:24:06 +0000 Subject: [PATCH 24/24] Version bump [ci skip] --- box.json | 2 +- changelog.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/box.json b/box.json index 267c77c..c7444f7 100644 --- a/box.json +++ b/box.json @@ -2,7 +2,7 @@ "name":"Elasticsearch for the Coldbox Framework", "author":"Ortus Solutions ", "location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/cbelasticsearch/@build.version@/cbelasticsearch-@build.version@+@build.number@.zip", - "version":"3.5.1", + "version":"3.5.2", "slug":"cbelasticsearch", "type":"modules", "homepage":"https://cbelasticsearch.ortusbooks.com", diff --git a/changelog.md b/changelog.md index 3acae85..279b985 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.5.0] - 2025-10-01 + ## [3.5.0] - 2025-03-26 ### Added