@gravity-rail/sdk 10.0.0 → 11.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.
Files changed (44) hide show
  1. package/README.md +25 -32
  2. package/dist/{account-DEA-f-I9.d.cts → account-D4dzqsFS.d.cts} +0 -2
  3. package/dist/{account-DEA-f-I9.d.ts → account-D4dzqsFS.d.ts} +0 -2
  4. package/dist/{agent_team-Baa7AvKF.d.ts → bot_team-CHU0j4Lb.d.ts} +163 -149
  5. package/dist/{agent_team-EdLmOQDL.d.cts → bot_team-DCnHRLBa.d.cts} +163 -149
  6. package/dist/{chunk-MWTQXZGB.js → chunk-NCMT36JY.js} +1 -1
  7. package/dist/chunk-NCMT36JY.js.map +1 -0
  8. package/dist/{chunk-XTB2HFSI.js → chunk-X6A3URGV.js} +158 -223
  9. package/dist/chunk-X6A3URGV.js.map +1 -0
  10. package/dist/{client-BaF3v-ux.d.ts → client-7gZX_34u.d.cts} +643 -967
  11. package/dist/{client-Cb9pM31S.d.cts → client-Bkn4Vb3I.d.ts} +643 -967
  12. package/dist/helpers.d.cts +3 -3
  13. package/dist/helpers.d.ts +3 -3
  14. package/dist/index.cjs +173 -236
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +11 -8
  17. package/dist/index.d.ts +11 -8
  18. package/dist/index.js +18 -17
  19. package/dist/index.js.map +1 -1
  20. package/dist/internal.cjs +166 -223
  21. package/dist/internal.cjs.map +1 -1
  22. package/dist/internal.d.cts +124 -66
  23. package/dist/internal.d.ts +124 -66
  24. package/dist/internal.js +10 -4
  25. package/dist/internal.js.map +1 -1
  26. package/dist/{member-import-Bq_eC7gx.d.ts → member-import-B-ym1Ks1.d.ts} +4 -4
  27. package/dist/{member-import-_zu58M9w.d.cts → member-import-CVeZLZGP.d.cts} +4 -4
  28. package/dist/realtime.cjs +25 -11
  29. package/dist/realtime.cjs.map +1 -1
  30. package/dist/realtime.d.cts +28 -9
  31. package/dist/realtime.d.ts +28 -9
  32. package/dist/realtime.js +23 -10
  33. package/dist/realtime.js.map +1 -1
  34. package/dist/schemas.cjs +8 -66
  35. package/dist/schemas.cjs.map +1 -1
  36. package/dist/schemas.d.cts +18 -93
  37. package/dist/schemas.d.ts +18 -93
  38. package/dist/schemas.js +9 -59
  39. package/dist/schemas.js.map +1 -1
  40. package/dist/{tasks-DssYoZDt.d.ts → tasks-C_uMyhuO.d.cts} +52 -99
  41. package/dist/{tasks-yScacy3c.d.cts → tasks-Dv0rAk5j.d.ts} +52 -99
  42. package/package.json +1 -1
  43. package/dist/chunk-MWTQXZGB.js.map +0 -1
  44. package/dist/chunk-XTB2HFSI.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { cY as BusinessImportPreviewResponse, c$ as BusinessImportPreviewSummary, cW as BusinessImportIssueCode, d0 as BusinessImportResponse } from './client-Cb9pM31S.cjs';
2
- import { c1 as MemberImportPreviewResponse, c4 as MemberImportPreviewSummary, c3 as MemberImportPreviewRowAction, b$ as MemberImportMatchInfoMatchType, cd as MemberImportStreamEvent } from './tasks-yScacy3c.cjs';
1
+ import { cY as BusinessImportPreviewResponse, c$ as BusinessImportPreviewSummary, cW as BusinessImportIssueCode, d0 as BusinessImportResponse } from './client-7gZX_34u.cjs';
2
+ import { c1 as MemberImportPreviewResponse, c4 as MemberImportPreviewSummary, c3 as MemberImportPreviewRowAction, b$ as MemberImportMatchInfoMatchType, cd as MemberImportStreamEvent } from './tasks-C_uMyhuO.cjs';
3
3
 
4
4
  /** Counts, row numbers, codes, column keys, changed field names and business ids; no prose. */
5
5
  declare function toSafeBusinessImportPreview(preview: BusinessImportPreviewResponse): {
@@ -8,7 +8,7 @@ declare function toSafeBusinessImportPreview(preview: BusinessImportPreviewRespo
8
8
  summary: BusinessImportPreviewSummary;
9
9
  rows: {
10
10
  row: number;
11
- action: "create" | "update" | "unchanged" | "error";
11
+ action: "unchanged" | "create" | "update" | "error";
12
12
  legalEntityUuid: string | undefined;
13
13
  proposedChanges: string[] | undefined;
14
14
  reason: "submitted_business_not_changed" | undefined;
@@ -30,7 +30,7 @@ declare function toSafeBusinessImportResult(result: BusinessImportResponse): {
30
30
  summary: BusinessImportPreviewSummary;
31
31
  rows: {
32
32
  row: number;
33
- action: "create" | "update" | "unchanged" | "error";
33
+ action: "unchanged" | "create" | "update" | "error";
34
34
  legalEntityUuid: string | undefined;
35
35
  proposedChanges: string[] | undefined;
36
36
  reason: "submitted_business_not_changed" | undefined;
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
- memberId = null;
639
+ actor = null;
630
640
  buildUrl(session) {
631
641
  return buildWorkspaceWsUrl(session);
632
642
  }
633
643
  readProtocolInit(msg) {
634
- this.memberId = typeof msg.memberId === "number" ? msg.memberId : null;
644
+ this.actor = readActor(msg);
635
645
  }
636
646
  clearIdentity() {
637
- this.memberId = null;
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
- * Member id the server authenticated this socket as, or null before
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 member (presence acks, for example). Consumers compare the event's
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
- getMemberId() {
652
- return this.memberId;
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.memberId !== "number" || !Number.isInteger(record.memberId)) return null;
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
- memberId: record.memberId,
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