Skip to content

Commit 4d46d57

Browse files
authored
Merge pull request #1063 from marklogic/release/4.1.0
MLE-26608 Release MarkLogic Node Client API 4.1.0
2 parents 2758065 + 7d52c46 commit 4d46d57

34 files changed

+6019
-412
lines changed

.copyrightconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ startyear: 2015
1111
# - Dotfiles already skipped automatically
1212
# Enable by removing the leading '# ' from the next line and editing values.
1313
# filesexcluded: third_party/*, docs/generated/*.md, assets/*.png, scripts/temp_*.py, vendor/lib.js
14-
filesexcluded: .github/*, README.md, Jenkinsfile, test-app/*, *.md, docker-compose.yaml, test-complete-app-mlDeploy/*, *.json
14+
filesexcluded: .github/*, README.md, Jenkinsfile, test-app/*, *.md, docker-compose.yaml, test-complete-app-mlDeploy/*, *.json, *.sh

.github/copilot-instructions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
When generating TypeScript definitions, follow this advice:
2+
3+
All types will go into marklogic.d.ts.
4+
5+
Determining the output type is difficult. You have to look at the module containing the
6+
implementation code and look for an "outputTransform". The implementation of that function
7+
should reveal what the user-facing function will return.
8+
9+
Please add "runtime" tests to the test-typescript directory. These tests should do
10+
"smoke" tests that - critically - verify the output of each function.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ test-app/containerLogs
1818
test-complete-app/build
1919
test-complete-app/.gradle
2020
test-complete-app-mlDeploy/build
21-
test-complete-app-mlDeploy/.gradle
21+
test-complete-app-mlDeploy/.gradle
22+
23+
# Compiled TypeScript test files
24+
test-typescript/*.js

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# CHANGELOG
22

3+
## 4.1.0
4+
5+
- Added TypeScript typings for core client/document/connection APIs, with better autocomplete and compile-time checks to catch mistakes earlier.
6+
- Added support for transform parameters when writing transforms.
7+
- Performed dependency/security maintenance (including lodash and qs updates).
8+
39
## 4.0.0
410

511
This major release does not impact any client functionality, but rather raises the minimum required version of Node.js
612
to 22 or higher. It also updates all dependencies to their latest version and removes unnecessary dependencies that
7-
were included in previous releases.
13+
were included in previous releases.
814

915
## 3.7.1
1016
#### Bug Fix

CONTRIBUTING.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ or
5858
There are also tests in the `test-complete` folder. The setup for these is more complicated and can
5959
be found in the `Jenkinsfile` file in this repository in the `runE2ETests` function.
6060

61+
## Testing TypeScript support
62+
63+
The 4.1.0 release will add TypeScript support for the client. To try this out locally and manually,
64+
see the `README.md` file in the `./typescript-test-project` directory.
65+
6166
## Generating documentation
6267

6368
After installing the project dependencies, you can build the reference documentation locally from the root
@@ -85,11 +90,11 @@ brace-expansion: "2.0.2"
8590
- Why needed: Prevents regex denial of service attacks
8691
- CVE/Issue: Related to minimatch vulnerabilities
8792

88-
glob: "10.3.11"
89-
- Purpose: Fixes ReDoS and security issues in file globbing
90-
- Affects: mocha, gulp-mocha build tooling
91-
- Why needed: Older glob versions have pattern matching vulnerabilities
92-
- CVE/Issue: Multiple vulnerabilities in older glob versions
93+
glob: "12.0.0"
94+
- Purpose: Fixes command injection vulnerability in glob CLI
95+
- Affects: mocha, gulp-mocha, rimraf (via bunyan/mv)
96+
- Why needed: Versions 10.3.7-11.0.3 vulnerable to command injection via -c/--cmd flag
97+
- CVE/Issue: GHSA-5j98-mcp5-4vw2 - Command injection via shell:true execution
9398

9499
glob-parent: "6.0.2"
95100
- Purpose: Fixes ReDoS in path parsing

Jenkinsfile

Lines changed: 68 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
@Library('shared-libraries') _
22

3-
def runTests() {
4-
sh label: 'deploy-test-app-and-run-tests', script: '''
5-
export JAVA_HOME=$JAVA_HOME_DIR
6-
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
7-
export PATH=$JAVA_HOME/bin:${NODE_HOME_DIR}/bin:$PATH
3+
def runTests(excludeFragileTests) {
4+
def excludeFlag = excludeFragileTests ? '--exclude "test-basic/documents-data-movement-*.js"' : ''
5+
6+
sh label: 'deploy-test-app-and-run-tests', script: """
7+
export JAVA_HOME=\$JAVA_HOME_DIR
8+
export GRADLE_USER_HOME=\$WORKSPACE/\$GRADLE_DIR
9+
export PATH=\$JAVA_HOME/bin:\${NODE_HOME_DIR}/bin:\$PATH
810
cd node-client-api
911
node --version
1012
npm --version
1113
npm ci
1214
1315
cd test-app
1416
./gradlew -i mlWaitTillReady
15-
sleep 3
16-
./gradlew -i mlWaitTillReady
1717
./gradlew -i mlTestConnections
1818
./gradlew -i mlDeploy
1919
./gradlew -i -Penv=e2e mlLoadData mlLoadModules
2020
2121
cd ..
22-
rm -rf $WORKSPACE/*.xml || true
23-
./node_modules/.bin/mocha --timeout 10000 -R xunit test-basic/ --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/test-basic-reports.xml || true
22+
rm -rf \$WORKSPACE/*.xml || true
23+
./node_modules/.bin/mocha --timeout 10000 -R xunit test-basic/ ${excludeFlag} --reporter mocha-junit-reporter --reporter-options mochaFile=\$WORKSPACE/test-basic-reports.xml || true
2424
./node_modules/.bin/gulp setupProxyTests || true
25-
./node_modules/.bin/mocha --timeout 10000 -R xunit test-basic-proxy/lib/**/*.js --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/test-basic-proxy-reports.xml || true
26-
'''
25+
./node_modules/.bin/mocha --timeout 10000 -R xunit test-basic-proxy/lib/**/*.js --reporter mocha-junit-reporter --reporter-options mochaFile=\$WORKSPACE/test-basic-proxy-reports.xml || true
26+
"""
2727
junit '**/*.xml'
2828
}
2929

@@ -55,7 +55,7 @@ def runAuditReport() {
5555
cd node-client-api
5656
npm ci
5757
rm -rf $WORKSPACE/npm-audit-report.json || true
58-
npm audit --audit-level=low --json > $WORKSPACE/npm-audit-report.json
58+
npm audit --audit-level=moderate --json > $WORKSPACE/npm-audit-report.json
5959
'''
6060
}
6161

@@ -69,16 +69,38 @@ def runLint() {
6969
'''
7070
}
7171

72-
def runE2ETests() {
73-
sh label: 'run-e2e-tests', script: '''
72+
def runTypeCheck() {
73+
sh label: 'run-type-check', script: '''
74+
export PATH=${NODE_HOME_DIR}/bin:$PATH
75+
cd node-client-api
76+
npm ci
77+
npm run test:types
78+
'''
79+
}
80+
81+
def runTypeScriptTests() {
82+
sh label: 'run-typescript-tests', script: '''
7483
export PATH=${NODE_HOME_DIR}/bin:$PATH
84+
cd node-client-api
85+
npm ci
86+
npm run test:compile
87+
./node_modules/.bin/mocha --timeout 10000 test-typescript/*.js --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/test-typescript-reports.xml || true
88+
'''
89+
junit '**/*test-typescript-reports.xml'
90+
}
91+
92+
def runE2ETests(excludeFragileTests) {
93+
def excludeFlag = excludeFragileTests ? '--exclude "test-complete/nodejs-dmsdk*.js"' : ''
94+
95+
sh label: 'run-e2e-tests', script: """
96+
export PATH=\${NODE_HOME_DIR}/bin:\$PATH
7597
cd node-client-api
7698
node --version
7799
npm --version
78100
npm ci
79101
80102
echo "Running test-complete tests"
81-
./node_modules/.bin/mocha --no-parallel -R xunit --timeout 60000 test-complete/ --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/test-complete-results.xml || true
103+
./node_modules/.bin/mocha --no-parallel -R xunit --timeout 60000 test-complete/ ${excludeFlag} --reporter mocha-junit-reporter --reporter-options mochaFile=\$WORKSPACE/test-complete-results.xml || true
82104
echo "Done with test-complete tests"
83105
84106
cd test-complete-proxy
@@ -90,12 +112,12 @@ def runE2ETests() {
90112
cp -R ml-modules/ ../test-complete
91113
cd ../test-complete
92114
../node_modules/.bin/mocha -R xunit --timeout 20000 nodejs-ds-setup-docs.js
93-
../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-required-params.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-required-params-results.xml || true
94-
../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-error-map.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-multipleWorker-results.xml || true
95-
../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-multipleWorker.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-multipleWorker-results.xml || true
96-
../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-transactions.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-transactions-results.js.xml || true
97-
../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-dynamic.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-dynamic-results.xml || true
98-
'''
115+
../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-required-params.js" --reporter mocha-junit-reporter --reporter-options mochaFile=\$WORKSPACE/ds-required-params-results.xml || true
116+
../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-error-map.js" --reporter mocha-junit-reporter --reporter-options mochaFile=\$WORKSPACE/ds-multipleWorker-results.xml || true
117+
../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-multipleWorker.js" --reporter mocha-junit-reporter --reporter-options mochaFile=\$WORKSPACE/ds-multipleWorker-results.xml || true
118+
../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-transactions.js" --reporter mocha-junit-reporter --reporter-options mochaFile=\$WORKSPACE/ds-transactions-results.js.xml || true
119+
../node_modules/.bin/mocha -R xunit --timeout 20000 "nodejs-ds-dynamic.js" --reporter mocha-junit-reporter --reporter-options mochaFile=\$WORKSPACE/ds-dynamic-results.xml || true
120+
"""
99121
junit '**/*.xml'
100122
}
101123

@@ -108,6 +130,7 @@ pipeline {
108130

109131
parameters {
110132
booleanParam(name: 'regressions', defaultValue: false, description: 'indicator if build is for regressions')
133+
string(name: 'MARKLOGIC_IMAGE_TAGS', defaultValue: 'marklogic-server-ubi:latest-11,marklogic-server-ubi:latest-12', description: 'Comma-delimited list of MarkLogic image tags including variant (e.g., marklogic-server-ubi:latest-11,marklogic-server-ubi-rootless:11.3.2). The registry/org (ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic) path will be prepended automatically.')
111134
}
112135

113136
options {
@@ -130,9 +153,11 @@ pipeline {
130153
steps {
131154
runAuditReport()
132155
runLint()
156+
runTypeCheck()
133157
runDockerCompose('ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12')
134-
runTests()
135-
runE2ETests()
158+
runTests(true)
159+
runTypeScriptTests()
160+
runE2ETests(true)
136161
}
137162
post {
138163
always {
@@ -142,63 +167,27 @@ pipeline {
142167
}
143168

144169
stage('regressions') {
145-
parallel {
146-
147-
stage('runtests-11-nightly') {
148-
when {
149-
allOf {
150-
branch 'develop'
151-
expression { return params.regressions }
152-
}
153-
}
154-
agent { label 'nodeclientpool' }
155-
steps {
156-
runDockerCompose('ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-11')
157-
runTests()
158-
runE2ETests()
159-
}
160-
post {
161-
always {
162-
teardownAfterTests()
163-
}
164-
}
165-
}
166-
167-
stage('runtests-12-nightly') {
168-
when {
169-
allOf {
170-
branch 'develop'
171-
expression { return params.regressions }
172-
}
173-
}
174-
agent { label 'nodeclientpool' }
175-
steps {
176-
runDockerCompose('ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12')
177-
runTests()
178-
runE2ETests()
179-
}
180-
post {
181-
always {
182-
teardownAfterTests()
183-
}
184-
}
170+
agent { label 'nodeclientpool' }
171+
when {
172+
allOf {
173+
branch 'develop'
174+
expression { return params.regressions }
185175
}
186-
187-
stage('runtests-10-nightly') {
188-
when {
189-
allOf {
190-
branch 'develop'
191-
expression { return params.regressions }
192-
}
193-
}
194-
agent { label 'nodeclientpool' }
195-
steps {
196-
runDockerCompose('ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-10')
197-
runTests()
198-
runE2ETests()
199-
}
200-
post {
201-
always {
176+
}
177+
steps {
178+
script {
179+
def imageTags = params.MARKLOGIC_IMAGE_TAGS.split(',')
180+
def imagePrefix = 'ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/'
181+
182+
imageTags.each { tag ->
183+
def fullImage = imagePrefix + tag.trim()
184+
185+
try {
186+
runDockerCompose(fullImage)
187+
runTests(false)
188+
runTypeScriptTests()
189+
runE2ETests(false)
190+
} finally {
202191
teardownAfterTests()
203192
}
204193
}

0 commit comments

Comments
 (0)