@forge/realtime 1.0.0-next.1 → 1.0.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 +17 -0
- package/out/productContext.d.ts +1 -1
- package/out/productContext.d.ts.map +1 -1
- package/out/productContext.js +3 -3
- package/out/publish.d.ts.map +1 -1
- package/out/publish.js +4 -6
- package/out/runtime.js +1 -2
- package/out/signRealtimeToken.d.ts +2 -2
- package/out/signRealtimeToken.d.ts.map +1 -1
- package/out/signRealtimeToken.js +1 -5
- package/out/utils.d.ts +1 -1
- package/out/utils.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @forge/realtime
|
|
2
2
|
|
|
3
|
+
## 1.0.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 283c442: Tidy rate limit headers
|
|
8
|
+
|
|
9
|
+
## 1.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 78fcb7f: Adds support for TypeScript 5
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 8a0359e: Handle rate limit errors
|
|
18
|
+
- f4a575a: Adds rate limit headers to signRealtimeToken
|
|
19
|
+
|
|
3
20
|
## 1.0.0-next.1
|
|
4
21
|
|
|
5
22
|
### Major Changes
|
package/out/productContext.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export declare enum Bitbucket {
|
|
|
11
11
|
Repository = "repository",
|
|
12
12
|
PullRequest = "pullRequest"
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export type ProductContext = Jira | Confluence | Bitbucket;
|
|
15
15
|
//# sourceMappingURL=productContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productContext.d.ts","sourceRoot":"","sources":["../src/productContext.ts"],"names":[],"mappings":"AAGA,oBAAY,IAAI;IACd,KAAK,UAAU;IACf,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,oBAAY,UAAU;IACpB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,SAAS;IACnB,UAAU,eAAe;IACzB,WAAW,gBAAgB;CAC5B;AAED,
|
|
1
|
+
{"version":3,"file":"productContext.d.ts","sourceRoot":"","sources":["../src/productContext.ts"],"names":[],"mappings":"AAGA,oBAAY,IAAI;IACd,KAAK,UAAU;IACf,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,oBAAY,UAAU;IACpB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,SAAS;IACnB,UAAU,eAAe;IACzB,WAAW,gBAAgB;CAC5B;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,CAAC"}
|
package/out/productContext.js
CHANGED
|
@@ -6,14 +6,14 @@ var Jira;
|
|
|
6
6
|
Jira["Board"] = "board";
|
|
7
7
|
Jira["Issue"] = "issue";
|
|
8
8
|
Jira["Project"] = "project";
|
|
9
|
-
})(Jira
|
|
9
|
+
})(Jira || (exports.Jira = Jira = {}));
|
|
10
10
|
var Confluence;
|
|
11
11
|
(function (Confluence) {
|
|
12
12
|
Confluence["Content"] = "content";
|
|
13
13
|
Confluence["Space"] = "space";
|
|
14
|
-
})(Confluence
|
|
14
|
+
})(Confluence || (exports.Confluence = Confluence = {}));
|
|
15
15
|
var Bitbucket;
|
|
16
16
|
(function (Bitbucket) {
|
|
17
17
|
Bitbucket["Repository"] = "repository";
|
|
18
18
|
Bitbucket["PullRequest"] = "pullRequest";
|
|
19
|
-
})(Bitbucket
|
|
19
|
+
})(Bitbucket || (exports.Bitbucket = Bitbucket = {}));
|
package/out/publish.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA2BlD,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,cAAc,EAAE,CAAC;CACrC;
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA2BlD,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,cAAc,EAAE,CAAC;CACrC;AAqED,eAAO,MAAM,OAAO,GAAU,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7D,aAAa,MAAM,EACnB,cAAc,MAAM,GAAG,CAAC,EACxB,UAAU,cAAc;;;;;;;;EA2BzB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAU,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnE,aAAa,MAAM,EACnB,cAAc,MAAM,GAAG,CAAC,EACxB,UAAU,cAAc;;;;;;;;EAoBzB,CAAC"}
|
package/out/publish.js
CHANGED
|
@@ -36,16 +36,14 @@ const validateTokenOrReturnError = (token, channelName) => {
|
|
|
36
36
|
}
|
|
37
37
|
return null;
|
|
38
38
|
};
|
|
39
|
-
const executePublish = async (variables, contextToken
|
|
39
|
+
const executePublish = async (variables, contextToken) => {
|
|
40
40
|
const response = await global.__forge_fetch__({ type: 'realtime' }, '/', {
|
|
41
41
|
method: 'POST',
|
|
42
42
|
body: JSON.stringify({ query: graphqlBody, variables }),
|
|
43
43
|
errors: [],
|
|
44
44
|
headers: {
|
|
45
45
|
'Content-Type': 'application/json',
|
|
46
|
-
'x-forge-context-token': contextToken
|
|
47
|
-
'x-rate-limit-app-id': appId,
|
|
48
|
-
'x-rate-limit-installation-id': variables.installationId
|
|
46
|
+
'x-forge-context-token': contextToken
|
|
49
47
|
}
|
|
50
48
|
});
|
|
51
49
|
(0, utils_1.handleProxyResponseErrors)(response);
|
|
@@ -95,7 +93,7 @@ const publish = async (channelName, eventPayload, options) => {
|
|
|
95
93
|
payload: JSON.stringify(eventPayload),
|
|
96
94
|
isGlobal: false,
|
|
97
95
|
token
|
|
98
|
-
}, realtime?.contextToken
|
|
96
|
+
}, realtime?.contextToken);
|
|
99
97
|
};
|
|
100
98
|
exports.publish = publish;
|
|
101
99
|
const publishGlobal = async (channelName, eventPayload, options) => {
|
|
@@ -112,6 +110,6 @@ const publishGlobal = async (channelName, eventPayload, options) => {
|
|
|
112
110
|
payload: JSON.stringify(eventPayload),
|
|
113
111
|
isGlobal: true,
|
|
114
112
|
token
|
|
115
|
-
}, realtime?.contextToken
|
|
113
|
+
}, realtime?.contextToken);
|
|
116
114
|
};
|
|
117
115
|
exports.publishGlobal = publishGlobal;
|
package/out/runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.__getRuntime =
|
|
3
|
+
exports.__getRuntime = __getRuntime;
|
|
4
4
|
function __getRuntime() {
|
|
5
5
|
const runtime = global.__forge_runtime__;
|
|
6
6
|
if (!runtime) {
|
|
@@ -8,4 +8,3 @@ function __getRuntime() {
|
|
|
8
8
|
}
|
|
9
9
|
return runtime;
|
|
10
10
|
}
|
|
11
|
-
exports.__getRuntime = __getRuntime;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
type TokenPermissions = 'subscribe' | 'publish';
|
|
2
|
+
export type RealtimeTokenPermissions = [TokenPermissions, ...TokenPermissions[]];
|
|
3
3
|
export declare const signRealtimeToken: (channelName: string, claims: any, permissions?: RealtimeTokenPermissions) => Promise<{
|
|
4
4
|
token: null;
|
|
5
5
|
expiresAt: null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signRealtimeToken.d.ts","sourceRoot":"","sources":["../src/signRealtimeToken.ts"],"names":[],"mappings":"AA8BA,
|
|
1
|
+
{"version":3,"file":"signRealtimeToken.d.ts","sourceRoot":"","sources":["../src/signRealtimeToken.ts"],"names":[],"mappings":"AA8BA,KAAK,gBAAgB,GAAG,WAAW,GAAG,SAAS,CAAC;AAChD,MAAM,MAAM,wBAAwB,GAAG,CAAC,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAAC,CAAC;AAEjF,eAAO,MAAM,iBAAiB,GAC5B,aAAa,MAAM,EAEnB,QAAQ,GAAG,EACX,cAAc,wBAAwB;;;;;;;;EAsEvC,CAAC"}
|
package/out/signRealtimeToken.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.signRealtimeToken = void 0;
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
|
-
const runtime_1 = require("./runtime");
|
|
6
5
|
const graphqlBody = `mutation signRealtimeToken(
|
|
7
6
|
$channelName: String!
|
|
8
7
|
$claims: JSON!
|
|
@@ -30,7 +29,6 @@ const graphqlBody = `mutation signRealtimeToken(
|
|
|
30
29
|
}
|
|
31
30
|
}`;
|
|
32
31
|
const signRealtimeToken = async (channelName, claims, permissions) => {
|
|
33
|
-
const { appContext } = (0, runtime_1.__getRuntime)();
|
|
34
32
|
const response = await global.__forge_fetch__({
|
|
35
33
|
type: 'realtime'
|
|
36
34
|
}, '/', {
|
|
@@ -45,9 +43,7 @@ const signRealtimeToken = async (channelName, claims, permissions) => {
|
|
|
45
43
|
}),
|
|
46
44
|
errors: [],
|
|
47
45
|
headers: {
|
|
48
|
-
'Content-Type': 'application/json'
|
|
49
|
-
'x-rate-limit-app-id': appContext.appId,
|
|
50
|
-
'x-rate-limit-installation-id': appContext.installationId
|
|
46
|
+
'Content-Type': 'application/json'
|
|
51
47
|
}
|
|
52
48
|
});
|
|
53
49
|
(0, utils_1.handleProxyResponseErrors)(response);
|
package/out/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const handleProxyResponseErrors: (response: Response) => void;
|
|
2
|
-
|
|
2
|
+
type RealtimeTokenValidationError = 'INVALID_TOKEN' | 'TOKEN_EXPIRED' | 'MISSING_PERMISSION' | 'CHANNEL_NAME_MISMATCH';
|
|
3
3
|
interface RealtimeTokenValidationResult {
|
|
4
4
|
error?: RealtimeTokenValidationError;
|
|
5
5
|
valid: boolean;
|
package/out/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,yBAAyB,GAAI,UAAU,QAAQ,KAAG,IAK9D,CAAC;AAeF,KAAK,4BAA4B,GAAG,eAAe,GAAG,eAAe,GAAG,oBAAoB,GAAG,uBAAuB,CAAC;AAEvH,UAAU,6BAA6B;IACrC,KAAK,CAAC,EAAE,4BAA4B,CAAC;IACrC,KAAK,EAAE,OAAO,CAAC;CAChB;AAuBD,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,aAAa,MAAM,KAAG,6BAqBlE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/realtime",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-next.0",
|
|
4
4
|
"description": "Forge realtime",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@atlassian/metrics-interface": "4.0.0",
|
|
17
|
-
"@forge/api": "^8.0.
|
|
17
|
+
"@forge/api": "^8.0.3-next.0",
|
|
18
18
|
"@types/node": "20.19.1",
|
|
19
19
|
"typescript": "5.9.2"
|
|
20
20
|
},
|