@pc-nexus/realtime 0.8.0-next.6 → 0.8.0-next.8
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 +8 -0
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/lib/realtime.d.ts +8 -0
- package/lib/realtime.d.ts.map +1 -0
- package/lib/realtime.js +22 -0
- package/lib/type.d.ts +17 -0
- package/lib/type.d.ts.map +1 -0
- package/lib/type.js +1 -0
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
# 0.8.0-next.8 (2026-08-14)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- #NEXUS-4228 提供 sdk 和 getway (#1453) 0d87b9b, closes #NEXUS-4228 #1453
|
|
10
|
+
|
|
11
|
+
# 0.8.0-next.7 (2026-08-12)
|
|
12
|
+
|
|
5
13
|
# 0.8.0-next.6 (2026-08-07)
|
|
6
14
|
|
|
7
15
|
# 0.8.0-next.5 (2026-08-07)
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./lib/index.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./lib/index.js";
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RealtimePublishOptions, RealtimePublishResult, RealtimeTokenPermission, SignTokenResult } from "./type.js";
|
|
2
|
+
declare class Realtime {
|
|
3
|
+
signToken(channel: string, claims: Record<string, unknown>, permissions?: RealtimeTokenPermission | RealtimeTokenPermission[]): Promise<SignTokenResult>;
|
|
4
|
+
publish<TPayload>(channel: string, payload: TPayload, options?: RealtimePublishOptions): Promise<RealtimePublishResult>;
|
|
5
|
+
}
|
|
6
|
+
export declare const realtime: Realtime;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=realtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../../src/lib/realtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGpH,cAAM,QAAQ;IACG,SAAS,CAClB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,WAAW,CAAC,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,GAClE,OAAO,CAAC,eAAe,CAAC;IAUd,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CASvI;AAED,eAAO,MAAM,QAAQ,UAAiB,CAAC"}
|
package/lib/realtime.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { invoke } from "@pc-nexus/internal";
|
|
2
|
+
class Realtime {
|
|
3
|
+
async signToken(channel, claims, permissions) {
|
|
4
|
+
const response = await invoke("realtime", "sign-token", {
|
|
5
|
+
channel,
|
|
6
|
+
claims,
|
|
7
|
+
permissions,
|
|
8
|
+
});
|
|
9
|
+
const result = (await response.json());
|
|
10
|
+
return result.value;
|
|
11
|
+
}
|
|
12
|
+
async publish(channel, payload, options) {
|
|
13
|
+
const response = await invoke("realtime", "publish", {
|
|
14
|
+
channel,
|
|
15
|
+
payload,
|
|
16
|
+
options,
|
|
17
|
+
});
|
|
18
|
+
const result = (await response.json());
|
|
19
|
+
return result.value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export const realtime = new Realtime();
|
package/lib/type.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type RealtimeTokenPermission = "subscribe" | "publish";
|
|
2
|
+
export interface SignTokenResult {
|
|
3
|
+
token: string;
|
|
4
|
+
expires_at: number;
|
|
5
|
+
}
|
|
6
|
+
export interface RealtimePublishOptions {
|
|
7
|
+
scope?: RealtimeScope;
|
|
8
|
+
token?: string;
|
|
9
|
+
context?: RealtimeContext;
|
|
10
|
+
}
|
|
11
|
+
type RealtimeScope = "self" | "global" | "token" | "context";
|
|
12
|
+
type RealtimeContext = "project" | "workitem" | "sprint" | "product" | "idea" | "ticket" | "space" | "page" | "library" | "testcase" | "testplan" | "baseline" | "release" | "plan" | "widget" | "dashboard" | "entry";
|
|
13
|
+
export interface RealtimePublishResult {
|
|
14
|
+
message_id: string;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/lib/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG,WAAW,GAAG,SAAS,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACnC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED,KAAK,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAE7D,KAAK,eAAe,GACd,SAAS,GACT,UAAU,GACV,QAAQ,GACR,SAAS,GACT,MAAM,GACN,QAAQ,GACR,OAAO,GACP,MAAM,GACN,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,GACV,SAAS,GACT,MAAM,GACN,QAAQ,GACR,WAAW,GACX,OAAO,CAAC;AAEd,MAAM,WAAW,qBAAqB;IAClC,UAAU,EAAE,MAAM,CAAC;CACtB"}
|
package/lib/type.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pc-nexus/realtime",
|
|
3
|
-
"version": "0.8.0-next.
|
|
3
|
+
"version": "0.8.0-next.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"type": "module",
|
|
30
|
-
"dependencies": {
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@pc-nexus/internal": "0.8.0-next.8"
|
|
32
|
+
},
|
|
31
33
|
"devDependencies": {},
|
|
32
34
|
"peerDependencies": {}
|
|
33
35
|
}
|