@usebruno/js 0.10.1 → 0.11.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usebruno/js",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "license": "MIT",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -16,6 +16,7 @@
16
16
  "dependencies": {
17
17
  "@usebruno/query": "0.1.0",
18
18
  "ajv": "^8.12.0",
19
+ "ajv-formats": "^2.1.1",
19
20
  "atob": "^2.1.2",
20
21
  "axios": "^1.5.1",
21
22
  "btoa": "^1.2.1",
@@ -28,7 +29,7 @@
28
29
  "moment": "^2.29.4",
29
30
  "nanoid": "3.3.4",
30
31
  "node-fetch": "2.*",
31
- "uuid": "^9.0.0",
32
- "node-vault": "^0.10.2"
32
+ "node-vault": "^0.10.2",
33
+ "uuid": "^9.0.0"
33
34
  }
34
35
  }
@@ -20,6 +20,22 @@ class BrunoRequest {
20
20
  return this.req.method;
21
21
  }
22
22
 
23
+ getAuthMode() {
24
+ if (this.req?.oauth2) {
25
+ return 'oauth2';
26
+ } else if (this.headers?.['Authorization']?.startsWith('Bearer')) {
27
+ return 'bearer';
28
+ } else if (this.headers?.['Authorization']?.startsWith('Basic') || this.req?.auth?.username) {
29
+ return 'basic';
30
+ } else if (this.req?.awsv4) {
31
+ return 'awsv4';
32
+ } else if (this.req?.digestConfig) {
33
+ return 'digest';
34
+ } else {
35
+ return 'none';
36
+ }
37
+ }
38
+
23
39
  setMethod(method) {
24
40
  this.req.method = method;
25
41
  }
@@ -16,6 +16,7 @@ const { cleanJson } = require('../utils');
16
16
 
17
17
  // Inbuilt Library Support
18
18
  const ajv = require('ajv');
19
+ const addFormats = require('ajv-formats');
19
20
  const atob = require('atob');
20
21
  const btoa = require('btoa');
21
22
  const lodash = require('lodash');
@@ -102,6 +103,7 @@ class ScriptRuntime {
102
103
  zlib,
103
104
  // 3rd party libs
104
105
  ajv,
106
+ 'ajv-formats': addFormats,
105
107
  atob,
106
108
  btoa,
107
109
  lodash,
@@ -194,6 +196,7 @@ class ScriptRuntime {
194
196
  zlib,
195
197
  // 3rd party libs
196
198
  ajv,
199
+ 'ajv-formats': addFormats,
197
200
  atob,
198
201
  btoa,
199
202
  lodash,
@@ -19,6 +19,7 @@ const { cleanJson } = require('../utils');
19
19
 
20
20
  // Inbuilt Library Support
21
21
  const ajv = require('ajv');
22
+ const addFormats = require('ajv-formats');
22
23
  const atob = require('atob');
23
24
  const btoa = require('btoa');
24
25
  const lodash = require('lodash');
@@ -120,6 +121,7 @@ class TestRuntime {
120
121
  zlib,
121
122
  // 3rd party libs
122
123
  ajv,
124
+ 'ajv-formats': addFormats,
123
125
  btoa,
124
126
  atob,
125
127
  lodash,