@forge/os 1.2.0 → 1.2.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/out/os.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"os.d.ts","sourceRoot":"","sources":["../src/os.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"os.d.ts","sourceRoot":"","sources":["../src/os.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQxD,qBAAa,iBAAiB;YAEd,WAAW;YASX,WAAW;IAqCZ,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAahG,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAU3D,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQvC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAUjE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAerE;AAED,eAAO,MAAM,EAAE,mBAA0B,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const node_fetch_1 = require("node-fetch");
|
|
4
3
|
const errorCodes_1 = require("../../errorCodes");
|
|
5
4
|
const error_handling_1 = require("../error-handling");
|
|
6
5
|
const errors_1 = require("../../errors");
|
|
@@ -22,7 +21,7 @@ describe('error-handling', () => {
|
|
|
22
21
|
describe('checkResponseError', () => {
|
|
23
22
|
const traceId = 'trace-id';
|
|
24
23
|
it('should do nothing if response is ok', async () => {
|
|
25
|
-
const mockResponse = new
|
|
24
|
+
const mockResponse = new Response('OK', {
|
|
26
25
|
status: 200,
|
|
27
26
|
statusText: 'OK'
|
|
28
27
|
});
|
|
@@ -32,7 +31,7 @@ describe('error-handling', () => {
|
|
|
32
31
|
const message = 'A test error has occurred';
|
|
33
32
|
const code = 'ERROR_CODE';
|
|
34
33
|
it('should return a ForgeObjectStoreError when response body is a Forge error', async () => {
|
|
35
|
-
const mockResponse = new
|
|
34
|
+
const mockResponse = new Response(JSON.stringify({ code, message }), {
|
|
36
35
|
status: 400,
|
|
37
36
|
statusText: 'Bad Request',
|
|
38
37
|
headers: { 'x-trace-id': traceId }
|
|
@@ -45,7 +44,7 @@ describe('error-handling', () => {
|
|
|
45
44
|
});
|
|
46
45
|
it('should include context if present in the Forge error', async () => {
|
|
47
46
|
const context = { key: 'value' };
|
|
48
|
-
const mockResponse = new
|
|
47
|
+
const mockResponse = new Response(JSON.stringify({ code, message, context }), {
|
|
49
48
|
status: 400,
|
|
50
49
|
statusText: 'Bad Request',
|
|
51
50
|
headers: { 'x-trace-id': traceId }
|
|
@@ -58,7 +57,7 @@ describe('error-handling', () => {
|
|
|
58
57
|
});
|
|
59
58
|
it('should include top level additional fields if present in the Forge error', async () => {
|
|
60
59
|
const extraFields = { extraValue: 'value', debug: true };
|
|
61
|
-
const mockResponse = new
|
|
60
|
+
const mockResponse = new Response(JSON.stringify({ code, message, ...extraFields }), {
|
|
62
61
|
status: 400,
|
|
63
62
|
statusText: 'Bad Request',
|
|
64
63
|
headers: { 'x-trace-id': traceId }
|
|
@@ -72,7 +71,7 @@ describe('error-handling', () => {
|
|
|
72
71
|
it('should merge context and additional top level fields if both present in the Forge error', async () => {
|
|
73
72
|
const context = { key: 'value' };
|
|
74
73
|
const extraFields = { extraValue: 'value', debug: true };
|
|
75
|
-
const mockResponse = new
|
|
74
|
+
const mockResponse = new Response(JSON.stringify({ code, message, context, ...extraFields }), {
|
|
76
75
|
status: 400,
|
|
77
76
|
statusText: 'Bad Request',
|
|
78
77
|
headers: { 'x-trace-id': traceId }
|
|
@@ -85,7 +84,7 @@ describe('error-handling', () => {
|
|
|
85
84
|
});
|
|
86
85
|
describe('Handle non forge errors', () => {
|
|
87
86
|
it('returns an UNKNOWN_ERROR when no response body', async () => {
|
|
88
|
-
const mockResponse = new
|
|
87
|
+
const mockResponse = new Response(undefined, {
|
|
89
88
|
status: 404,
|
|
90
89
|
statusText: 'Not Found',
|
|
91
90
|
headers: { 'x-trace-id': traceId }
|
|
@@ -102,7 +101,7 @@ describe('error-handling', () => {
|
|
|
102
101
|
});
|
|
103
102
|
it("returns UNKNOWN_ERROR if there is a JSON body that isn't a forge error", async () => {
|
|
104
103
|
const body = JSON.stringify({ not: 'a forge error' });
|
|
105
|
-
const mockResponse = new
|
|
104
|
+
const mockResponse = new Response(body, {
|
|
106
105
|
status: 500,
|
|
107
106
|
statusText: 'Internal Server Error',
|
|
108
107
|
headers: { 'x-trace-id': traceId }
|
|
@@ -118,7 +117,7 @@ describe('error-handling', () => {
|
|
|
118
117
|
}));
|
|
119
118
|
});
|
|
120
119
|
it('returns RATE_LIMIT_EXCEEDED when status is 429', async () => {
|
|
121
|
-
const mockResponse = new
|
|
120
|
+
const mockResponse = new Response(undefined, {
|
|
122
121
|
status: 429,
|
|
123
122
|
statusText: 'Rate Limit Exceeded',
|
|
124
123
|
headers: { 'x-trace-id': traceId }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/os",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Forge Object Store SDK",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -16,12 +16,10 @@
|
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "14.18.63",
|
|
19
|
-
"@types/node-fetch": "^2.6.11",
|
|
20
19
|
"expect-type": "^0.17.3",
|
|
21
|
-
"node-fetch": "2.7.0",
|
|
22
20
|
"jest-when": "^3.6.0"
|
|
23
21
|
},
|
|
24
22
|
"dependencies": {
|
|
25
|
-
"@forge/api": "^
|
|
23
|
+
"@forge/api": "^5.0.0"
|
|
26
24
|
}
|
|
27
25
|
}
|