@beauraines/node-helpers 2.3.1 → 2.4.1

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/CHANGELOG.md CHANGED
@@ -1,7 +1,16 @@
1
- :q# Changelog
1
+ # Changelog
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.4.1](https://github.com/beauraines/node-helpers/compare/v2.4.0...v2.4.1) (2023-03-06)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * adds missing dayjs dependency for azure storage queues ([094a2ed](https://github.com/beauraines/node-helpers/commit/094a2ed5d7c12f365c8712f13731b905d530e914))
11
+
12
+ ## [2.4.0](https://github.com/beauraines/node-helpers/compare/v2.3.1...v2.4.0) (2023-03-05)
13
+
5
14
  ### [2.3.1](https://github.com/beauraines/node-helpers/compare/v2.2.0...v2.3.1) (2023-03-02)
6
15
 
7
16
  ## [2.2.0](https://github.com/beauraines/node-helpers/compare/v1.1.0...v2.2.0) (2023-03-02)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beauraines/node-helpers",
3
- "version": "2.3.1",
3
+ "version": "2.4.1",
4
4
  "description": "Collection of node helpers",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,6 +13,7 @@
13
13
  "dependencies": {
14
14
  "@azure/storage-queue": "^12.11.0",
15
15
  "azure-storage": "^2.10.7",
16
+ "dayjs": "^1.11.7",
16
17
  "node-fetch": "^2.6.7",
17
18
  "sparkly": "^5.0.0",
18
19
  "sqlite": "^4.1.2",
package/src/azure.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const azure = require('azure-storage');
2
+ const dayjs = require('dayjs')
2
3
  const { QueueClient, StorageSharedKeyCredential } = require("@azure/storage-queue");
3
4
  var path = require('path');
4
5
 
@@ -93,6 +94,28 @@ class AzureStorage {
93
94
  }
94
95
  }
95
96
 
97
+ /**
98
+ * Gets a SAS token for the storage queue
99
+ * .
100
+ * @param {string} queueUrl The URL to the storage queue
101
+ * @param {object} options Should include `permissions: "raup"` or some combination thereof Any additional options supported. https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
102
+ */
103
+ getStorageQueueSignedURL(queueUrl,options) {
104
+
105
+ const queueClient = new QueueClient(
106
+ queueUrl,
107
+ new StorageSharedKeyCredential(this.storageAccountName, this.storageAccountKey)
108
+ )
109
+
110
+ options = {
111
+ startsOn: dayjs().toDate(),
112
+ ...options
113
+ }
114
+
115
+ return queueClient.generateSasUrl(options)
116
+
117
+ }
118
+
96
119
  /**
97
120
  * Generates a signed URL for the specified blob in the specified container. The signed URL will expire
98
121
  * after the class's `tokenExpiry` minutes, which defaults to 60 if not specified.