vsam.js 3.1.5 → 3.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@ This [Node.js](https://nodejs.org/en/) module is available through the [npm regi
8
8
  -->
9
9
 
10
10
  Before installing, [download and install IBM Open Enterprise SDK for Node.js](https://www.ibm.com/docs/en/sdk-nodejs-zos)
11
- 16 or higher. vsam.js v3.1.0 or higher is required for Node.js 18 or higher.
11
+ 20 or higher. vsam.js v3.1.6 or higher is required for Node.js 26 or higher.
12
12
 
13
13
  ## Simple to use
14
14
 
package/WrappedVsam.cpp CHANGED
@@ -78,10 +78,11 @@ void WrappedVsam::DefaultComplete(uv_work_t *req, int status) {
78
78
  Napi::HandleScope scope(pdata->env_);
79
79
  DCHECK(pdata->cb_ != nullptr && pdata->env_ != nullptr);
80
80
  if (pdata->rc_ != 0)
81
- pdata->cb_.Call(pdata->env_.Global(),
82
- {Napi::String::New(pdata->env_, pdata->errmsg_)});
81
+ pdata->cb_.MakeCallback(
82
+ pdata->env_.Global(),
83
+ {Napi::String::New(pdata->env_, pdata->errmsg_)});
83
84
  else
84
- pdata->cb_.Call(pdata->env_.Global(), {pdata->env_.Null()});
85
+ pdata->cb_.MakeCallback(pdata->env_.Global(), {pdata->env_.Null()});
85
86
  delete pdata;
86
87
  }
87
88
 
@@ -97,11 +98,11 @@ void WrappedVsam::FindUpdateComplete(uv_work_t *req, int status) {
97
98
  DCHECK(pdata->cb_ != nullptr && pdata->env_ != nullptr);
98
99
  if (pdata->rc_ != 0)
99
100
  // even on error, 1 or more records may have been updated before the error
100
- pdata->cb_.Call(pdata->env_.Global(),
101
- {Napi::Number::New(pdata->env_, pdata->count_),
102
- Napi::String::New(pdata->env_, pdata->errmsg_)});
101
+ pdata->cb_.MakeCallback(pdata->env_.Global(),
102
+ {Napi::Number::New(pdata->env_, pdata->count_),
103
+ Napi::String::New(pdata->env_, pdata->errmsg_)});
103
104
  else
104
- pdata->cb_.Call(
105
+ pdata->cb_.MakeCallback(
105
106
  pdata->env_.Global(),
106
107
  {Napi::Number::New(pdata->env_, pdata->count_), pdata->env_.Null()});
107
108
 
@@ -164,21 +165,22 @@ void WrappedVsam::ReadComplete(uv_work_t *req, int status) {
164
165
  Napi::HandleScope scope(pdata->env_);
165
166
  DCHECK(pdata->cb_ != nullptr && pdata->env_ != nullptr);
166
167
  if (pdata->rc_ != 0) {
167
- pdata->cb_.Call(
168
+ pdata->cb_.MakeCallback(
168
169
  pdata->env_.Global(),
169
170
  {pdata->env_.Null(), Napi::String::New(pdata->env_, pdata->errmsg_)});
170
171
  delete pdata;
171
172
  return;
172
173
  }
173
174
  if (pdata->recbuf_ == nullptr) {
174
- pdata->cb_.Call(pdata->env_.Global(),
175
- {pdata->env_.Null(), pdata->env_.Null()});
175
+ pdata->cb_.MakeCallback(pdata->env_.Global(),
176
+ {pdata->env_.Null(), pdata->env_.Null()});
176
177
  delete pdata;
177
178
  return;
178
179
  }
179
180
 
180
181
  Napi::Value record = createRecordObject(pdata);
181
- pdata->cb_.Call(pdata->env_.Global(), {record, pdata->env_.Null()});
182
+ pdata->cb_.MakeCallback(pdata->env_.Global(),
183
+ {record, pdata->env_.Null()});
182
184
  delete pdata;
183
185
  }
184
186
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vsam.js",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "Interact with VSAM Data Sets on z/OS",
5
5
  "main": "index.js",
6
6
  "repository": "ibmruntimes/vsam.js",
@@ -17,7 +17,7 @@
17
17
  "devDependencies": {
18
18
  "async": "^1.5.0",
19
19
  "chai": "^4.1.2",
20
- "mocha": "^10.0.0"
20
+ "mocha": "^12.0.3"
21
21
  },
22
22
  "scripts": {
23
23
  "build": "node-gyp build",
package/test/async.js CHANGED
@@ -15,8 +15,7 @@ const { execSync } = require('child_process');
15
15
  // Set IBM_VSAM_UID environment variable for customer uid
16
16
  const uid = process.env.IBM_VSAM_UID || execSync('whoami').slice(0, -1);
17
17
  const testSet = `${uid}.TEST2.VSAM.KSDS2`;
18
- const lmt = process.version.split('.')[0] === 'v12' ? " - see FIXME re delay with the 2 promises tests" : "";
19
- const title = `VSAM Key Sequenced Dataset - async APIs${lmt}`
18
+ const title = 'VSAM Key Sequenced Dataset - async APIs';
20
19
 
21
20
  function readUntilEnd(file, done) {
22
21
  var end = false;
@@ -423,14 +422,7 @@ describe(title, function() {
423
422
  });
424
423
  });
425
424
 
426
- //
427
- // FIXME(gabylb): even though all 4 promises resolve/reject in the expected time
428
- // (and DONE-* displayed), it may take too long (~30 seconds) for Promise.all() to return.
429
- // This happens only when the block below is run in mocha and Node version v12.
430
- // With Node v8, those test time out, but pass when run outside of mocha.
431
-
432
- if (process.version.split('.')[0] !== 'v8') {
433
- it("run multiple read-only transactions async", function() {
425
+ it("run multiple read-only transactions async", function() {
434
426
  var file = vsam.openSync(testSet,
435
427
  JSON.parse(fs.readFileSync('test/schema.json')),
436
428
  "rb,type=record");
@@ -490,8 +482,7 @@ describe(title, function() {
490
482
  assert.ifError(err);
491
483
  expect(file.close()).to.not.throw;
492
484
  })
493
- });
494
- }
485
+ });
495
486
 
496
487
  it("delete existing record, then find it and verify error, then delete it and verify error", function(done) {
497
488
  var file = vsam.openSync(testSet,
@@ -915,14 +906,7 @@ describe(title, function() {
915
906
  readUntilEnd(file, done);
916
907
  });
917
908
 
918
- // FIXME(gabylb): even though all 3 promises resolve/reject in the expected time
919
- // (and DONE-* displayed), it may take too long (~30 seconds) for Promise.all() to return.
920
- // This happens only when the block below is run in mocha and Node version v12.
921
- // With Node v8, those test time out, but pass when run outside of mocha.
922
- //
923
-
924
- if (process.version.split('.')[0] !== 'v8') {
925
- it("run multiple find-update transactions async", function() {
909
+ it("run multiple find-update transactions async", function() {
926
910
  var file = vsam.openSync(testSet,
927
911
  JSON.parse(fs.readFileSync('test/schema.json')));
928
912
 
@@ -966,9 +950,9 @@ describe(title, function() {
966
950
  assert.ifError(err);
967
951
  expect(file.close()).to.not.throw;
968
952
  })
969
- });
953
+ });
970
954
 
971
- it("write back a records to enable above test run in a loop if needed", function(done) {
955
+ it("write back a records to enable above test run in a loop if needed", function(done) {
972
956
  var file = vsam.openSync(testSet,
973
957
  JSON.parse(fs.readFileSync('test/schema.json')));
974
958
  record = { key: "a3", name: "NAME 72347", amount: "f1a2a3f4c5" };
@@ -977,8 +961,7 @@ describe(title, function() {
977
961
  expect(file.close()).to.not.throw;
978
962
  done();
979
963
  });
980
- });
981
- }
964
+ });
982
965
 
983
966
  it("reads all records until the end", function(done) {
984
967
  var file = vsam.openSync(testSet,