@forge/realtime 0.5.0-next.1-experimental-5c60439 → 0.5.0-next.2

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,14 +1,10 @@
1
1
  # @forge/realtime
2
2
 
3
- ## 0.5.0-next.1-experimental-5c60439
4
-
5
- ### Minor Changes
6
-
7
- - 68e1229: Adds pre validation for the forge realtime token in publish methods
3
+ ## 0.5.0-next.2
8
4
 
9
5
  ### Patch Changes
10
6
 
11
- - 4c69f6e: Add headers for rate limits
7
+ - 64e72aa: Updates error return to be consistent
12
8
 
13
9
  ## 0.5.0-next.1
14
10
 
@@ -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,mDACL,MAAM,sCAET,cAAc;;;;;;;;EAmFzB,CAAC;AAEF,eAAO,MAAM,aAAa,mDACX,MAAM,sCAET,cAAc;;;;;;;;EAyEzB,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;;;;;;;;EA2FzB,CAAC;AAEF,eAAO,MAAM,aAAa,mDACX,MAAM,sCAET,cAAc;;;;;;;;EAiFzB,CAAC"}
package/out/publish.js CHANGED
@@ -34,7 +34,15 @@ const publish = async (channelName, eventPayload, options) => {
34
34
  if (token) {
35
35
  const { valid, error } = (0, utils_1.validateToken)(token, channelName);
36
36
  if (!valid) {
37
- return { eventId: null, eventTimestamp: null, errors: [`Realtime token validation failed: ${error}`] };
37
+ return {
38
+ eventId: null,
39
+ eventTimestamp: null,
40
+ errors: [
41
+ {
42
+ message: `Realtime token validation failed: ${error}`
43
+ }
44
+ ]
45
+ };
38
46
  }
39
47
  }
40
48
  const channelContext = contextOverrides
@@ -99,7 +107,15 @@ const publishGlobal = async (channelName, eventPayload, options) => {
99
107
  if (token) {
100
108
  const { valid, error } = (0, utils_1.validateToken)(token, channelName);
101
109
  if (!valid) {
102
- return { eventId: null, eventTimestamp: null, errors: [`Realtime token validation failed: ${error}`] };
110
+ return {
111
+ eventId: null,
112
+ eventTimestamp: null,
113
+ errors: [
114
+ {
115
+ message: `Realtime token validation failed: ${error}`
116
+ }
117
+ ]
118
+ };
103
119
  }
104
120
  }
105
121
  const response = await global.__forge_fetch__({
@@ -140,7 +156,7 @@ const publishGlobal = async (channelName, eventPayload, options) => {
140
156
  eventTimestamp: null,
141
157
  errors: [
142
158
  {
143
- message: 'Error publishing global event to channel.'
159
+ message: 'Error publishing event to channel.'
144
160
  }
145
161
  ]
146
162
  };
@@ -62,7 +62,7 @@ const signRealtimeToken = async (channelName, claims, permissions) => {
62
62
  expiresAt: null,
63
63
  errors: [
64
64
  {
65
- message: 'Error signing realtime token.'
65
+ message: 'Error signing realtime token'
66
66
  }
67
67
  ]
68
68
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/realtime",
3
- "version": "0.5.0-next.1-experimental-5c60439",
3
+ "version": "0.5.0-next.2",
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": "^7.2.2-next.1-experimental-5c60439",
17
+ "@forge/api": "^7.2.2-next.0",
18
18
  "@types/node": "20.19.1"
19
19
  },
20
20
  "publishConfig": {