@forge/api 6.1.0-next.2 → 6.1.1-next.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/CHANGELOG.md +18 -0
- package/out/api/endpoint.d.ts +8 -0
- package/out/api/endpoint.d.ts.map +1 -0
- package/out/api/endpoint.js +54 -0
- package/out/index.d.ts +1 -2
- package/out/index.d.ts.map +1 -1
- package/out/index.js +5 -6
- package/package.json +3 -3
- package/out/api/remote.d.ts +0 -7
- package/out/api/remote.d.ts.map +0 -1
- package/out/api/remote.js +0 -28
- package/out/api/service.d.ts +0 -7
- package/out/api/service.d.ts.map +0 -1
- package/out/api/service.js +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @forge/api
|
|
2
2
|
|
|
3
|
+
## 6.1.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ad46892: Refactor invokeService and invokeRemote API functions into one
|
|
8
|
+
|
|
9
|
+
## 6.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 518c490: Add invokeService to @forge/api
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 6392355: Add realtime to ForgeRuntime type
|
|
18
|
+
- Updated dependencies [8a3d993]
|
|
19
|
+
- @forge/egress@2.0.3
|
|
20
|
+
|
|
3
21
|
## 6.1.0-next.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { APIResponse, RequestInit } from '../index';
|
|
2
|
+
declare type InvokeEndpointOptions = {
|
|
3
|
+
path: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function invokeRemote(remoteKey: string, options: RequestInit & InvokeEndpointOptions): Promise<APIResponse>;
|
|
6
|
+
export declare function invokeService(serviceKey: string, options: RequestInit & InvokeEndpointOptions): Promise<APIResponse>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../src/api/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AASpD,aAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,GAAG,qBAAqB,GAC3C,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,GAAG,qBAAqB,GAC3C,OAAO,CAAC,WAAW,CAAC,CAEtB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.invokeService = exports.invokeRemote = void 0;
|
|
4
|
+
const errors_1 = require("./errors");
|
|
5
|
+
const fetch_1 = require("./fetch");
|
|
6
|
+
var InvokeType;
|
|
7
|
+
(function (InvokeType) {
|
|
8
|
+
InvokeType["REMOTE"] = "Remote";
|
|
9
|
+
InvokeType["CONTAINER"] = "Service";
|
|
10
|
+
})(InvokeType || (InvokeType = {}));
|
|
11
|
+
async function invokeRemote(remoteKey, options) {
|
|
12
|
+
return invokeEndpoint(remoteKey, options, InvokeType.REMOTE);
|
|
13
|
+
}
|
|
14
|
+
exports.invokeRemote = invokeRemote;
|
|
15
|
+
async function invokeService(serviceKey, options) {
|
|
16
|
+
return invokeEndpoint(serviceKey, options, InvokeType.CONTAINER);
|
|
17
|
+
}
|
|
18
|
+
exports.invokeService = invokeService;
|
|
19
|
+
async function invokeEndpoint(key, options, type) {
|
|
20
|
+
const { path, ...fetchOptions } = options;
|
|
21
|
+
if (!key) {
|
|
22
|
+
throw new Error(`Missing ${type.toLowerCase()} key provided to invoke${type}`);
|
|
23
|
+
}
|
|
24
|
+
if (!path) {
|
|
25
|
+
throw new Error(`Missing or empty path provided to invoke${type}`);
|
|
26
|
+
}
|
|
27
|
+
const response = await global.__forge_fetch__(constructInvokePayload(key, type), path, fetchOptions);
|
|
28
|
+
handleResponseErrors(response, key);
|
|
29
|
+
return response;
|
|
30
|
+
}
|
|
31
|
+
function constructInvokePayload(key, type) {
|
|
32
|
+
switch (type) {
|
|
33
|
+
case InvokeType.REMOTE:
|
|
34
|
+
return {
|
|
35
|
+
type: 'frc',
|
|
36
|
+
remote: key
|
|
37
|
+
};
|
|
38
|
+
case InvokeType.CONTAINER:
|
|
39
|
+
return {
|
|
40
|
+
type: 'fcc',
|
|
41
|
+
service: key
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function handleResponseErrors(response, key) {
|
|
46
|
+
const forgeProxyError = (0, fetch_1.getForgeProxyError)(response);
|
|
47
|
+
if (forgeProxyError === 'INVALID_SERVICE_KEY') {
|
|
48
|
+
throw new errors_1.InvalidContainerServiceError(`Invalid service key provided: "${key}"`, key);
|
|
49
|
+
}
|
|
50
|
+
else if (forgeProxyError === 'INVALID_REMOTE') {
|
|
51
|
+
throw new errors_1.InvalidRemoteError(`Invalid remote key provided: "${key}"`, key);
|
|
52
|
+
}
|
|
53
|
+
(0, fetch_1.handleProxyResponseErrors)(response);
|
|
54
|
+
}
|
package/out/index.d.ts
CHANGED
|
@@ -2,8 +2,7 @@ import { QueryApi, EntityStorageApi } from '@forge/storage';
|
|
|
2
2
|
import { authorize } from './authorization';
|
|
3
3
|
import { Route } from './safeUrl';
|
|
4
4
|
import { webTrigger, WebTriggerResponse, WebTriggerRequest, WebTriggerMethod, WebTriggerContext } from './webTrigger';
|
|
5
|
-
import { invokeRemote } from './api/
|
|
6
|
-
import { invokeService } from './api/service';
|
|
5
|
+
import { invokeRemote, invokeService } from './api/endpoint';
|
|
7
6
|
import { __fetchProduct, __requestAtlassianAsApp, __requestAtlassianAsUser } from './api/fetch';
|
|
8
7
|
export interface RequestInit {
|
|
9
8
|
body?: ArrayBuffer | string | URLSearchParams;
|
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,EAA8C,QAAQ,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtH,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,QAAQ,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAe,cAAc,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAK7G,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,eAAe,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAA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AA+B,EAC/B,iBAAiB,EACjB,UAAU,EACV,+BAA+B,EAC/B,8BAA8B,EAC9B,6BAA6B,EAC7B,eAAe,EACf,8BAA8B,EAC9B,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,IAAI,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
package/out/index.js
CHANGED
|
@@ -7,10 +7,9 @@ Object.defineProperty(exports, "authorize", { enumerable: true, get: function ()
|
|
|
7
7
|
const privacy_1 = require("./privacy");
|
|
8
8
|
const webTrigger_1 = require("./webTrigger");
|
|
9
9
|
Object.defineProperty(exports, "webTrigger", { enumerable: true, get: function () { return webTrigger_1.webTrigger; } });
|
|
10
|
-
const
|
|
11
|
-
Object.defineProperty(exports, "invokeRemote", { enumerable: true, get: function () { return
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, "invokeService", { enumerable: true, get: function () { return service_1.invokeService; } });
|
|
10
|
+
const endpoint_1 = require("./api/endpoint");
|
|
11
|
+
Object.defineProperty(exports, "invokeRemote", { enumerable: true, get: function () { return endpoint_1.invokeRemote; } });
|
|
12
|
+
Object.defineProperty(exports, "invokeService", { enumerable: true, get: function () { return endpoint_1.invokeService; } });
|
|
14
13
|
const fetch_1 = require("./api/fetch");
|
|
15
14
|
Object.defineProperty(exports, "__fetchProduct", { enumerable: true, get: function () { return fetch_1.__fetchProduct; } });
|
|
16
15
|
Object.defineProperty(exports, "__requestAtlassianAsApp", { enumerable: true, get: function () { return fetch_1.__requestAtlassianAsApp; } });
|
|
@@ -33,8 +32,8 @@ const storage = (0, storage_1.getStorageInstanceWithQuery)(new storage_1.GlobalS
|
|
|
33
32
|
exports.storage = storage;
|
|
34
33
|
const API = {
|
|
35
34
|
...fetchAPI,
|
|
36
|
-
invokeRemote:
|
|
37
|
-
invokeService:
|
|
35
|
+
invokeRemote: endpoint_1.invokeRemote,
|
|
36
|
+
invokeService: endpoint_1.invokeService
|
|
38
37
|
};
|
|
39
38
|
exports.privacy = {
|
|
40
39
|
reportPersonalData: (0, privacy_1.createReportPersonalData)(fetch_1.__requestAtlassianAsApp)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/api",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1-next.0",
|
|
4
4
|
"description": "Forge API methods",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@atlassian/ari": "^2.199.0",
|
|
17
17
|
"@atlassian/in-memory-metrics": "0.1.0",
|
|
18
18
|
"@atlassian/metrics-interface": "4.0.0",
|
|
19
|
-
"@forge/runtime": "6.0.3
|
|
19
|
+
"@forge/runtime": "6.0.3",
|
|
20
20
|
"@types/node": "20.19.1",
|
|
21
21
|
"@types/node-fetch": "^2.6.12",
|
|
22
22
|
"expect-type": "^0.17.3",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@forge/auth": "0.0.8",
|
|
29
|
-
"@forge/egress": "2.0.3
|
|
29
|
+
"@forge/egress": "2.0.3",
|
|
30
30
|
"@forge/i18n": "0.0.7",
|
|
31
31
|
"@forge/storage": "2.0.2",
|
|
32
32
|
"headers-utils": "^3.0.2"
|
package/out/api/remote.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { APIResponse, RequestInit } from '../index';
|
|
2
|
-
declare type InvokeRemoteOptions = {
|
|
3
|
-
path: string;
|
|
4
|
-
};
|
|
5
|
-
export declare function invokeRemote(remoteKey: string, options: RequestInit & InvokeRemoteOptions): Promise<APIResponse>;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=remote.d.ts.map
|
package/out/api/remote.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/api/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIpD,aAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,GAAG,mBAAmB,GACzC,OAAO,CAAC,WAAW,CAAC,CAqBtB"}
|
package/out/api/remote.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.invokeRemote = void 0;
|
|
4
|
-
const errors_1 = require("./errors");
|
|
5
|
-
const fetch_1 = require("./fetch");
|
|
6
|
-
async function invokeRemote(remoteKey, options) {
|
|
7
|
-
const { path, ...fetchOptions } = options;
|
|
8
|
-
if (!remoteKey) {
|
|
9
|
-
throw new Error('Missing remote key provided to invokeRemote');
|
|
10
|
-
}
|
|
11
|
-
if (!path) {
|
|
12
|
-
throw new Error('Missing or empty path provided to invokeRemote');
|
|
13
|
-
}
|
|
14
|
-
const response = await global.__forge_fetch__({
|
|
15
|
-
type: 'frc',
|
|
16
|
-
remote: remoteKey
|
|
17
|
-
}, path, fetchOptions);
|
|
18
|
-
handleResponseErrors(response, remoteKey);
|
|
19
|
-
return response;
|
|
20
|
-
}
|
|
21
|
-
exports.invokeRemote = invokeRemote;
|
|
22
|
-
function handleResponseErrors(response, remoteKey) {
|
|
23
|
-
const forgeProxyError = (0, fetch_1.getForgeProxyError)(response);
|
|
24
|
-
if (forgeProxyError === 'INVALID_REMOTE') {
|
|
25
|
-
throw new errors_1.InvalidRemoteError(`Invalid remote key provided: "${remoteKey}"`, remoteKey);
|
|
26
|
-
}
|
|
27
|
-
(0, fetch_1.handleProxyResponseErrors)(response);
|
|
28
|
-
}
|
package/out/api/service.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { APIResponse, RequestInit } from '../index';
|
|
2
|
-
declare type InvokeServiceOptions = {
|
|
3
|
-
path: string;
|
|
4
|
-
};
|
|
5
|
-
export declare function invokeService(serviceKey: string, options: RequestInit & InvokeServiceOptions): Promise<APIResponse>;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=service.d.ts.map
|
package/out/api/service.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/api/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIpD,aAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,GAAG,oBAAoB,GAC1C,OAAO,CAAC,WAAW,CAAC,CAqBtB"}
|
package/out/api/service.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.invokeService = void 0;
|
|
4
|
-
const errors_1 = require("./errors");
|
|
5
|
-
const fetch_1 = require("./fetch");
|
|
6
|
-
async function invokeService(serviceKey, options) {
|
|
7
|
-
const { path, ...fetchOptions } = options;
|
|
8
|
-
if (!serviceKey) {
|
|
9
|
-
throw new Error('Missing service key provided to invokeService');
|
|
10
|
-
}
|
|
11
|
-
if (!path) {
|
|
12
|
-
throw new Error('Missing or empty path provided to invokeService');
|
|
13
|
-
}
|
|
14
|
-
const response = await global.__forge_fetch__({
|
|
15
|
-
type: 'fcc',
|
|
16
|
-
service: serviceKey
|
|
17
|
-
}, path, fetchOptions);
|
|
18
|
-
handleResponseErrors(response, serviceKey);
|
|
19
|
-
return response;
|
|
20
|
-
}
|
|
21
|
-
exports.invokeService = invokeService;
|
|
22
|
-
function handleResponseErrors(response, serviceKey) {
|
|
23
|
-
const forgeProxyError = (0, fetch_1.getForgeProxyError)(response);
|
|
24
|
-
if (forgeProxyError === 'INVALID_SERVICE_KEY') {
|
|
25
|
-
throw new errors_1.InvalidContainerServiceError(`Invalid service key provided: "${serviceKey}"`, serviceKey);
|
|
26
|
-
}
|
|
27
|
-
(0, fetch_1.handleProxyResponseErrors)(response);
|
|
28
|
-
}
|