@gravity-rail/sdk 10.0.0 → 12.0.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/README.md +25 -32
- package/dist/{account-DEA-f-I9.d.cts → account-D4dzqsFS.d.cts} +0 -2
- package/dist/{account-DEA-f-I9.d.ts → account-D4dzqsFS.d.ts} +0 -2
- package/dist/{agent_team-Baa7AvKF.d.ts → bot_team-BEgHb3ol.d.ts} +163 -149
- package/dist/{agent_team-EdLmOQDL.d.cts → bot_team-C5AAy5t7.d.cts} +163 -149
- package/dist/{chunk-MWTQXZGB.js → chunk-3X5E3PWB.js} +1 -1
- package/dist/chunk-3X5E3PWB.js.map +1 -0
- package/dist/{chunk-XTB2HFSI.js → chunk-5DZ53RQ5.js} +190 -245
- package/dist/chunk-5DZ53RQ5.js.map +1 -0
- package/dist/{client-Cb9pM31S.d.cts → client-5uu0OE60.d.ts} +684 -976
- package/dist/{client-BaF3v-ux.d.ts → client-Bhqh4jc_.d.cts} +684 -976
- package/dist/helpers.d.cts +3 -3
- package/dist/helpers.d.ts +3 -3
- package/dist/index.cjs +205 -258
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -8
- package/dist/index.d.ts +11 -8
- package/dist/index.js +18 -17
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +198 -245
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +124 -66
- package/dist/internal.d.ts +124 -66
- package/dist/internal.js +10 -4
- package/dist/internal.js.map +1 -1
- package/dist/{member-import-Bq_eC7gx.d.ts → member-import-BqEl0RkU.d.ts} +2 -2
- package/dist/{member-import-_zu58M9w.d.cts → member-import-LgqWctZq.d.cts} +2 -2
- package/dist/realtime.cjs +25 -11
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +28 -9
- package/dist/realtime.d.ts +28 -9
- package/dist/realtime.js +23 -10
- package/dist/realtime.js.map +1 -1
- package/dist/schemas.cjs +8 -66
- package/dist/schemas.cjs.map +1 -1
- package/dist/schemas.d.cts +15 -90
- package/dist/schemas.d.ts +15 -90
- package/dist/schemas.js +9 -59
- package/dist/schemas.js.map +1 -1
- package/dist/{tasks-DssYoZDt.d.ts → tasks-D1YbBzy6.d.cts} +50 -91
- package/dist/{tasks-yScacy3c.d.cts → tasks-DZ1IFEms.d.ts} +50 -91
- package/package.json +1 -1
- package/dist/chunk-MWTQXZGB.js.map +0 -1
- package/dist/chunk-XTB2HFSI.js.map +0 -1
package/dist/realtime.cjs
CHANGED
|
@@ -47,7 +47,8 @@ __export(realtime_exports, {
|
|
|
47
47
|
parseOrgAuthRequirements: () => parseOrgAuthRequirements,
|
|
48
48
|
subscribeAccountChannel: () => subscribeAccountChannel,
|
|
49
49
|
subscribeWorkspaceChannel: () => subscribeWorkspaceChannel,
|
|
50
|
-
workspaceChannel: () => workspaceChannel
|
|
50
|
+
workspaceChannel: () => workspaceChannel,
|
|
51
|
+
workspaceSocketActorKey: () => workspaceSocketActorKey
|
|
51
52
|
});
|
|
52
53
|
module.exports = __toCommonJS(realtime_exports);
|
|
53
54
|
|
|
@@ -620,36 +621,45 @@ var RealtimeSocketClient = class {
|
|
|
620
621
|
};
|
|
621
622
|
|
|
622
623
|
// src/realtime/workspace-client.ts
|
|
624
|
+
function workspaceSocketActorKey(actor) {
|
|
625
|
+
return actor.kind === "teammate" ? `teammate:${actor.teammateId}` : `member:${actor.memberId}`;
|
|
626
|
+
}
|
|
627
|
+
function readActor(msg) {
|
|
628
|
+
const isId = (value) => typeof value === "number" && Number.isInteger(value);
|
|
629
|
+
if (isId(msg.teammateId)) return { kind: "teammate", teammateId: msg.teammateId };
|
|
630
|
+
if (isId(msg.memberId)) return { kind: "member", memberId: msg.memberId };
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
623
633
|
function buildWorkspaceWsUrl(session) {
|
|
624
634
|
const isSsl = session.apiUrl.startsWith("https");
|
|
625
635
|
const host = session.apiUrl.replace(/^https?:\/\//, "");
|
|
626
636
|
return `${isSsl ? "wss" : "ws"}://${host}/api/v2/w/${session.workspaceUuid}/ws/realtime`;
|
|
627
637
|
}
|
|
628
638
|
var WorkspaceRealtimeClient = class extends RealtimeSocketClient {
|
|
629
|
-
|
|
639
|
+
actor = null;
|
|
630
640
|
buildUrl(session) {
|
|
631
641
|
return buildWorkspaceWsUrl(session);
|
|
632
642
|
}
|
|
633
643
|
readProtocolInit(msg) {
|
|
634
|
-
this.
|
|
644
|
+
this.actor = readActor(msg);
|
|
635
645
|
}
|
|
636
646
|
clearIdentity() {
|
|
637
|
-
this.
|
|
647
|
+
this.actor = null;
|
|
638
648
|
}
|
|
639
649
|
sessionRequiresReconnect(previous, next) {
|
|
640
650
|
return super.sessionRequiresReconnect(previous, next) || previous?.workspaceUuid !== next.workspaceUuid;
|
|
641
651
|
}
|
|
642
652
|
/**
|
|
643
|
-
*
|
|
653
|
+
* The principal the server authenticated this socket as, or null before
|
|
644
654
|
* `protocol.init` arrives.
|
|
645
655
|
*
|
|
646
656
|
* Channels whose Redis key is workspace-wide can carry events addressed to
|
|
647
|
-
* one
|
|
657
|
+
* one teammate (presence acks, for example). Consumers compare the event's
|
|
648
658
|
* addressee against this so a reply meant for another operator cannot be
|
|
649
659
|
* applied locally.
|
|
650
660
|
*/
|
|
651
|
-
|
|
652
|
-
return this.
|
|
661
|
+
getActor() {
|
|
662
|
+
return this.actor;
|
|
653
663
|
}
|
|
654
664
|
};
|
|
655
665
|
var defaultClient = new WorkspaceRealtimeClient();
|
|
@@ -748,14 +758,17 @@ function editorCollaborationItemKey(item) {
|
|
|
748
758
|
function parseCollaborator(value) {
|
|
749
759
|
if (typeof value !== "object" || value === null) return null;
|
|
750
760
|
const record = value;
|
|
751
|
-
if (typeof record.
|
|
761
|
+
if (typeof record.actorKey !== "string" || record.actorKey === "") return null;
|
|
762
|
+
const isId = (value2) => typeof value2 === "number" && Number.isInteger(value2);
|
|
752
763
|
const name = record.name;
|
|
753
764
|
const avatarUrl = record.avatarUrl;
|
|
754
765
|
const avatarIcon = record.avatarIcon;
|
|
755
766
|
const avatarColor = record.avatarColor;
|
|
756
767
|
return {
|
|
757
768
|
kind: record.kind === "manager" ? "manager" : "member",
|
|
758
|
-
|
|
769
|
+
actorKey: record.actorKey,
|
|
770
|
+
memberId: isId(record.memberId) ? record.memberId : null,
|
|
771
|
+
teammateId: isId(record.teammateId) ? record.teammateId : null,
|
|
759
772
|
name: typeof name === "string" ? name : null,
|
|
760
773
|
avatarUrl: typeof avatarUrl === "string" ? avatarUrl : null,
|
|
761
774
|
avatarIcon: typeof avatarIcon === "string" && avatarIcon in AccountResponseAvatarIcon ? avatarIcon : null,
|
|
@@ -1345,6 +1358,7 @@ var OperatorSessionClient = class {
|
|
|
1345
1358
|
parseOrgAuthRequirements,
|
|
1346
1359
|
subscribeAccountChannel,
|
|
1347
1360
|
subscribeWorkspaceChannel,
|
|
1348
|
-
workspaceChannel
|
|
1361
|
+
workspaceChannel,
|
|
1362
|
+
workspaceSocketActorKey
|
|
1349
1363
|
});
|
|
1350
1364
|
//# sourceMappingURL=realtime.cjs.map
|