@forge/realtime 0.2.3 → 0.3.0-experimental-4bd2ca0

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 CHANGED
@@ -1,5 +1,34 @@
1
1
  # @forge/realtime
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1d129f0: Allow objects in event payloads. The object must be JSON-serializable.
8
+ - b607fd6: Remove blocker for production apps
9
+
10
+ ### Patch Changes
11
+
12
+ - 80ed8eb: Support object payloads in published events
13
+
14
+ ## 0.3.0-next.2
15
+
16
+ ### Patch Changes
17
+
18
+ - 80ed8eb: Support object payloads in published events
19
+
20
+ ## 0.3.0-next.1
21
+
22
+ ### Minor Changes
23
+
24
+ - 1d129f0: Allow objects in event payloads. The object must be JSON-serializable.
25
+
26
+ ## 0.3.0-next.0
27
+
28
+ ### Minor Changes
29
+
30
+ - b607fd6: Remove blocker for production apps
31
+
3
32
  ## 0.2.3
4
33
 
5
34
  ### Patch Changes
package/out/publish.d.ts CHANGED
@@ -3,7 +3,7 @@ interface PublishOptions {
3
3
  token?: string;
4
4
  contextOverrides?: ProductContext[];
5
5
  }
6
- export declare const publish: (channelName: string, eventPayload: string, options?: PublishOptions) => Promise<{
6
+ export declare const publish: <T extends Record<string, unknown>>(channelName: string, eventPayload: string | T, options?: PublishOptions) => Promise<{
7
7
  eventId: null;
8
8
  eventTimestamp: null;
9
9
  errors: any;
@@ -12,7 +12,7 @@ export declare const publish: (channelName: string, eventPayload: string, option
12
12
  eventTimestamp: any;
13
13
  errors?: undefined;
14
14
  }>;
15
- export declare const publishGlobal: (channelName: string, eventPayload: string, options?: PublishOptions) => Promise<{
15
+ export declare const publishGlobal: <T extends Record<string, unknown>>(channelName: string, eventPayload: string | T, options?: PublishOptions) => Promise<{
16
16
  eventId: null;
17
17
  eventTimestamp: null;
18
18
  errors: any;
@@ -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;AAED,eAAO,MAAM,OAAO,gBAAuB,MAAM,gBAAgB,MAAM,YAAY,cAAc;;;;;;;;EA6EhG,CAAC;AAEF,eAAO,MAAM,aAAa,gBAAuB,MAAM,gBAAgB,MAAM,YAAY,cAAc;;;;;;;;EAgEtG,CAAC"}
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,mDACL,MAAM,sCAET,cAAc;;;;;;;;EA0EzB,CAAC;AAEF,eAAO,MAAM,aAAa,mDACX,MAAM,sCAET,cAAc;;;;;;;;EA6DzB,CAAC"}
package/out/publish.js CHANGED
@@ -27,9 +27,6 @@ const graphqlBody = `mutation publishRealtimeChannel(
27
27
  }`;
28
28
  const publish = async (channelName, eventPayload, options) => {
29
29
  const { appContext, realtime } = (0, runtime_1.__getRuntime)();
30
- if (appContext?.environmentType === 'PRODUCTION') {
31
- throw new Error(utils_1.prodEnvErrorMessage);
32
- }
33
30
  const { token, contextOverrides } = options || {};
34
31
  if (contextOverrides && !Array.isArray(contextOverrides)) {
35
32
  throw new Error('Invalid value for contextOverrides. Please provide an array of valid context properties.');
@@ -49,7 +46,7 @@ const publish = async (channelName, eventPayload, options) => {
49
46
  installationId: appContext.installationId,
50
47
  name: channelName,
51
48
  context: channelContext,
52
- payload: eventPayload,
49
+ payload: JSON.stringify(eventPayload),
53
50
  isGlobal: false,
54
51
  token: token
55
52
  }
@@ -90,9 +87,6 @@ const publish = async (channelName, eventPayload, options) => {
90
87
  exports.publish = publish;
91
88
  const publishGlobal = async (channelName, eventPayload, options) => {
92
89
  const { appContext } = (0, runtime_1.__getRuntime)();
93
- if (appContext?.environmentType === 'PRODUCTION') {
94
- throw new Error(utils_1.prodEnvErrorMessage);
95
- }
96
90
  const response = await global.__forge_fetch__({
97
91
  type: 'realtime'
98
92
  }, '/', {
@@ -102,7 +96,7 @@ const publishGlobal = async (channelName, eventPayload, options) => {
102
96
  variables: {
103
97
  installationId: appContext.installationId,
104
98
  name: channelName,
105
- payload: eventPayload,
99
+ payload: JSON.stringify(eventPayload),
106
100
  isGlobal: true,
107
101
  token: options?.token
108
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"signRealtimeToken.d.ts","sourceRoot":"","sources":["../src/signRealtimeToken.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,iBAAiB,gBAAuB,MAAM,UAAU,GAAG;;;;;;;;EA6DvE,CAAC"}
1
+ {"version":3,"file":"signRealtimeToken.d.ts","sourceRoot":"","sources":["../src/signRealtimeToken.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,iBAAiB,gBAAuB,MAAM,UAAU,GAAG;;;;;;;;EAuDvE,CAAC"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.signRealtimeToken = void 0;
4
- const runtime_1 = require("./runtime");
5
4
  const utils_1 = require("./utils");
6
5
  const graphqlBody = `mutation signRealtimeToken(
7
6
  $channelName: String!
@@ -28,10 +27,6 @@ const graphqlBody = `mutation signRealtimeToken(
28
27
  }
29
28
  }`;
30
29
  const signRealtimeToken = async (channelName, claims) => {
31
- const { appContext } = (0, runtime_1.__getRuntime)();
32
- if (appContext?.environmentType === 'PRODUCTION') {
33
- throw new Error(utils_1.prodEnvErrorMessage);
34
- }
35
30
  const response = await global.__forge_fetch__({
36
31
  type: 'realtime'
37
32
  }, '/', {
package/out/utils.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export declare const handleProxyResponseErrors: (response: Response) => void;
2
- export declare const prodEnvErrorMessage = "Forge realtime usage is restricted to Forge apps in a non-production environment. Please see https://developer.atlassian.com/platform/forge/cli-reference/environments/ for reference on Forge app environments.";
3
2
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,aAAc,QAAQ,KAAG,IAK9D,CAAC;AAEF,eAAO,MAAM,mBAAmB,qNACoL,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,aAAc,QAAQ,KAAG,IAK9D,CAAC"}
package/out/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prodEnvErrorMessage = exports.handleProxyResponseErrors = void 0;
3
+ exports.handleProxyResponseErrors = void 0;
4
4
  const api_1 = require("@forge/api");
5
5
  const getForgeProxyError = (response) => response.headers.get('forge-proxy-error');
6
6
  const handleProxyResponseErrors = (response) => {
@@ -10,4 +10,3 @@ const handleProxyResponseErrors = (response) => {
10
10
  }
11
11
  };
12
12
  exports.handleProxyResponseErrors = handleProxyResponseErrors;
13
- exports.prodEnvErrorMessage = 'Forge realtime usage is restricted to Forge apps in a non-production environment. Please see https://developer.atlassian.com/platform/forge/cli-reference/environments/ for reference on Forge app environments.';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/realtime",
3
- "version": "0.2.3",
3
+ "version": "0.3.0-experimental-4bd2ca0",
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": "6.1.5",
17
+ "@forge/api": "6.3.0-next.2-experimental-4bd2ca0",
18
18
  "@types/node": "20.19.1"
19
19
  },
20
20
  "publishConfig": {