@forge/storage 1.3.0 → 1.3.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/__test__/global-storage.test.js +3 -3
- package/out/__test__/list-api.test.js +4 -4
- package/out/errors.js +6 -4
- package/out/global-storage.js +7 -7
- package/out/index.js +3 -2
- package/out/queries.js +10 -5
- package/package.json +2 -2
- package/CHANGELOG.md +0 -126
|
@@ -347,7 +347,7 @@ describe('GlobalStorage', () => {
|
|
|
347
347
|
where,
|
|
348
348
|
cursor,
|
|
349
349
|
limit
|
|
350
|
-
}, queries_1.listQuery(contextAri, {}).query);
|
|
350
|
+
}, (0, queries_1.listQuery)(contextAri, {}).query);
|
|
351
351
|
expect(response).toEqual(expect.objectContaining({
|
|
352
352
|
results: [
|
|
353
353
|
{ key: 'key1', value: 'testValue' },
|
|
@@ -384,7 +384,7 @@ describe('GlobalStorage', () => {
|
|
|
384
384
|
where,
|
|
385
385
|
cursor,
|
|
386
386
|
limit
|
|
387
|
-
}, queries_1.listQueryForCleanup(contextAri, {}).query);
|
|
387
|
+
}, (0, queries_1.listQueryForCleanup)(contextAri, {}).query);
|
|
388
388
|
expect(response).toEqual(expect.objectContaining({
|
|
389
389
|
results: [
|
|
390
390
|
{ key: 'key1', value: 'testValue' },
|
|
@@ -409,7 +409,7 @@ describe('GlobalStorage', () => {
|
|
|
409
409
|
where: null,
|
|
410
410
|
cursor: null,
|
|
411
411
|
limit: null
|
|
412
|
-
}, queries_1.listQuery(contextAri, {}).query);
|
|
412
|
+
}, (0, queries_1.listQuery)(contextAri, {}).query);
|
|
413
413
|
});
|
|
414
414
|
it('should handle an empty result set', async () => {
|
|
415
415
|
const apiClientMock = getApiClientMock({
|
|
@@ -51,7 +51,7 @@ describe('DefaultQueryBuilder', () => {
|
|
|
51
51
|
});
|
|
52
52
|
it('should allow specifying a "starts with" condition', async () => {
|
|
53
53
|
const globalStorage = newGlobalStorage();
|
|
54
|
-
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_1.startsWith('test')).getMany();
|
|
54
|
+
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', (0, conditions_1.startsWith)('test')).getMany();
|
|
55
55
|
expect(globalStorage.list).toHaveBeenCalledWith(expect.objectContaining({
|
|
56
56
|
where: [
|
|
57
57
|
{
|
|
@@ -64,7 +64,7 @@ describe('DefaultQueryBuilder', () => {
|
|
|
64
64
|
});
|
|
65
65
|
it('should allow specifying a "not equal to" condition', async () => {
|
|
66
66
|
const globalStorage = newGlobalStorage();
|
|
67
|
-
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_2.isNotEqualTo(['test', 'test2'])).getMany();
|
|
67
|
+
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', (0, conditions_2.isNotEqualTo)(['test', 'test2'])).getMany();
|
|
68
68
|
expect(globalStorage.list).toHaveBeenCalledWith(expect.objectContaining({
|
|
69
69
|
where: [
|
|
70
70
|
{
|
|
@@ -77,7 +77,7 @@ describe('DefaultQueryBuilder', () => {
|
|
|
77
77
|
});
|
|
78
78
|
it('should allow specifying an "is in" condition', async () => {
|
|
79
79
|
const globalStorage = newGlobalStorage();
|
|
80
|
-
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_2.isIn(['test', 'test2'])).getMany();
|
|
80
|
+
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', (0, conditions_2.isIn)(['test', 'test2'])).getMany();
|
|
81
81
|
expect(globalStorage.list).toHaveBeenCalledWith(expect.objectContaining({
|
|
82
82
|
where: [
|
|
83
83
|
{
|
|
@@ -90,7 +90,7 @@ describe('DefaultQueryBuilder', () => {
|
|
|
90
90
|
});
|
|
91
91
|
it('should allow specifying a condition', async () => {
|
|
92
92
|
const globalStorage = newGlobalStorage();
|
|
93
|
-
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_1.startsWith('test')).getMany();
|
|
93
|
+
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', (0, conditions_1.startsWith)('test')).getMany();
|
|
94
94
|
expect(globalStorage.list).toHaveBeenCalledWith(expect.objectContaining({
|
|
95
95
|
where: [
|
|
96
96
|
{
|
package/out/errors.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.APIError = exports.getErrorMessage = exports.getErrorMessageFromCode = void 0;
|
|
4
|
-
|
|
4
|
+
const getErrorMessageFromCode = (code, message) => {
|
|
5
5
|
return message !== null && message !== void 0 ? message : code;
|
|
6
6
|
};
|
|
7
|
-
exports.
|
|
7
|
+
exports.getErrorMessageFromCode = getErrorMessageFromCode;
|
|
8
|
+
const getErrorMessage = (statusCode) => {
|
|
8
9
|
switch (statusCode) {
|
|
9
10
|
case 400:
|
|
10
11
|
case 413:
|
|
@@ -22,15 +23,16 @@ exports.getErrorMessage = (statusCode) => {
|
|
|
22
23
|
return `Unknown error. Received status code '${statusCode}'`;
|
|
23
24
|
}
|
|
24
25
|
};
|
|
26
|
+
exports.getErrorMessage = getErrorMessage;
|
|
25
27
|
class APIError extends Error {
|
|
26
28
|
constructor(message) {
|
|
27
29
|
super(message);
|
|
28
30
|
}
|
|
29
31
|
static forStatus(status) {
|
|
30
|
-
return new APIError(exports.getErrorMessage(status));
|
|
32
|
+
return new APIError((0, exports.getErrorMessage)(status));
|
|
31
33
|
}
|
|
32
34
|
static forErrorCode(code, message) {
|
|
33
|
-
return new APIError(exports.getErrorMessageFromCode(code, message));
|
|
35
|
+
return new APIError((0, exports.getErrorMessageFromCode)(code, message));
|
|
34
36
|
}
|
|
35
37
|
static forUnexpected(message) {
|
|
36
38
|
return new APIError(message);
|
package/out/global-storage.js
CHANGED
|
@@ -41,8 +41,8 @@ class GlobalStorage {
|
|
|
41
41
|
}
|
|
42
42
|
async list(options) {
|
|
43
43
|
const requestBody = process.env.IS_CLEANUP_FUNCTION === 'true'
|
|
44
|
-
? queries_1.listQueryForCleanup(this.doGetAppContextAri(), options)
|
|
45
|
-
: queries_1.listQuery(this.doGetAppContextAri(), options);
|
|
44
|
+
? (0, queries_1.listQueryForCleanup)(this.doGetAppContextAri(), options)
|
|
45
|
+
: (0, queries_1.listQuery)(this.doGetAppContextAri(), options);
|
|
46
46
|
const response = await this.query(requestBody);
|
|
47
47
|
const edges = process.env.IS_CLEANUP_FUNCTION === 'true'
|
|
48
48
|
? response.appStoredEntitiesForCleanup.edges
|
|
@@ -55,23 +55,23 @@ class GlobalStorage {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
async set(key, value) {
|
|
58
|
-
const requestBody = queries_1.setQuery(this.doGetAppContextAri(), key, value, false);
|
|
58
|
+
const requestBody = (0, queries_1.setQuery)(this.doGetAppContextAri(), key, value, false);
|
|
59
59
|
await this.mutation(requestBody, 'setAppStoredEntity');
|
|
60
60
|
}
|
|
61
61
|
async setSecret(key, value) {
|
|
62
|
-
const requestBody = queries_1.setQuery(this.doGetAppContextAri(), key, value, true);
|
|
62
|
+
const requestBody = (0, queries_1.setQuery)(this.doGetAppContextAri(), key, value, true);
|
|
63
63
|
await this.mutation(requestBody, 'setAppStoredEntity');
|
|
64
64
|
}
|
|
65
65
|
async delete(key) {
|
|
66
|
-
const requestBody = queries_1.deleteQuery(this.doGetAppContextAri(), key, false);
|
|
66
|
+
const requestBody = (0, queries_1.deleteQuery)(this.doGetAppContextAri(), key, false);
|
|
67
67
|
await this.mutation(requestBody, 'deleteAppStoredEntity');
|
|
68
68
|
}
|
|
69
69
|
async deleteSecret(key) {
|
|
70
|
-
const requestBody = queries_1.deleteQuery(this.doGetAppContextAri(), key, true);
|
|
70
|
+
const requestBody = (0, queries_1.deleteQuery)(this.doGetAppContextAri(), key, true);
|
|
71
71
|
await this.mutation(requestBody, 'deleteAppStoredEntity');
|
|
72
72
|
}
|
|
73
73
|
async getInternal(key, encrypted) {
|
|
74
|
-
const requestBody = queries_1.getQuery(this.doGetAppContextAri(), key, encrypted);
|
|
74
|
+
const requestBody = (0, queries_1.getQuery)(this.doGetAppContextAri(), key, encrypted);
|
|
75
75
|
const { appStoredEntity: { value } } = await this.query(requestBody);
|
|
76
76
|
return value !== null && value !== void 0 ? value : undefined;
|
|
77
77
|
}
|
package/out/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getStorageInstanceWithQuery = void 0;
|
|
3
|
+
exports.APIError = exports.startsWith = exports.GlobalStorage = exports.getStorageInstanceWithQuery = void 0;
|
|
4
4
|
const query_api_1 = require("./query-api");
|
|
5
|
-
|
|
5
|
+
const getStorageInstanceWithQuery = (adapter) => {
|
|
6
6
|
return {
|
|
7
7
|
get: adapter.get.bind(adapter),
|
|
8
8
|
set: adapter.set.bind(adapter),
|
|
@@ -13,6 +13,7 @@ exports.getStorageInstanceWithQuery = (adapter) => {
|
|
|
13
13
|
query: () => new query_api_1.DefaultQueryBuilder(adapter)
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
+
exports.getStorageInstanceWithQuery = getStorageInstanceWithQuery;
|
|
16
17
|
var global_storage_1 = require("./global-storage");
|
|
17
18
|
Object.defineProperty(exports, "GlobalStorage", { enumerable: true, get: function () { return global_storage_1.GlobalStorage; } });
|
|
18
19
|
var conditions_1 = require("./conditions");
|
package/out/queries.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteQuery = exports.setQuery = exports.listQueryForCleanup = exports.listQuery = exports.getQuery = void 0;
|
|
4
|
-
|
|
4
|
+
const getQuery = (contextAri, key, encrypted) => ({
|
|
5
5
|
query: `
|
|
6
6
|
query forge_app_getApplicationStorageEntity($contextAri: ID!, $key: ID!, $encrypted: Boolean!) {
|
|
7
7
|
appStoredEntity(contextAri: $contextAri, key: $key, encrypted: $encrypted) {
|
|
@@ -16,7 +16,8 @@ exports.getQuery = (contextAri, key, encrypted) => ({
|
|
|
16
16
|
encrypted
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
exports.
|
|
19
|
+
exports.getQuery = getQuery;
|
|
20
|
+
const listQuery = (contextAri, options) => {
|
|
20
21
|
var _a, _b, _c;
|
|
21
22
|
return ({
|
|
22
23
|
query: `
|
|
@@ -41,7 +42,8 @@ exports.listQuery = (contextAri, options) => {
|
|
|
41
42
|
}
|
|
42
43
|
});
|
|
43
44
|
};
|
|
44
|
-
exports.
|
|
45
|
+
exports.listQuery = listQuery;
|
|
46
|
+
const listQueryForCleanup = (contextAri, options) => {
|
|
45
47
|
var _a, _b, _c;
|
|
46
48
|
return ({
|
|
47
49
|
query: `
|
|
@@ -66,7 +68,8 @@ exports.listQueryForCleanup = (contextAri, options) => {
|
|
|
66
68
|
}
|
|
67
69
|
});
|
|
68
70
|
};
|
|
69
|
-
exports.
|
|
71
|
+
exports.listQueryForCleanup = listQueryForCleanup;
|
|
72
|
+
const setQuery = (contextAri, key, value, encrypted) => ({
|
|
70
73
|
query: `
|
|
71
74
|
mutation forge_app_setApplicationStorageEntity($input: SetAppStoredEntityMutationInput!) {
|
|
72
75
|
appStorage{
|
|
@@ -92,7 +95,8 @@ exports.setQuery = (contextAri, key, value, encrypted) => ({
|
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
});
|
|
95
|
-
exports.
|
|
98
|
+
exports.setQuery = setQuery;
|
|
99
|
+
const deleteQuery = (contextAri, key, encrypted) => ({
|
|
96
100
|
query: `
|
|
97
101
|
mutation forge_app_deleteApplicationStorageEntity($input: DeleteAppStoredEntityMutationInput!) {
|
|
98
102
|
appStorage {
|
|
@@ -117,3 +121,4 @@ exports.deleteQuery = (contextAri, key, encrypted) => ({
|
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
123
|
});
|
|
124
|
+
exports.deleteQuery = deleteQuery;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/storage",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Forge Storage methods",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^12.12.63",
|
|
19
19
|
"@types/node-fetch": "^2.5.7",
|
|
20
|
-
"node-fetch": "2.6.
|
|
20
|
+
"node-fetch": "2.6.7"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
# @forge/storage
|
|
2
|
-
|
|
3
|
-
## 1.3.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- 3c3c42b: Updated EAP filter names to be more readable
|
|
8
|
-
|
|
9
|
-
## 1.3.0-next.0
|
|
10
|
-
|
|
11
|
-
### Minor Changes
|
|
12
|
-
|
|
13
|
-
- 3c3c42b9: Updated EAP filter names to be more readable
|
|
14
|
-
|
|
15
|
-
## 1.2.0
|
|
16
|
-
|
|
17
|
-
### Minor Changes
|
|
18
|
-
|
|
19
|
-
- 21e392d: Added new filters for Early Access Program
|
|
20
|
-
|
|
21
|
-
## 1.2.0-next.0
|
|
22
|
-
|
|
23
|
-
### Minor Changes
|
|
24
|
-
|
|
25
|
-
- 21e392d: Added new filters for Early Access Program
|
|
26
|
-
|
|
27
|
-
## 1.1.0
|
|
28
|
-
|
|
29
|
-
### Minor Changes
|
|
30
|
-
|
|
31
|
-
- 0d7fe27: Support secret storage API
|
|
32
|
-
|
|
33
|
-
## 1.1.0-next.0
|
|
34
|
-
|
|
35
|
-
### Minor Changes
|
|
36
|
-
|
|
37
|
-
- 0d7fe27: Support secret storage API
|
|
38
|
-
|
|
39
|
-
## 1.0.5
|
|
40
|
-
|
|
41
|
-
### Patch Changes
|
|
42
|
-
|
|
43
|
-
- 0700578: Fix GraphQL query naming convention
|
|
44
|
-
|
|
45
|
-
## 1.0.5-next.0
|
|
46
|
-
|
|
47
|
-
### Patch Changes
|
|
48
|
-
|
|
49
|
-
- 0700578: Fix GraphQL query naming convention
|
|
50
|
-
|
|
51
|
-
## 1.0.4
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- 5ff60ec: FRGE-273 Remove engines for storage and resolver
|
|
56
|
-
|
|
57
|
-
## 1.0.4-next.0
|
|
58
|
-
|
|
59
|
-
### Patch Changes
|
|
60
|
-
|
|
61
|
-
- 5ff60ec: FRGE-273 Remove engines for storage and resolver
|
|
62
|
-
|
|
63
|
-
## 1.0.3
|
|
64
|
-
|
|
65
|
-
### Patch Changes
|
|
66
|
-
|
|
67
|
-
- 9b496aa: Fixed parsing of response for cleanup functions
|
|
68
|
-
|
|
69
|
-
## 1.0.3-next.0
|
|
70
|
-
|
|
71
|
-
### Patch Changes
|
|
72
|
-
|
|
73
|
-
- 9b496aa: Fixed parsing of response for cleanup functions
|
|
74
|
-
|
|
75
|
-
## 1.0.2
|
|
76
|
-
|
|
77
|
-
### Patch Changes
|
|
78
|
-
|
|
79
|
-
- c7c6de2: Support larger list queries for GDPR purposes
|
|
80
|
-
|
|
81
|
-
## 1.0.2-next.0
|
|
82
|
-
|
|
83
|
-
### Patch Changes
|
|
84
|
-
|
|
85
|
-
- c7c6de2: Support larger list queries for GDPR purposes
|
|
86
|
-
|
|
87
|
-
## 1.0.1
|
|
88
|
-
|
|
89
|
-
### Patch Changes
|
|
90
|
-
|
|
91
|
-
- c0e9085: Improve README
|
|
92
|
-
|
|
93
|
-
## 1.0.1-next.0
|
|
94
|
-
|
|
95
|
-
### Patch Changes
|
|
96
|
-
|
|
97
|
-
- c0e9085: Improve README
|
|
98
|
-
|
|
99
|
-
## 1.0.0
|
|
100
|
-
|
|
101
|
-
### Major Changes
|
|
102
|
-
|
|
103
|
-
- 1daf2c5: Forge packages to 1.0.0 for upcoming platform GA 🎉
|
|
104
|
-
|
|
105
|
-
## 1.0.0-next.0
|
|
106
|
-
|
|
107
|
-
### Major Changes
|
|
108
|
-
|
|
109
|
-
- 1daf2c5: Forge is now generally available 🎉
|
|
110
|
-
|
|
111
|
-
## 0.0.2
|
|
112
|
-
|
|
113
|
-
### Patch Changes
|
|
114
|
-
|
|
115
|
-
- 843a703: Add forge-storage library
|
|
116
|
-
|
|
117
|
-
## 0.0.2-next.0
|
|
118
|
-
|
|
119
|
-
### Patch Changes
|
|
120
|
-
|
|
121
|
-
- 843a703: Add forge-storage library
|
|
122
|
-
|
|
123
|
-
## 0.0.1
|
|
124
|
-
|
|
125
|
-
- First release
|
|
126
|
-
- Refactored from `forge-api` package
|