@forge/storage 2.0.2-next.0-experimental-255e232 → 2.0.3-experimental-04cc2b9
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/LICENSE.txt +1 -1
- package/package.json +11 -2
- package/README.md +0 -50
- package/out/__test__/errors.test.d.ts +0 -2
- package/out/__test__/errors.test.d.ts.map +0 -1
- package/out/__test__/errors.test.js +0 -34
- package/out/__test__/global-storage.test.d.ts +0 -2
- package/out/__test__/global-storage.test.d.ts.map +0 -1
- package/out/__test__/global-storage.test.js +0 -833
- package/out/__test__/list-api.test.d.ts +0 -2
- package/out/__test__/list-api.test.d.ts.map +0 -1
- package/out/__test__/list-api.test.js +0 -650
- package/out/conditions.d.ts +0 -3
- package/out/conditions.d.ts.map +0 -1
- package/out/conditions.js +0 -10
- package/out/eap/conditions.d.ts +0 -40
- package/out/eap/conditions.d.ts.map +0 -1
- package/out/eap/conditions.js +0 -112
- package/out/eap/index.d.ts +0 -2
- package/out/eap/index.d.ts.map +0 -1
- package/out/eap/index.js +0 -4
- package/out/entity-storage/index.d.ts +0 -2
- package/out/entity-storage/index.d.ts.map +0 -1
- package/out/entity-storage/index.js +0 -5
- package/out/entity-storage/query-api.d.ts +0 -48
- package/out/entity-storage/query-api.d.ts.map +0 -1
- package/out/entity-storage/query-api.js +0 -154
- package/out/entity-storage/storage-builder.d.ts +0 -20
- package/out/entity-storage/storage-builder.d.ts.map +0 -1
- package/out/entity-storage/storage-builder.js +0 -25
- package/out/errors.d.ts +0 -9
- package/out/errors.d.ts.map +0 -1
- package/out/errors.js +0 -41
- package/out/global-storage.d.ts +0 -50
- package/out/global-storage.d.ts.map +0 -1
- package/out/global-storage.js +0 -156
- package/out/gql-queries.d.ts +0 -81
- package/out/gql-queries.d.ts.map +0 -1
- package/out/gql-queries.js +0 -200
- package/out/index.d.ts +0 -49
- package/out/index.d.ts.map +0 -1
- package/out/index.js +0 -33
- package/out/query-api.d.ts +0 -14
- package/out/query-api.d.ts.map +0 -1
- package/out/query-api.js +0 -44
- package/out/query-interfaces.d.ts +0 -113
- package/out/query-interfaces.d.ts.map +0 -1
- package/out/query-interfaces.js +0 -8
- package/out/storage-adapter.d.ts +0 -42
- package/out/storage-adapter.d.ts.map +0 -1
- package/out/storage-adapter.js +0 -2
package/LICENSE.txt
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/storage",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3-experimental-04cc2b9",
|
|
4
4
|
"description": "Forge Storage methods",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -16,9 +16,18 @@
|
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@atlassian/metrics-interface": "4.0.0",
|
|
19
|
-
"@types/node": "20.19.1"
|
|
19
|
+
"@types/node": "20.19.1",
|
|
20
|
+
"typescript": "5.9.2"
|
|
20
21
|
},
|
|
21
22
|
"publishConfig": {
|
|
22
23
|
"registry": "https://packages.atlassian.com/api/npm/npm-public/"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"typescript": ">=5.0.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependenciesMeta": {
|
|
29
|
+
"typescript": {
|
|
30
|
+
"optional": true
|
|
31
|
+
}
|
|
23
32
|
}
|
|
24
33
|
}
|
package/README.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
Common library for both Forge environment and Harmonised Connect app environment.
|
|
2
|
-
|
|
3
|
-
Usage example:
|
|
4
|
-
|
|
5
|
-
```javascript
|
|
6
|
-
import fetch, { RequestInit } from 'node-fetch';
|
|
7
|
-
|
|
8
|
-
import { GlobalStorage } from './global-storage';
|
|
9
|
-
import { APIResponse, getStorageInstanceWithQuery } from './index';
|
|
10
|
-
import { getMetrics } from './runtime/fetch-and-storage';
|
|
11
|
-
|
|
12
|
-
const API_BASE = 'https://api.atlassian.com';
|
|
13
|
-
|
|
14
|
-
// For user agent header
|
|
15
|
-
const version = '0.0.1';
|
|
16
|
-
const appAri = 'ari:cloud:ecosystem::app/...';
|
|
17
|
-
|
|
18
|
-
// For Storage service auth
|
|
19
|
-
const appContextAri = 'ari:cloud:jira::site/...';
|
|
20
|
-
const token = '...';
|
|
21
|
-
|
|
22
|
-
async function apiClient(path: string, init: RequestInit): Promise<APIResponse> {
|
|
23
|
-
const url = API_BASE + path;
|
|
24
|
-
|
|
25
|
-
const extraHeaders = {
|
|
26
|
-
// See add-forge-user-agent.ts
|
|
27
|
-
'User-Agent': `H11n/${version} ${appAri}`,
|
|
28
|
-
|
|
29
|
-
Authorization: `Bearer ${token}`
|
|
30
|
-
|
|
31
|
-
// Only required when accessing Storage service via the GraphQL gateway
|
|
32
|
-
// https://api.atlassian.com/graphql
|
|
33
|
-
// 'X-ExperimentalApi': 'AppEntityStorage'
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
init.headers = Object.assign(init.headers!, extraHeaders);
|
|
37
|
-
return fetch(url, init);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const adapter = new GlobalStorage(() => appContextAri, apiClient, getMetrics);
|
|
41
|
-
const storage = getStorageInstanceWithQuery(adapter);
|
|
42
|
-
|
|
43
|
-
async function demo() {
|
|
44
|
-
await storage.set('key', 'value');
|
|
45
|
-
console.log(await storage.get('key'));
|
|
46
|
-
await storage.delete('key');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
demo();
|
|
50
|
-
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.test.d.ts","sourceRoot":"","sources":["../../src/__test__/errors.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const errors_1 = require("../errors");
|
|
4
|
-
describe('APIError', () => {
|
|
5
|
-
describe('forStatus', () => {
|
|
6
|
-
it.each([
|
|
7
|
-
[400, 'Bad request'],
|
|
8
|
-
[413, 'Bad request'],
|
|
9
|
-
[401, 'Authentication error'],
|
|
10
|
-
[403, 'Permissions error or key does not exist'],
|
|
11
|
-
[404, 'Permissions error or key does not exist'],
|
|
12
|
-
[409, 'Conflicting update occurred'],
|
|
13
|
-
[500, 'Internal server error']
|
|
14
|
-
])('should contain the correct error message for a code of %s', (status, message) => {
|
|
15
|
-
expect(errors_1.APIError.forStatus(status).message).toEqual(message);
|
|
16
|
-
});
|
|
17
|
-
it('should return a generic error message for unexpected status codes', () => {
|
|
18
|
-
expect(errors_1.APIError.forStatus(100).message).toEqual("Unknown error. Received status code '100'");
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
describe('forErrorCode', () => {
|
|
22
|
-
it('should return contain the provided message if the error code is in the allow list', () => {
|
|
23
|
-
expect(errors_1.APIError.forErrorCode('INVALID_CURSOR', 'this is an error message').message).toEqual('this is an error message');
|
|
24
|
-
});
|
|
25
|
-
it('should return the error code if no message was provided', () => {
|
|
26
|
-
expect(errors_1.APIError.forErrorCode('INVALID_CURSOR', null).message).toEqual('INVALID_CURSOR');
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
describe('forUnexpected', () => {
|
|
30
|
-
it('should return an APIError with a message provided', () => {
|
|
31
|
-
expect(errors_1.APIError.forUnexpected('test').message).toEqual('test');
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-storage.test.d.ts","sourceRoot":"","sources":["../../src/__test__/global-storage.test.ts"],"names":[],"mappings":""}
|