@forge/realtime 0.1.2-next.0 → 0.2.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 +16 -0
- package/out/productContext.d.ts +7 -0
- package/out/productContext.d.ts.map +1 -0
- package/out/productContext.js +9 -0
- package/out/publish.d.ts +2 -0
- package/out/publish.d.ts.map +1 -1
- package/out/publish.js +13 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @forge/realtime
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8e77d28: Add contextOverrides property to Realtime channel options
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 8ef80d7: Add npmignore file
|
|
12
|
+
|
|
13
|
+
## 0.2.0-next.1
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 8e77d28: Add contextOverrides property to Realtime channel options
|
|
18
|
+
|
|
3
19
|
## 0.1.2-next.0
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -0,0 +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,cAAc,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Jira = void 0;
|
|
4
|
+
var Jira;
|
|
5
|
+
(function (Jira) {
|
|
6
|
+
Jira["Board"] = "board";
|
|
7
|
+
Jira["Issue"] = "issue";
|
|
8
|
+
Jira["Project"] = "project";
|
|
9
|
+
})(Jira = exports.Jira || (exports.Jira = {}));
|
package/out/publish.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { ProductContext } from './productContext';
|
|
1
2
|
interface PublishOptions {
|
|
2
3
|
token?: string;
|
|
4
|
+
contextOverrides?: ProductContext[];
|
|
3
5
|
}
|
|
4
6
|
export declare const publish: (channelName: string, eventPayload: string, options?: PublishOptions) => Promise<{
|
|
5
7
|
eventId: null;
|
package/out/publish.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"
|
|
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;AAED,eAAO,MAAM,OAAO,gBAAuB,MAAM,gBAAgB,MAAM,YAAY,cAAc;;;;;;;;EA6EhG,CAAC;AAEF,eAAO,MAAM,aAAa,gBAAuB,MAAM,gBAAgB,MAAM,YAAY,cAAc;;;;;;;;EAgEtG,CAAC"}
|
package/out/publish.js
CHANGED
|
@@ -7,6 +7,7 @@ const graphqlBody = `mutation publishRealtimeChannel(
|
|
|
7
7
|
$installationId: ID!
|
|
8
8
|
$name: String!
|
|
9
9
|
$payload: String!
|
|
10
|
+
$context: String
|
|
10
11
|
$isGlobal: Boolean
|
|
11
12
|
$token: String
|
|
12
13
|
){
|
|
@@ -15,6 +16,7 @@ const graphqlBody = `mutation publishRealtimeChannel(
|
|
|
15
16
|
installationId: $installationId
|
|
16
17
|
name: $name
|
|
17
18
|
payload: $payload
|
|
19
|
+
context: $context
|
|
18
20
|
isGlobal: $isGlobal
|
|
19
21
|
token: $token
|
|
20
22
|
) {
|
|
@@ -28,6 +30,15 @@ const publish = async (channelName, eventPayload, options) => {
|
|
|
28
30
|
if (appContext?.environmentType === 'PRODUCTION') {
|
|
29
31
|
throw new Error(utils_1.prodEnvErrorMessage);
|
|
30
32
|
}
|
|
33
|
+
const { token, contextOverrides } = options || {};
|
|
34
|
+
if (contextOverrides && !Array.isArray(contextOverrides)) {
|
|
35
|
+
throw new Error('Invalid value for contextOverrides. Please provide an array of valid context properties.');
|
|
36
|
+
}
|
|
37
|
+
const channelContext = contextOverrides
|
|
38
|
+
? JSON.stringify({
|
|
39
|
+
contextOverrides
|
|
40
|
+
})
|
|
41
|
+
: undefined;
|
|
31
42
|
const response = await global.__forge_fetch__({
|
|
32
43
|
type: 'realtime'
|
|
33
44
|
}, '/', {
|
|
@@ -37,9 +48,10 @@ const publish = async (channelName, eventPayload, options) => {
|
|
|
37
48
|
variables: {
|
|
38
49
|
installationId: appContext.installationId,
|
|
39
50
|
name: channelName,
|
|
51
|
+
context: channelContext,
|
|
40
52
|
payload: eventPayload,
|
|
41
53
|
isGlobal: false,
|
|
42
|
-
token:
|
|
54
|
+
token: token
|
|
43
55
|
}
|
|
44
56
|
}),
|
|
45
57
|
errors: [],
|