@beauraines/node-helpers 2.10.0 → 2.13.0

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.
@@ -22,5 +22,6 @@ jobs:
22
22
  with:
23
23
  node-version: ${{ matrix.node-version }}
24
24
  - run: npm ci
25
+ - run: npm run lint
25
26
  - run: npm run build --if-present
26
27
  - run: npm test
package/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ## [2.10.0](https://github.com/beauraines/node-helpers/compare/v2.7.1...v2.10.0) (2023-07-01)
5
+ ## [2.13.0](https://github.com/beauraines/node-helpers/compare/v2.7.1...v2.13.0) (2023-07-01)
6
6
 
7
7
 
8
8
  ### Features
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@beauraines/node-helpers",
3
- "version": "2.10.0",
3
+ "version": "2.13.0",
4
4
  "description": "Collection of node helpers",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "jest",
8
8
  "release": "standard-version",
9
- "should-release": "should-release"
9
+ "should-release": "should-release",
10
+ "lint": "eslint '*/**.js'",
11
+ "lint:fix": "eslint '*/**.js' --fix"
10
12
  },
11
13
  "author": "beau.raines@gmail.com",
12
14
  "license": "ISC",
package/src/azure.js CHANGED
@@ -236,7 +236,6 @@ getStorageQueueSignedURL(queueUrl,options) {
236
236
  new StorageSharedKeyCredential(this.storageAccountName, this.storageAccountKey)
237
237
  );
238
238
  const containerClient = blobServiceClient.getContainerClient(containerName);
239
- let i = 1;
240
239
  let blobs = []
241
240
  for await (const blob of containerClient.listBlobsFlat()) {
242
241
  blobs.push(blob)
package/src/azure.test.js CHANGED
@@ -112,6 +112,7 @@ describe('Azure Storage module', () => {
112
112
  let blobName = 'package.json'
113
113
  let azure = new AzureStorage(account,accountKey,{cloudName:'Azurite'})
114
114
  let blobs = await azure.listBlobs(containerName)
115
+ console.log(blobs)
115
116
  expect(Array.isArray(blobs));
116
117
  expect(blobs.length).toBeGreaterThan(0)
117
118
  expect(blobs.filter(b => b.name == blobName).length).toBe(1)
package/src/config.js CHANGED
@@ -47,7 +47,7 @@ const validateConfig = async (configFile, configProps) => {
47
47
  config = JSON.parse(config);
48
48
  // Check for properties
49
49
  let validConfig = true
50
- for (key of configProps) {
50
+ for (const key of configProps) {
51
51
  validConfig = config[key] ? true : false
52
52
  }
53
53
 
@@ -67,7 +67,7 @@ const validateConfig = async (configFile, configProps) => {
67
67
  const createConfig = async (configFile,configProps) => {
68
68
  configFile = path.join(homedir(),configFile)
69
69
  let config = {}
70
- for (key of configProps) {
70
+ for (const key of configProps) {
71
71
  config[key] = ''
72
72
  }
73
73
  fs.writeFileSync(configFile,JSON.stringify(config))
@@ -1,5 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const {fileExists} = require('./helpers');
3
+ const process = require('node:process')
3
4
 
4
5
  /**
5
6
  * Reads a file for credentials and validates that the file has the required attributes.
package/src/database.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const {homedir} = require('os');
2
+ const process = require('node:process')
2
3
  const sqlite = require('sqlite');
3
4
  const sqlite3 = require('sqlite3');
4
5
  const {fileExists} = require('./helpers');
@@ -4,6 +4,7 @@ const sqlite3 = require('sqlite3');
4
4
  const helpers = require('./helpers');
5
5
  const { getDBConnection } = require('./database');
6
6
  const path = require('path');
7
+ const process = require('node:process')
7
8
 
8
9
  jest.mock('sqlite');
9
10
  jest.mock('os');
@@ -37,6 +38,7 @@ describe('database module', () => {
37
38
 
38
39
  const file = undefined;
39
40
  // call function with null file
41
+ // eslint-disable-next-line no-unused-vars
40
42
  const db = await getDBConnection(file)
41
43
 
42
44
  // In theory you should mock the open function and what it returns.
@@ -59,6 +61,7 @@ describe('database module', () => {
59
61
 
60
62
  const expectedDefaultFile = path.join(os.homedir(),'BurnDownStatus.db')
61
63
 
64
+ // eslint-disable-next-line no-unused-vars
62
65
  const db = await getDBConnection(expectedDefaultFile)
63
66
 
64
67
  expect(sqlite.open).toHaveBeenCalledWith({
package/src/helpers.js CHANGED
@@ -115,6 +115,7 @@ function getEpochMillis() {
115
115
  * @param {object} options Optional options for display, e.g display min,max,last, range coercion
116
116
  * @returns
117
117
  */
118
+ // eslint-disable-next-line no-unused-vars
118
119
  function sparkline(data,label,options) {
119
120
  // TODO add handling if data is object
120
121
  // let open = last30days.map( x=> x.open_count)
@@ -153,9 +154,11 @@ async function streamToBuffer(readableStream) {
153
154
  return new Promise((resolve, reject) => {
154
155
  const chunks = [];
155
156
  readableStream.on("data", (data) => {
157
+ // eslint-disable-next-line no-undef
156
158
  chunks.push(data instanceof Buffer ? data : Buffer.from(data));
157
159
  });
158
160
  readableStream.on("end", () => {
161
+ // eslint-disable-next-line no-undef
159
162
  resolve(Buffer.concat(chunks));
160
163
  });
161
164
  readableStream.on("error", reject);
package/src/jira.js CHANGED
@@ -8,6 +8,7 @@ const fetch = require('node-fetch');
8
8
  * @returns String
9
9
  */
10
10
  function credentialsToToken(email,token) {
11
+ // eslint-disable-next-line no-undef
11
12
  let bearerToken = Buffer.from(`${email}:${token}`).toString('base64');
12
13
  return bearerToken
13
14
  }