@forge/storage 0.0.0-experimental-819498d → 0.0.0-experimental-490cfcf
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 +46 -2
- package/out/__test__/global-storage.test.js +78 -7
- package/out/__test__/list-api.test.js +40 -0
- package/out/eap/conditions.d.ts +4 -0
- package/out/eap/conditions.d.ts.map +1 -0
- package/out/eap/conditions.js +17 -0
- package/out/eap/index.d.ts +2 -0
- package/out/eap/index.d.ts.map +1 -0
- package/out/eap/index.js +4 -0
- package/out/global-storage.d.ts +4 -0
- package/out/global-storage.d.ts.map +1 -1
- package/out/global-storage.js +19 -5
- package/out/index.d.ts +3 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +3 -0
- package/out/queries.d.ts +18 -4
- package/out/queries.d.ts.map +1 -1
- package/out/queries.js +15 -12
- package/out/query-api.d.ts +1 -1
- package/out/query-api.d.ts.map +1 -1
- package/out/query-api.js +2 -6
- package/out/storage-adapter.d.ts +13 -1
- package/out/storage-adapter.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,54 @@
|
|
|
1
1
|
# @forge/storage
|
|
2
2
|
|
|
3
|
-
## 0.0.0-experimental-
|
|
3
|
+
## 0.0.0-experimental-490cfcf
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 21e392d: Added new filters for Early Access Program
|
|
8
|
+
|
|
9
|
+
## 1.2.0-next.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 21e392d: Added new filters for Early Access Program
|
|
14
|
+
|
|
15
|
+
## 1.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 0d7fe27: Support secret storage API
|
|
20
|
+
|
|
21
|
+
## 1.1.0-next.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- 0d7fe27: Support secret storage API
|
|
26
|
+
|
|
27
|
+
## 1.0.5
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- 0700578: Fix GraphQL query naming convention
|
|
32
|
+
|
|
33
|
+
## 1.0.5-next.0
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 0700578: Fix GraphQL query naming convention
|
|
38
|
+
|
|
39
|
+
## 1.0.4
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 5ff60ec: FRGE-273 Remove engines for storage and resolver
|
|
44
|
+
|
|
45
|
+
## 1.0.4-next.0
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- 5ff60ec: FRGE-273 Remove engines for storage and resolver
|
|
50
|
+
|
|
51
|
+
## 1.0.3
|
|
8
52
|
|
|
9
53
|
### Patch Changes
|
|
10
54
|
|
|
@@ -56,7 +56,8 @@ describe('GlobalStorage', () => {
|
|
|
56
56
|
const returnedValue = await globalStorage.get('testKey');
|
|
57
57
|
verifyApiClientCalledWith(apiClientMock, {
|
|
58
58
|
contextAri,
|
|
59
|
-
key: 'testKey'
|
|
59
|
+
key: 'testKey',
|
|
60
|
+
encrypted: false
|
|
60
61
|
});
|
|
61
62
|
expect(returnedValue).toEqual('testValue');
|
|
62
63
|
});
|
|
@@ -72,7 +73,8 @@ describe('GlobalStorage', () => {
|
|
|
72
73
|
const returnedValue = await globalStorage.get('testKey');
|
|
73
74
|
verifyApiClientCalledWith(apiClientMock, {
|
|
74
75
|
contextAri,
|
|
75
|
-
key: 'testKey'
|
|
76
|
+
key: 'testKey',
|
|
77
|
+
encrypted: false
|
|
76
78
|
});
|
|
77
79
|
expect(returnedValue).toEqual(undefined);
|
|
78
80
|
});
|
|
@@ -88,7 +90,8 @@ describe('GlobalStorage', () => {
|
|
|
88
90
|
const returnedValue = await globalStorage.get('testKey');
|
|
89
91
|
verifyApiClientCalledWith(apiClientMock, {
|
|
90
92
|
contextAri,
|
|
91
|
-
key: 'testKey'
|
|
93
|
+
key: 'testKey',
|
|
94
|
+
encrypted: false
|
|
92
95
|
});
|
|
93
96
|
expect(returnedValue).toEqual(0);
|
|
94
97
|
});
|
|
@@ -104,7 +107,8 @@ describe('GlobalStorage', () => {
|
|
|
104
107
|
const returnedValue = await globalStorage.get('testKey');
|
|
105
108
|
verifyApiClientCalledWith(apiClientMock, {
|
|
106
109
|
contextAri,
|
|
107
|
-
key: 'testKey'
|
|
110
|
+
key: 'testKey',
|
|
111
|
+
encrypted: false
|
|
108
112
|
});
|
|
109
113
|
expect(returnedValue).toEqual('');
|
|
110
114
|
});
|
|
@@ -139,6 +143,25 @@ describe('GlobalStorage', () => {
|
|
|
139
143
|
await expect(response).rejects.toThrow(errors_1.APIError.forUnexpected('Response text was not a valid JSON: test'));
|
|
140
144
|
});
|
|
141
145
|
});
|
|
146
|
+
describe('get secret', () => {
|
|
147
|
+
it('should call the storage API, passing the provided key and returning the stored value', async () => {
|
|
148
|
+
const apiClientMock = getApiClientMock({
|
|
149
|
+
data: {
|
|
150
|
+
appStoredEntity: {
|
|
151
|
+
value: 'testValue'
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const globalStorage = getStorage(apiClientMock);
|
|
156
|
+
const returnedValue = await globalStorage.getSecret('testKey');
|
|
157
|
+
verifyApiClientCalledWith(apiClientMock, {
|
|
158
|
+
contextAri,
|
|
159
|
+
key: 'testKey',
|
|
160
|
+
encrypted: true
|
|
161
|
+
});
|
|
162
|
+
expect(returnedValue).toEqual('testValue');
|
|
163
|
+
});
|
|
164
|
+
});
|
|
142
165
|
describe('set', () => {
|
|
143
166
|
it('should call the storage API, passing the provided key and value', async () => {
|
|
144
167
|
const apiClientMock = getApiClientMock({
|
|
@@ -156,7 +179,8 @@ describe('GlobalStorage', () => {
|
|
|
156
179
|
input: {
|
|
157
180
|
contextAri,
|
|
158
181
|
key: 'testKey',
|
|
159
|
-
value: 'testValue'
|
|
182
|
+
value: 'testValue',
|
|
183
|
+
encrypted: false
|
|
160
184
|
}
|
|
161
185
|
});
|
|
162
186
|
});
|
|
@@ -199,7 +223,31 @@ describe('GlobalStorage', () => {
|
|
|
199
223
|
input: {
|
|
200
224
|
contextAri,
|
|
201
225
|
key: 'testKey',
|
|
202
|
-
value: 'testValue'
|
|
226
|
+
value: 'testValue',
|
|
227
|
+
encrypted: false
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
describe('set secret', () => {
|
|
233
|
+
it('should call the storage API, passing the provided key and value', async () => {
|
|
234
|
+
const apiClientMock = getApiClientMock({
|
|
235
|
+
data: {
|
|
236
|
+
appStorage: {
|
|
237
|
+
setAppStoredEntity: {
|
|
238
|
+
success: true
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
const globalStorage = getStorage(apiClientMock);
|
|
244
|
+
await globalStorage.setSecret('testKey', 'testValue');
|
|
245
|
+
verifyApiClientCalledWith(apiClientMock, {
|
|
246
|
+
input: {
|
|
247
|
+
contextAri,
|
|
248
|
+
key: 'testKey',
|
|
249
|
+
value: 'testValue',
|
|
250
|
+
encrypted: true
|
|
203
251
|
}
|
|
204
252
|
});
|
|
205
253
|
});
|
|
@@ -220,7 +268,8 @@ describe('GlobalStorage', () => {
|
|
|
220
268
|
verifyApiClientCalledWith(apiClientMock, {
|
|
221
269
|
input: {
|
|
222
270
|
contextAri,
|
|
223
|
-
key: 'testKey'
|
|
271
|
+
key: 'testKey',
|
|
272
|
+
encrypted: false
|
|
224
273
|
}
|
|
225
274
|
});
|
|
226
275
|
});
|
|
@@ -248,6 +297,28 @@ describe('GlobalStorage', () => {
|
|
|
248
297
|
await expect(response).rejects.toThrow(errors_1.APIError.forStatus(400));
|
|
249
298
|
});
|
|
250
299
|
});
|
|
300
|
+
describe('delete secret', () => {
|
|
301
|
+
it('should call the storage API, passing the provided key', async () => {
|
|
302
|
+
const apiClientMock = getApiClientMock({
|
|
303
|
+
data: {
|
|
304
|
+
appStorage: {
|
|
305
|
+
deleteAppStoredEntity: {
|
|
306
|
+
success: true
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
const globalStorage = getStorage(apiClientMock);
|
|
312
|
+
await globalStorage.deleteSecret('testKey');
|
|
313
|
+
verifyApiClientCalledWith(apiClientMock, {
|
|
314
|
+
input: {
|
|
315
|
+
contextAri,
|
|
316
|
+
key: 'testKey',
|
|
317
|
+
encrypted: true
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
});
|
|
251
322
|
describe('list', () => {
|
|
252
323
|
it('should call the storage API with the provided parameters', async () => {
|
|
253
324
|
const apiClientMock = getApiClientMock({
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const query_api_1 = require("../query-api");
|
|
4
4
|
const conditions_1 = require("../conditions");
|
|
5
|
+
const conditions_2 = require("../eap/conditions");
|
|
5
6
|
describe('DefaultQueryBuilder', () => {
|
|
6
7
|
function newGlobalStorage() {
|
|
7
8
|
return {
|
|
@@ -48,6 +49,45 @@ describe('DefaultQueryBuilder', () => {
|
|
|
48
49
|
cursor: 'cursor'
|
|
49
50
|
}));
|
|
50
51
|
});
|
|
52
|
+
it('should allow specifying a "starts with" condition', async () => {
|
|
53
|
+
const globalStorage = newGlobalStorage();
|
|
54
|
+
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_1.startsWith('test')).getMany();
|
|
55
|
+
expect(globalStorage.list).toHaveBeenCalledWith(expect.objectContaining({
|
|
56
|
+
where: [
|
|
57
|
+
{
|
|
58
|
+
field: 'key',
|
|
59
|
+
condition: 'STARTS_WITH',
|
|
60
|
+
value: 'test'
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
65
|
+
it('should allow specifying a "not equal to" condition', async () => {
|
|
66
|
+
const globalStorage = newGlobalStorage();
|
|
67
|
+
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_2.notEqualTo(['test', 'test2'])).getMany();
|
|
68
|
+
expect(globalStorage.list).toHaveBeenCalledWith(expect.objectContaining({
|
|
69
|
+
where: [
|
|
70
|
+
{
|
|
71
|
+
field: 'key',
|
|
72
|
+
condition: 'NOT_EQUAL_TO',
|
|
73
|
+
value: ['test', 'test2']
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}));
|
|
77
|
+
});
|
|
78
|
+
it('should allow specifying an "is in" condition', async () => {
|
|
79
|
+
const globalStorage = newGlobalStorage();
|
|
80
|
+
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_2.isIn(['test', 'test2'])).getMany();
|
|
81
|
+
expect(globalStorage.list).toHaveBeenCalledWith(expect.objectContaining({
|
|
82
|
+
where: [
|
|
83
|
+
{
|
|
84
|
+
field: 'key',
|
|
85
|
+
condition: 'IN',
|
|
86
|
+
value: ['test', 'test2']
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}));
|
|
90
|
+
});
|
|
51
91
|
it('should allow specifying a condition', async () => {
|
|
52
92
|
const globalStorage = newGlobalStorage();
|
|
53
93
|
await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_1.startsWith('test')).getMany();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../src/eap/conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,CAKrD;AAED,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAKhD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isIn = exports.notEqualTo = void 0;
|
|
4
|
+
function notEqualTo(value) {
|
|
5
|
+
return {
|
|
6
|
+
condition: 'NOT_EQUAL_TO',
|
|
7
|
+
value
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
exports.notEqualTo = notEqualTo;
|
|
11
|
+
function isIn(values) {
|
|
12
|
+
return {
|
|
13
|
+
condition: 'IN',
|
|
14
|
+
value: values
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.isIn = isIn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eap/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/out/eap/index.js
ADDED
package/out/global-storage.d.ts
CHANGED
|
@@ -15,9 +15,13 @@ export declare class GlobalStorage implements StorageAdapter {
|
|
|
15
15
|
constructor(getAppContextAri: (() => string) | string, apiClient: FetchMethod);
|
|
16
16
|
private doGetAppContextAri;
|
|
17
17
|
get(key: string): Promise<any>;
|
|
18
|
+
getSecret(key: string): Promise<any>;
|
|
18
19
|
list(options: ListOptions): Promise<ListResults>;
|
|
19
20
|
set(key: string, value: any): Promise<void>;
|
|
21
|
+
setSecret(key: string, value: any): Promise<void>;
|
|
20
22
|
delete(key: string): Promise<void>;
|
|
23
|
+
deleteSecret(key: string): Promise<void>;
|
|
24
|
+
private getInternal;
|
|
21
25
|
private buildRequest;
|
|
22
26
|
private query;
|
|
23
27
|
private mutation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-storage.d.ts","sourceRoot":"","sources":["../src/global-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,SAAS,CAAC;AAGnD,OAAO,EAA8C,WAAW,EAAuB,MAAM,WAAW,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,MAA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C,GAAG,CAAC;IAIpC,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAqBhD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3C,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAKhC,WAAW;IAUzB,OAAO,CAAC,YAAY;YAUN,KAAK;YAML,QAAQ;CAiBvB"}
|
package/out/global-storage.js
CHANGED
|
@@ -34,9 +34,10 @@ class GlobalStorage {
|
|
|
34
34
|
return typeof this.getAppContextAri === 'function' ? this.getAppContextAri() : this.getAppContextAri;
|
|
35
35
|
}
|
|
36
36
|
async get(key) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
return this.getInternal(key, false);
|
|
38
|
+
}
|
|
39
|
+
async getSecret(key) {
|
|
40
|
+
return this.getInternal(key, true);
|
|
40
41
|
}
|
|
41
42
|
async list(options) {
|
|
42
43
|
const requestBody = process.env.IS_CLEANUP_FUNCTION === 'true'
|
|
@@ -54,13 +55,26 @@ class GlobalStorage {
|
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
async set(key, value) {
|
|
57
|
-
const requestBody = queries_1.setQuery(this.doGetAppContextAri(), key, value);
|
|
58
|
+
const requestBody = queries_1.setQuery(this.doGetAppContextAri(), key, value, false);
|
|
59
|
+
await this.mutation(requestBody, 'setAppStoredEntity');
|
|
60
|
+
}
|
|
61
|
+
async setSecret(key, value) {
|
|
62
|
+
const requestBody = queries_1.setQuery(this.doGetAppContextAri(), key, value, true);
|
|
58
63
|
await this.mutation(requestBody, 'setAppStoredEntity');
|
|
59
64
|
}
|
|
60
65
|
async delete(key) {
|
|
61
|
-
const requestBody = queries_1.deleteQuery(this.doGetAppContextAri(), key);
|
|
66
|
+
const requestBody = queries_1.deleteQuery(this.doGetAppContextAri(), key, false);
|
|
62
67
|
await this.mutation(requestBody, 'deleteAppStoredEntity');
|
|
63
68
|
}
|
|
69
|
+
async deleteSecret(key) {
|
|
70
|
+
const requestBody = queries_1.deleteQuery(this.doGetAppContextAri(), key, true);
|
|
71
|
+
await this.mutation(requestBody, 'deleteAppStoredEntity');
|
|
72
|
+
}
|
|
73
|
+
async getInternal(key, encrypted) {
|
|
74
|
+
const requestBody = queries_1.getQuery(this.doGetAppContextAri(), key, encrypted);
|
|
75
|
+
const { appStoredEntity: { value } } = await this.query(requestBody);
|
|
76
|
+
return value !== null && value !== void 0 ? value : undefined;
|
|
77
|
+
}
|
|
64
78
|
buildRequest(requestBody) {
|
|
65
79
|
return {
|
|
66
80
|
method: 'POST',
|
package/out/index.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export declare const getStorageInstanceWithQuery: (adapter: GlobalStorage) => {
|
|
|
7
7
|
get: (key: string) => Promise<any>;
|
|
8
8
|
set: (key: string, value: any) => Promise<void>;
|
|
9
9
|
delete: (key: string) => Promise<void>;
|
|
10
|
+
getSecret: (key: string) => Promise<any>;
|
|
11
|
+
setSecret: (key: string, value: any) => Promise<void>;
|
|
12
|
+
deleteSecret: (key: string) => Promise<void>;
|
|
10
13
|
query: () => DefaultQueryBuilder;
|
|
11
14
|
};
|
|
12
15
|
export { GlobalStorage } from './global-storage';
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,oBAAY,WAAW,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,GAAG,IAAI,GAAG,QAAQ,GAAG,YAAY,CAAC,CAAC;AAC3G,oBAAY,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AAEnF,eAAO,MAAM,2BAA2B,YAAa,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,oBAAY,WAAW,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,GAAG,IAAI,GAAG,QAAQ,GAAG,YAAY,CAAC,CAAC;AAC3G,oBAAY,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AAEnF,eAAO,MAAM,2BAA2B,YAAa,aAAa;;;;;;;;CAUjE,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE5G,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC"}
|
package/out/index.js
CHANGED
|
@@ -7,6 +7,9 @@ exports.getStorageInstanceWithQuery = (adapter) => {
|
|
|
7
7
|
get: adapter.get.bind(adapter),
|
|
8
8
|
set: adapter.set.bind(adapter),
|
|
9
9
|
delete: adapter.delete.bind(adapter),
|
|
10
|
+
getSecret: adapter.getSecret.bind(adapter),
|
|
11
|
+
setSecret: adapter.setSecret.bind(adapter),
|
|
12
|
+
deleteSecret: adapter.deleteSecret.bind(adapter),
|
|
10
13
|
query: () => new query_api_1.DefaultQueryBuilder(adapter)
|
|
11
14
|
};
|
|
12
15
|
};
|
package/out/queries.d.ts
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
export declare const getQuery: (contextAri: string, key: string) => {
|
|
1
|
+
export declare const getQuery: (contextAri: string, key: string, encrypted: boolean) => {
|
|
2
2
|
query: string;
|
|
3
3
|
variables: {
|
|
4
4
|
contextAri: string;
|
|
5
5
|
key: string;
|
|
6
|
+
encrypted: boolean;
|
|
6
7
|
};
|
|
7
8
|
};
|
|
8
|
-
export interface
|
|
9
|
+
export interface StartsWithClause {
|
|
9
10
|
field: string;
|
|
10
11
|
condition: 'STARTS_WITH';
|
|
11
12
|
value: string;
|
|
12
13
|
}
|
|
14
|
+
export interface NotEqualToClause {
|
|
15
|
+
field: string;
|
|
16
|
+
condition: 'NOT_EQUAL_TO';
|
|
17
|
+
value: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface InClause {
|
|
20
|
+
field: string;
|
|
21
|
+
condition: 'IN';
|
|
22
|
+
value: string[];
|
|
23
|
+
}
|
|
24
|
+
export declare type WhereClause = StartsWithClause | NotEqualToClause | InClause;
|
|
13
25
|
export interface ListOptions {
|
|
14
26
|
where?: Array<WhereClause>;
|
|
15
27
|
cursor?: string;
|
|
@@ -33,22 +45,24 @@ export declare const listQueryForCleanup: (contextAri: string, options: ListOpti
|
|
|
33
45
|
limit: number | null;
|
|
34
46
|
};
|
|
35
47
|
};
|
|
36
|
-
export declare const setQuery: (contextAri: string, key: string, value: any) => {
|
|
48
|
+
export declare const setQuery: (contextAri: string, key: string, value: any, encrypted: boolean) => {
|
|
37
49
|
query: string;
|
|
38
50
|
variables: {
|
|
39
51
|
input: {
|
|
40
52
|
contextAri: string;
|
|
41
53
|
key: string;
|
|
42
54
|
value: any;
|
|
55
|
+
encrypted: boolean;
|
|
43
56
|
};
|
|
44
57
|
};
|
|
45
58
|
};
|
|
46
|
-
export declare const deleteQuery: (contextAri: string, key: string) => {
|
|
59
|
+
export declare const deleteQuery: (contextAri: string, key: string, encrypted: boolean) => {
|
|
47
60
|
query: string;
|
|
48
61
|
variables: {
|
|
49
62
|
input: {
|
|
50
63
|
contextAri: string;
|
|
51
64
|
key: string;
|
|
65
|
+
encrypted: boolean;
|
|
52
66
|
};
|
|
53
67
|
};
|
|
54
68
|
};
|
package/out/queries.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,eAAgB,MAAM,OAAO,MAAM
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,eAAgB,MAAM,OAAO,MAAM,aAAa,OAAO;;;;;;;CAc1E,CAAC;AAEH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,aAAa,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,cAAc,CAAC;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,oBAAY,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,QAAQ,CAAC;AAEzE,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,SAAS,eAAgB,MAAM,WAAW,WAAW;;;;;;;;CAuBhE,CAAC;AAEH,eAAO,MAAM,mBAAmB,eAAgB,MAAM,WAAW,WAAW;;;;;;;;CAuB1E,CAAC;AAEH,eAAO,MAAM,QAAQ,eAAgB,MAAM,OAAO,MAAM,SAAS,GAAG,aAAa,OAAO;;;;;;;;;;CAyBtF,CAAC;AAEH,eAAO,MAAM,WAAW,eAAgB,MAAM,OAAO,MAAM,aAAa,OAAO;;;;;;;;;CAwB7E,CAAC"}
|
package/out/queries.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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
|
-
exports.getQuery = (contextAri, key) => ({
|
|
4
|
+
exports.getQuery = (contextAri, key, encrypted) => ({
|
|
5
5
|
query: `
|
|
6
|
-
query
|
|
7
|
-
appStoredEntity(contextAri: $contextAri, key: $key) {
|
|
6
|
+
query forge_app_getApplicationStorageEntity($contextAri: ID!, $key: ID!, $encrypted: Boolean!) {
|
|
7
|
+
appStoredEntity(contextAri: $contextAri, key: $key, encrypted: $encrypted) {
|
|
8
8
|
key
|
|
9
9
|
value
|
|
10
10
|
}
|
|
@@ -12,14 +12,15 @@ exports.getQuery = (contextAri, key) => ({
|
|
|
12
12
|
`,
|
|
13
13
|
variables: {
|
|
14
14
|
contextAri,
|
|
15
|
-
key
|
|
15
|
+
key,
|
|
16
|
+
encrypted
|
|
16
17
|
}
|
|
17
18
|
});
|
|
18
19
|
exports.listQuery = (contextAri, options) => {
|
|
19
20
|
var _a, _b, _c;
|
|
20
21
|
return ({
|
|
21
22
|
query: `
|
|
22
|
-
query
|
|
23
|
+
query forge_app_getApplicationStorageEntities($contextAri: ID!, $where: [AppStoredEntityFilter!], $cursor: String, $limit: Int) {
|
|
23
24
|
appStoredEntities(contextAri: $contextAri, where: $where, after: $cursor, first: $limit) {
|
|
24
25
|
edges {
|
|
25
26
|
node {
|
|
@@ -44,7 +45,7 @@ exports.listQueryForCleanup = (contextAri, options) => {
|
|
|
44
45
|
var _a, _b, _c;
|
|
45
46
|
return ({
|
|
46
47
|
query: `
|
|
47
|
-
query
|
|
48
|
+
query forge_app_getApplicationStorageEntitiesForCleanup($contextAri: ID!, $where: [AppStoredEntityFilter!], $cursor: String, $limit: Int) {
|
|
48
49
|
appStoredEntitiesForCleanup(contextAri: $contextAri, where: $where, after: $cursor, first: $limit) {
|
|
49
50
|
edges {
|
|
50
51
|
node {
|
|
@@ -65,9 +66,9 @@ exports.listQueryForCleanup = (contextAri, options) => {
|
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
};
|
|
68
|
-
exports.setQuery = (contextAri, key, value) => ({
|
|
69
|
+
exports.setQuery = (contextAri, key, value, encrypted) => ({
|
|
69
70
|
query: `
|
|
70
|
-
mutation
|
|
71
|
+
mutation forge_app_setApplicationStorageEntity($input: SetAppStoredEntityMutationInput!) {
|
|
71
72
|
appStorage{
|
|
72
73
|
setAppStoredEntity(input: $input) {
|
|
73
74
|
success
|
|
@@ -86,13 +87,14 @@ exports.setQuery = (contextAri, key, value) => ({
|
|
|
86
87
|
input: {
|
|
87
88
|
contextAri,
|
|
88
89
|
key,
|
|
89
|
-
value
|
|
90
|
+
value,
|
|
91
|
+
encrypted
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
});
|
|
93
|
-
exports.deleteQuery = (contextAri, key) => ({
|
|
95
|
+
exports.deleteQuery = (contextAri, key, encrypted) => ({
|
|
94
96
|
query: `
|
|
95
|
-
mutation
|
|
97
|
+
mutation forge_app_deleteApplicationStorageEntity($input: DeleteAppStoredEntityMutationInput!) {
|
|
96
98
|
appStorage {
|
|
97
99
|
deleteAppStoredEntity(input: $input) {
|
|
98
100
|
success
|
|
@@ -110,7 +112,8 @@ exports.deleteQuery = (contextAri, key) => ({
|
|
|
110
112
|
variables: {
|
|
111
113
|
input: {
|
|
112
114
|
contextAri,
|
|
113
|
-
key
|
|
115
|
+
key,
|
|
116
|
+
encrypted
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
119
|
});
|
package/out/query-api.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare class DefaultQueryBuilder implements QueryBuilder {
|
|
|
5
5
|
private globalStorage;
|
|
6
6
|
private queryOptions;
|
|
7
7
|
constructor(globalStorage: Pick<GlobalStorage, 'list'>, queryOptions?: ListOptions);
|
|
8
|
-
where(field: 'key',
|
|
8
|
+
where(field: 'key', where: Condition): QueryBuilder;
|
|
9
9
|
cursor(cursor: string): QueryBuilder;
|
|
10
10
|
limit(limit: number): QueryBuilder;
|
|
11
11
|
getOne(): Promise<Result | undefined>;
|
package/out/query-api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-api.d.ts","sourceRoot":"","sources":["../src/query-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEhF,qBAAa,mBAAoB,YAAW,YAAY;IAC1C,OAAO,CAAC,aAAa;IAA+B,OAAO,CAAC,YAAY;gBAAhE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,EAAU,YAAY,GAAE,WAAgB;IAEtG,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"query-api.d.ts","sourceRoot":"","sources":["../src/query-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEhF,qBAAa,mBAAoB,YAAW,YAAY;IAC1C,OAAO,CAAC,aAAa;IAA+B,OAAO,CAAC,YAAY;gBAAhE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,EAAU,YAAY,GAAE,WAAgB;IAEtG,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,GAAG,YAAY;IAYnD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAOpC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAO5B,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAQrC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;CAGrC"}
|
package/out/query-api.js
CHANGED
|
@@ -6,13 +6,9 @@ class DefaultQueryBuilder {
|
|
|
6
6
|
this.globalStorage = globalStorage;
|
|
7
7
|
this.queryOptions = queryOptions;
|
|
8
8
|
}
|
|
9
|
-
where(field,
|
|
9
|
+
where(field, where) {
|
|
10
10
|
return new DefaultQueryBuilder(this.globalStorage, Object.assign(Object.assign({}, this.queryOptions), { where: [
|
|
11
|
-
{
|
|
12
|
-
field,
|
|
13
|
-
condition,
|
|
14
|
-
value
|
|
15
|
-
}
|
|
11
|
+
Object.assign({ field }, where)
|
|
16
12
|
] }));
|
|
17
13
|
}
|
|
18
14
|
cursor(cursor) {
|
package/out/storage-adapter.d.ts
CHANGED
|
@@ -2,15 +2,27 @@ export interface StorageAdapter {
|
|
|
2
2
|
get(key: string): Promise<any>;
|
|
3
3
|
set(key: string, value: any): Promise<void>;
|
|
4
4
|
delete(key: string): Promise<void>;
|
|
5
|
+
getSecret(key: string): Promise<any>;
|
|
6
|
+
setSecret(key: string, value: any): Promise<void>;
|
|
7
|
+
deleteSecret(key: string): Promise<void>;
|
|
5
8
|
}
|
|
6
9
|
export interface QueryApi {
|
|
7
10
|
query(): QueryBuilder;
|
|
8
11
|
}
|
|
9
12
|
export declare type Value = string;
|
|
10
|
-
export interface
|
|
13
|
+
export interface StartsWith {
|
|
11
14
|
condition: 'STARTS_WITH';
|
|
12
15
|
value: Value;
|
|
13
16
|
}
|
|
17
|
+
export interface NotEqualTo {
|
|
18
|
+
condition: 'NOT_EQUAL_TO';
|
|
19
|
+
value: Value[];
|
|
20
|
+
}
|
|
21
|
+
export interface In {
|
|
22
|
+
condition: 'IN';
|
|
23
|
+
value: Value[];
|
|
24
|
+
}
|
|
25
|
+
export declare type Predicate = StartsWith | NotEqualTo | In;
|
|
14
26
|
export declare type Condition = Predicate;
|
|
15
27
|
export interface QueryBuilder {
|
|
16
28
|
where(field: 'key', condition: Condition): QueryBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-adapter.d.ts","sourceRoot":"","sources":["../src/storage-adapter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"storage-adapter.d.ts","sourceRoot":"","sources":["../src/storage-adapter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,EAAE,MAA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AC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/storage",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-490cfcf",
|
|
4
4
|
"description": "Forge Storage methods",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^12.12.63",
|
|
19
|
-
"node-fetch": "^2.
|
|
20
|
-
"
|
|
19
|
+
"@types/node-fetch": "^2.5.7",
|
|
20
|
+
"node-fetch": "2.6.1"
|
|
21
21
|
}
|
|
22
22
|
}
|