@stordata/vsphere-soapify 0.0.28 → 0.0.35

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/.gitlab-ci.yml CHANGED
@@ -1,12 +1,32 @@
1
- image: docker.stordata.fr/stordata/docker-node:16
1
+ image: docker.stordata.fr/stordata/docker-node:20
2
2
 
3
3
  stages:
4
- - build
4
+ - test
5
+ - release
5
6
 
6
- build:
7
- stage: build
7
+ include:
8
+ - template: Jobs/SAST.gitlab-ci.yml
9
+ - template: Jobs/Dependency-Scanning.gitlab-ci.yml
10
+
11
+ variables:
12
+ SAST_EXCLUDED_PATHS: "*.spec.js, *.test.js"
13
+
14
+ test:
15
+ stage: test
8
16
  tags:
9
17
  - docker
10
18
  script:
11
19
  - npm ci
12
- - grunt
20
+ - npm run lint
21
+ - npm test
22
+
23
+ release:
24
+ stage: release
25
+ tags:
26
+ - docker
27
+ script:
28
+ - npm -registry=https://registry.npmjs.org whoami
29
+ - npm -registry=https://registry.npmjs.org publish
30
+ - git checkout .
31
+ rules:
32
+ - if: $CI_COMMIT_TAG
package/.mocharc.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "timeout": 5000,
3
+ "recursive": true,
4
+ "require": [
5
+ "lib/env.test.js"
6
+ ]
7
+ }
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 16.13.0
1
+ 20.9.0
package/README.md CHANGED
@@ -58,12 +58,30 @@ client
58
58
 
59
59
  ## Releasing
60
60
 
61
- This library is released on NPM. To release a new version run `grunt release`
62
- Beware that you need to be logged in on NPM and have write access to the Stordata organization.
61
+ This library is released on NPM. To release a new version:
63
62
 
64
- Login npm cmd line
63
+ * Be on `master` branch and fully rebased
64
+ * Tag the version to release
65
65
 
66
- Run `npm --registry=https://registry.npmjs.org login` then enter your credentials.
66
+ ```bash
67
+ git tag v$(jq -r .version package.json)
68
+ ```
69
+
70
+ * Increment version number in [package.json](package.json)
71
+ * Persist changes in lockfile
72
+
73
+ ```bash
74
+ npm i
75
+ ```
67
76
 
68
- Finally to ensure your connection `npm --registry=https://registry.npmjs.org whoami` and you should see your username.
77
+ * Commit your changes
69
78
 
79
+ ```bash
80
+ git commit -am"[ci skip] Bumped version to $(jq -r .version package.json)"
81
+ ```
82
+
83
+ * Push everything
84
+
85
+ ```bash
86
+ git push $(git config branch.master.remote) master --tags
87
+ ```
package/lib/client.js CHANGED
@@ -3,18 +3,18 @@
3
3
  const soap = require('soap'),
4
4
  _ = require('lodash'),
5
5
  Parser = require('./parser'),
6
- request = require('./request'),
7
6
  { ServiceInstance, HostSystem, VirtualMachine, Datacenter, Datastore } = require('./sdk').managed,
8
7
  { PerfQuerySpec, PerfMetricId } = require('./sdk').data,
9
8
  DEFAULT_FEATURES = require('./features');
10
9
 
11
10
  module.exports = class Client {
11
+
12
12
  /**
13
13
  * Creates a new Client to access a vSphere server.
14
14
  *
15
15
  * @param {String} url The URL to the vSphere endpoint.
16
16
  * Use the base URL only, the library manages the actual SDK endpoints automatically
17
- * @param {Object} [requestOptions] Options given to request. See https://github.com/request/request#requestoptions-callback
17
+ * @param {Object} [options] The client options, passed to the `soap` library directly
18
18
  * @param {Object} [features] An optional list of feature flags to control advanced settings of the created Client
19
19
  * @param {boolean} [features.alwaysUseMaxSampleInQuerySpec=false] Whether to force the use of `maxSample` in QuerySpec objects,
20
20
  * even though this might form invalid calls. Use with caution !
@@ -22,9 +22,9 @@ module.exports = class Client {
22
22
  *
23
23
  * @constructor
24
24
  */
25
- constructor(url, requestOptions, features) {
25
+ constructor(url, options, features) {
26
26
  this.url = url;
27
- this.requestOptions = requestOptions;
27
+ this.options = options;
28
28
  this.features = _.defaults(features, DEFAULT_FEATURES);
29
29
 
30
30
  this.parser = new Parser(this);
@@ -43,10 +43,7 @@ module.exports = class Client {
43
43
  getClient() {
44
44
  const wsdl = `${__dirname}/wsdl/5.5/vimService.wsdl`;
45
45
 
46
- return this._cache('client', () => soap.createClientAsync(wsdl, {
47
- endpoint: this.url,
48
- request: request(this.url, this.requestOptions)
49
- }));
46
+ return this._cache('client', () => soap.createClientAsync(wsdl, { endpoint: this.url, ...this.options }));
50
47
  }
51
48
 
52
49
  /**
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ process.env.NODE_ENV = 'tests';
4
+ process.env.TZ = 'UTC';
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@stordata/vsphere-soapify",
3
- "version": "0.0.28",
3
+ "version": "0.0.35",
4
4
  "description": "A NodeJS abstraction layer for the vSphere SOAP API",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
7
+ "test": "npx mocha lib/all.spec.js 'lib/**/*.spec.js'",
8
+ "lint": "npx eslint index.js lib/**/*.js"
8
9
  },
9
10
  "repository": {
10
11
  "type": "git",
@@ -19,7 +20,7 @@
19
20
  "author": "Stordata <teamdenbas@stordata.fr>",
20
21
  "license": "UNLICENCED",
21
22
  "engines": {
22
- "node": ">= 16"
23
+ "node": ">= 20"
23
24
  },
24
25
  "publishConfig": {
25
26
  "access": "public",
@@ -29,26 +30,22 @@
29
30
  "axios": "0.27.2",
30
31
  "debug": "4.3.4",
31
32
  "lodash": "4.17.21",
32
- "soap": "0.45.0",
33
- "tough-cookie": "4.1.2"
33
+ "soap": "1.0.0",
34
+ "tough-cookie": "4.1.3"
34
35
  },
35
36
  "devDependencies": {
36
- "@stordata/eslint-config": "1.0.20220924010720",
37
- "chai": "4.3.6",
37
+ "@stordata/eslint-config": "1.0.20231104011033",
38
+ "chai": "4.3.10",
38
39
  "chai-datetime": "1.8.0",
39
- "eslint": "8.24.0",
40
- "eslint-plugin-import": "2.26.0",
40
+ "eslint": "8.53.0",
41
+ "eslint-plugin-import": "2.29.0",
41
42
  "eslint-plugin-json": "3.1.0",
42
- "eslint-plugin-no-only-tests": "3.0.0",
43
+ "eslint-plugin-no-only-tests": "3.1.0",
43
44
  "eslint-plugin-node": "11.1.0",
44
- "grunt": "1.5.3",
45
- "grunt-env": "1.0.1",
46
- "grunt-eslint": "24.0.0",
47
- "grunt-release": "0.14.0",
48
- "grunt-simple-mocha": "0.4.1",
45
+ "mocha": "10.2.0",
49
46
  "mockdate": "3.0.5",
50
- "nock": "13.2.9",
51
- "sinon": "14.0.0",
47
+ "nock": "13.3.8",
48
+ "sinon": "17.0.1",
52
49
  "sinon-chai": "3.7.0"
53
50
  }
54
51
  }
package/samples/index.js CHANGED
@@ -3,13 +3,16 @@
3
3
  'use strict';
4
4
 
5
5
  const https = require('https'),
6
+ request = require('../lib/request'),
6
7
  { Client } = require('..'),
7
8
  { VSPHERE_URI, LOGIN, PASSWORD } = process.env;
8
9
 
9
10
  module.exports = (sample) => {
10
11
  const client = new Client(VSPHERE_URI, {
11
- httpsAgent: new https.Agent({
12
- rejectUnauthorized: false
12
+ request: request(VSPHERE_URI, {
13
+ httpsAgent: new https.Agent({
14
+ rejectUnauthorized: false
15
+ })
13
16
  })
14
17
  });
15
18
 
package/Gruntfile.js DELETED
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = (grunt) => {
4
- grunt.initConfig({
5
- eslint: {
6
- target: [
7
- 'index.js',
8
- 'Gruntfile.js',
9
- 'lib/**/*.js'
10
- ]
11
- },
12
- simplemocha: {
13
- options: {
14
- timeout: 5000
15
- },
16
- all: {
17
- src: ['lib/all.spec.js', 'lib/**/*.spec.js']
18
- }
19
- },
20
- env: {
21
- tests: {
22
- NODE_ENV: 'tests',
23
- TZ: 'UTC'
24
- }
25
- },
26
- release: {
27
- options: {
28
- tagName: 'v<%= version %>',
29
- beforeRelease: ['build']
30
- }
31
- }
32
- });
33
-
34
- grunt.loadNpmTasks('grunt-eslint');
35
- grunt.loadNpmTasks('grunt-simple-mocha');
36
- grunt.loadNpmTasks('grunt-env');
37
- grunt.loadNpmTasks('grunt-release');
38
-
39
- grunt.registerTask('default', ['build']);
40
-
41
- grunt.registerTask('build', ['env:tests', 'eslint', 'simplemocha']);
42
- };