@teambit/lanes 1.0.107 → 1.0.109

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.
@@ -17,28 +17,27 @@ import { Lane } from '@teambit/legacy/dist/scope/models';
17
17
  import { ExportMain } from '@teambit/export';
18
18
  import { ComponentCompareMain } from '@teambit/component-compare';
19
19
  import { ComponentWriterMain } from '@teambit/component-writer';
20
- import { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';
21
20
  import { RemoveMain } from '@teambit/remove';
22
21
  import { MergingMain } from '@teambit/merging';
23
22
  import { CheckoutMain } from '@teambit/checkout';
24
23
  import { ChangeType } from '@teambit/lanes.entities.lane-diff';
25
24
  import ComponentsList, { DivergeDataPerId } from '@teambit/legacy/dist/consumer/component/components-list';
26
25
  export { Lane };
27
- export declare type SnapsDistanceObj = {
26
+ export type SnapsDistanceObj = {
28
27
  onSource: string[];
29
28
  onTarget: string[];
30
29
  common?: string;
31
30
  };
32
- export declare type LaneResults = {
31
+ export type LaneResults = {
33
32
  lanes: LaneData[];
34
33
  currentLane?: string | null;
35
34
  };
36
- export declare type CreateLaneOptions = {
35
+ export type CreateLaneOptions = {
37
36
  scope?: string;
38
37
  alias?: string;
39
38
  forkLaneNewScope?: boolean;
40
39
  };
41
- export declare type SwitchLaneOptions = {
40
+ export type SwitchLaneOptions = {
42
41
  alias?: string;
43
42
  merge?: MergeStrategy;
44
43
  getAll?: boolean;
@@ -47,7 +46,7 @@ export declare type SwitchLaneOptions = {
47
46
  verbose?: boolean;
48
47
  override?: boolean;
49
48
  };
50
- export declare type LaneComponentDiffStatus = {
49
+ export type LaneComponentDiffStatus = {
51
50
  componentId: ComponentID;
52
51
  sourceHead: string;
53
52
  targetHead?: string;
@@ -61,19 +60,19 @@ export declare type LaneComponentDiffStatus = {
61
60
  snapsDistance?: SnapsDistanceObj;
62
61
  unrelated?: boolean;
63
62
  };
64
- export declare type LaneDiffStatusOptions = {
63
+ export type LaneDiffStatusOptions = {
65
64
  skipChanges?: boolean;
66
65
  };
67
- export declare type LaneDiffStatus = {
66
+ export type LaneDiffStatus = {
68
67
  source: LaneId;
69
68
  target: LaneId;
70
69
  componentsStatus: LaneComponentDiffStatus[];
71
70
  };
72
- export declare type MarkRemoveOnLaneResult = {
71
+ export type MarkRemoveOnLaneResult = {
73
72
  removedFromWs: ComponentID[];
74
73
  markedRemoved: ComponentID[];
75
74
  };
76
- declare type CreateLaneResult = {
75
+ type CreateLaneResult = {
77
76
  laneId: LaneId;
78
77
  hash: string;
79
78
  alias?: string;
@@ -130,14 +129,6 @@ export declare class LanesMain {
130
129
  }>;
131
130
  exportLane(lane: Lane): Promise<void>;
132
131
  importLaneObject(laneId: LaneId, persistIfNotExists?: boolean): Promise<Lane>;
133
- /**
134
- * get the distance for a component between two lanes. for example, lane-b forked from lane-a and lane-b added some new snaps
135
- * @param componentId
136
- * @param sourceHead head on the source lane. leave empty if the source is main
137
- * @param targetHead head on the target lane. leave empty if the target is main
138
- * @returns
139
- */
140
- getSnapsDistance(componentId: ComponentID, sourceHead?: string, targetHead?: string, throws?: boolean): Promise<SnapsDistance>;
141
132
  /**
142
133
  * get the head hash (snap) of main. return undefined if the component exists only on a lane and was never merged to main
143
134
  */
@@ -197,7 +188,7 @@ export declare class LanesMain {
197
188
  get createRoutePath(): string;
198
189
  get deleteRoutePath(): string;
199
190
  get restoreRoutePath(): string;
200
- static slots: never[];
191
+ static slots: any[];
201
192
  static dependencies: import("@teambit/harmony").Aspect[];
202
193
  static runtime: import("@teambit/harmony").RuntimeDefinition;
203
194
  static provider([cli, scope, workspace, graphql, merging, component, loggerMain, importer, exporter, express, componentCompare, componentWriter, remove, checkout,]: [
@@ -324,13 +324,12 @@ class LanesMain {
324
324
  showDefaultLane,
325
325
  notMerged
326
326
  }) {
327
- var _this$workspace;
328
327
  const showMergeData = Boolean(merged || notMerged);
329
- const consumer = (_this$workspace = this.workspace) === null || _this$workspace === void 0 ? void 0 : _this$workspace.consumer;
328
+ const consumer = this.workspace?.consumer;
330
329
  if (remote) {
331
330
  const laneId = name ? _laneId().LaneId.from(name, remote) : undefined;
332
331
  const remoteObj = await (0, _getRemoteByName().default)(remote, consumer);
333
- const lanes = await remoteObj.listLanes(laneId === null || laneId === void 0 ? void 0 : laneId.toString(), showMergeData);
332
+ const lanes = await remoteObj.listLanes(laneId?.toString(), showMergeData);
334
333
  // no need to filter soft-removed here. it was filtered already in the remote
335
334
  return lanes;
336
335
  }
@@ -376,8 +375,7 @@ class LanesMain {
376
375
  }));
377
376
  }
378
377
  getCurrentLaneName() {
379
- var _this$getCurrentLaneI;
380
- return ((_this$getCurrentLaneI = this.getCurrentLaneId()) === null || _this$getCurrentLaneI === void 0 ? void 0 : _this$getCurrentLaneI.name) || null;
378
+ return this.getCurrentLaneId()?.name || null;
381
379
  }
382
380
  getCurrentLaneNameOrAlias() {
383
381
  const currentLaneId = this.getCurrentLaneId();
@@ -402,8 +400,7 @@ class LanesMain {
402
400
  return _laneId().LaneId.from(_laneId().DEFAULT_LANE, this.scope.name);
403
401
  }
404
402
  setCurrentLane(laneId, alias, exported) {
405
- var _this$workspace2;
406
- (_this$workspace2 = this.workspace) === null || _this$workspace2 === void 0 || _this$workspace2.consumer.setCurrentLane(laneId, exported);
403
+ this.workspace?.consumer.setCurrentLane(laneId, exported);
407
404
  }
408
405
  async createLane(name, {
409
406
  scope,
@@ -463,7 +460,7 @@ if you wish to keep ${scope} scope, please re-run the command with "--fork-lane-
463
460
  const beforeTrackDataCloned = beforeTrackData ? _objectSpread({}, beforeTrackData) : undefined;
464
461
  const afterTrackData = {
465
462
  localLane: localName,
466
- remoteLane: remoteName || (beforeTrackData === null || beforeTrackData === void 0 ? void 0 : beforeTrackData.remoteLane) || localName,
463
+ remoteLane: remoteName || beforeTrackData?.remoteLane || localName,
467
464
  remoteScope
468
465
  };
469
466
  this.scope.legacyScope.lanes.trackLane(afterTrackData);
@@ -572,7 +569,7 @@ please create a new lane instead, which will include all components of this lane
572
569
 
573
570
  // change current-lane if needed
574
571
  const currentLaneId = this.getCurrentLaneId();
575
- if (currentLaneId !== null && currentLaneId !== void 0 && currentLaneId.isEqual(laneId)) {
572
+ if (currentLaneId?.isEqual(laneId)) {
576
573
  const newLaneId = _laneId().LaneId.from(newName, lane.scope);
577
574
  const isExported = this.workspace.consumer.bitMap.isLaneExported;
578
575
  this.setCurrentLane(newLaneId, undefined, isExported);
@@ -597,32 +594,12 @@ please create a new lane instead, which will include all components of this lane
597
594
  return this.importer.importLaneObject(laneId, persistIfNotExists);
598
595
  }
599
596
 
600
- /**
601
- * get the distance for a component between two lanes. for example, lane-b forked from lane-a and lane-b added some new snaps
602
- * @param componentId
603
- * @param sourceHead head on the source lane. leave empty if the source is main
604
- * @param targetHead head on the target lane. leave empty if the target is main
605
- * @returns
606
- */
607
- async getSnapsDistance(componentId, sourceHead, targetHead, throws) {
608
- if (!sourceHead && !targetHead) throw new Error(`getDivergeData got sourceHead and targetHead empty. at least one of them should be populated`);
609
- const modelComponent = await this.scope.legacyScope.getModelComponent(componentId);
610
- return (0, _getDivergeData().getDivergeData)({
611
- modelComponent,
612
- repo: this.scope.legacyScope.objects,
613
- sourceHead: sourceHead ? _objects().Ref.from(sourceHead) : modelComponent.head || null,
614
- targetHead: targetHead ? _objects().Ref.from(targetHead) : modelComponent.head || null,
615
- throws
616
- });
617
- }
618
-
619
597
  /**
620
598
  * get the head hash (snap) of main. return undefined if the component exists only on a lane and was never merged to main
621
599
  */
622
600
  async getHeadOnMain(componentId) {
623
- var _modelComponent$head;
624
601
  const modelComponent = await this.scope.legacyScope.getModelComponent(componentId);
625
- return (_modelComponent$head = modelComponent.head) === null || _modelComponent$head === void 0 ? void 0 : _modelComponent$head.toString();
602
+ return modelComponent.head?.toString();
626
603
  }
627
604
 
628
605
  /**
@@ -642,12 +619,11 @@ please create a new lane instead, which will include all components of this lane
642
619
  return lane;
643
620
  }
644
621
  async removeLanes(laneNames, opts) {
645
- var _this$workspace3;
646
- if (!this.workspace && !(opts !== null && opts !== void 0 && opts.remote)) {
622
+ if (!this.workspace && !opts?.remote) {
647
623
  await this.scope.legacyScope.lanes.removeLanes(this.scope.legacyScope, laneNames, true);
648
624
  return laneNames;
649
625
  }
650
- const results = await (0, _removeLanes().default)((_this$workspace3 = this.workspace) === null || _this$workspace3 === void 0 ? void 0 : _this$workspace3.consumer, laneNames, !!(opts !== null && opts !== void 0 && opts.remote), !!(opts !== null && opts !== void 0 && opts.force));
626
+ const results = await (0, _removeLanes().default)(this.workspace?.consumer, laneNames, !!opts?.remote, !!opts?.force);
651
627
  if (this.workspace) await this.workspace.consumer.onDestroy('lane-remove');
652
628
  return results.laneResults;
653
629
  }
@@ -774,7 +750,7 @@ please create a new lane instead, which will include all components of this lane
774
750
  const scope = this.workspace.scope.legacyScope;
775
751
  const laneId = laneName ? await scope.lanes.parseLaneIdFromString(laneName) : this.getCurrentLaneId();
776
752
  const lane = await scope.loadLane(laneId);
777
- if (!(lane !== null && lane !== void 0 && lane.readmeComponent)) {
753
+ if (!lane?.readmeComponent) {
778
754
  throw new (_bitError().BitError)(`there is no readme component added to the lane ${laneName || currentLaneName}`);
779
755
  }
780
756
  const readmeComponentId = await this.workspace.resolveComponentId(lane.readmeComponent.id);
@@ -793,16 +769,16 @@ please create a new lane instead, which will include all components of this lane
793
769
  };
794
770
  }
795
771
  async diffStatus(sourceLaneId, targetLaneId, options) {
796
- this.logger.profile(`diff status for source lane: ${sourceLaneId.name} and target lane: ${targetLaneId === null || targetLaneId === void 0 ? void 0 : targetLaneId.name}`);
772
+ this.logger.profile(`diff status for source lane: ${sourceLaneId.name} and target lane: ${targetLaneId?.name}`);
797
773
  const sourceLane = sourceLaneId.isDefault() ? await this.getLaneDataOfDefaultLane() : await this.loadLane(sourceLaneId);
798
- const sourceLaneComponents = sourceLaneId.isDefault() ? sourceLane === null || sourceLane === void 0 ? void 0 : sourceLane.components.map(main => ({
774
+ const sourceLaneComponents = sourceLaneId.isDefault() ? sourceLane?.components.map(main => ({
799
775
  id: main.id,
800
776
  head: _objects().Ref.from(main.head)
801
- })) : sourceLane === null || sourceLane === void 0 ? void 0 : sourceLane.components;
777
+ })) : sourceLane?.components;
802
778
  const targetLane = targetLaneId ? await this.loadLane(targetLaneId) : undefined;
803
- const targetLaneIds = targetLane === null || targetLane === void 0 ? void 0 : targetLane.toBitIds();
779
+ const targetLaneIds = targetLane?.toBitIds();
804
780
  const host = this.componentAspect.getHost();
805
- const targetMainHeads = !targetLaneId || targetLaneId !== null && targetLaneId !== void 0 && targetLaneId.isDefault() ? (0, _lodash().compact)(await Promise.all((sourceLaneComponents || []).map(async ({
781
+ const targetMainHeads = !targetLaneId || targetLaneId?.isDefault() ? (0, _lodash().compact)(await Promise.all((sourceLaneComponents || []).map(async ({
806
782
  id
807
783
  }) => {
808
784
  const componentId = await host.resolveComponentId(id);
@@ -814,13 +790,12 @@ please create a new lane instead, which will include all components of this lane
814
790
  id,
815
791
  head
816
792
  }) => {
817
- var _targetLaneIds$search;
818
793
  const componentId = await host.resolveComponentId(id);
819
794
  const sourceVersionObj = await this.scope.legacyScope.objects.load(head, true);
820
795
  if (sourceVersionObj.isRemoved()) {
821
796
  return null;
822
797
  }
823
- const headOnTargetLane = targetLaneIds ? (_targetLaneIds$search = targetLaneIds.searchWithoutVersion(id)) === null || _targetLaneIds$search === void 0 ? void 0 : _targetLaneIds$search.version : await this.getHeadOnMain(componentId);
798
+ const headOnTargetLane = targetLaneIds ? targetLaneIds.searchWithoutVersion(id)?.version : await this.getHeadOnMain(componentId);
824
799
  if (headOnTargetLane) {
825
800
  const targetVersionObj = await this.scope.legacyScope.objects.load(_objects().Ref.from(headOnTargetLane), true);
826
801
  if (targetVersionObj.isRemoved()) {
@@ -836,13 +811,13 @@ please create a new lane instead, which will include all components of this lane
836
811
  };
837
812
  })));
838
813
  const snapDistancesByComponentId = new Map();
839
- this.logger.profile(`get snaps distance for source lane: ${sourceLane === null || sourceLane === void 0 ? void 0 : sourceLane.id.name} and target lane: ${targetLane === null || targetLane === void 0 ? void 0 : targetLane.id.name} with ${diffProps.length} components`);
814
+ this.logger.profile(`get snaps distance for source lane: ${sourceLane?.id.name} and target lane: ${targetLane?.id.name} with ${diffProps.length} components`);
840
815
  await (0, _pMap().default)(diffProps, async ({
841
816
  componentId,
842
817
  sourceHead,
843
818
  targetHead
844
819
  }) => {
845
- const snapsDistance = await this.getSnapsDistance(componentId, sourceHead, targetHead, false);
820
+ const snapsDistance = await this.scope.getSnapsDistanceBetweenTwoSnaps(componentId, sourceHead, targetHead, false);
846
821
  if (snapsDistance) {
847
822
  snapDistancesByComponentId.set(componentId.toString(), {
848
823
  snapsDistance,
@@ -854,10 +829,10 @@ please create a new lane instead, which will include all components of this lane
854
829
  }, {
855
830
  concurrency: (0, _concurrency().concurrentComponentsLimit)()
856
831
  });
857
- this.logger.profile(`get snaps distance for source lane: ${sourceLane === null || sourceLane === void 0 ? void 0 : sourceLane.id.name} and target lane: ${targetLane === null || targetLane === void 0 ? void 0 : targetLane.id.name} with ${diffProps.length} components`);
832
+ this.logger.profile(`get snaps distance for source lane: ${sourceLane?.id.name} and target lane: ${targetLane?.id.name} with ${diffProps.length} components`);
858
833
  const commonSnapsToImport = (0, _lodash().compact)([...snapDistancesByComponentId.values()].map(s => s.snapsDistance.commonSnapBeforeDiverge ? s.componentId.changeVersion(s.snapsDistance.commonSnapBeforeDiverge.hash) : null));
859
- const sourceOrTargetLane = ((sourceLaneId.isDefault() ? null : sourceLane) || (targetLaneId !== null && targetLaneId !== void 0 && targetLaneId.isDefault() ? null : targetLane)) ?? undefined;
860
- if (commonSnapsToImport.length > 0 && !(options !== null && options !== void 0 && options.skipChanges)) {
834
+ const sourceOrTargetLane = ((sourceLaneId.isDefault() ? null : sourceLane) || (targetLaneId?.isDefault() ? null : targetLane)) ?? undefined;
835
+ if (commonSnapsToImport.length > 0 && !options?.skipChanges) {
861
836
  await this.scope.legacyScope.scopeImporter.importWithoutDeps(_componentId().ComponentIdList.fromArray(commonSnapsToImport), {
862
837
  cache: true,
863
838
  reason: `get the common snap for lane diff`,
@@ -868,11 +843,8 @@ please create a new lane instead, which will include all components of this lane
868
843
  componentId,
869
844
  sourceHead,
870
845
  targetHead
871
- }) => {
872
- var _snapDistancesByCompo;
873
- return this.componentDiffStatus(componentId, sourceHead, targetHead, (_snapDistancesByCompo = snapDistancesByComponentId.get(componentId.toString())) === null || _snapDistancesByCompo === void 0 ? void 0 : _snapDistancesByCompo.snapsDistance, options);
874
- });
875
- this.logger.profile(`diff status for source lane: ${sourceLaneId.name} and target lane: ${targetLaneId === null || targetLaneId === void 0 ? void 0 : targetLaneId.name}`);
846
+ }) => this.componentDiffStatus(componentId, sourceHead, targetHead, snapDistancesByComponentId.get(componentId.toString())?.snapsDistance, options));
847
+ this.logger.profile(`diff status for source lane: ${sourceLaneId.name} and target lane: ${targetLaneId?.name}`);
876
848
  return {
877
849
  source: sourceLaneId,
878
850
  target: targetLaneId || this.getDefaultLaneId(),
@@ -880,19 +852,18 @@ please create a new lane instead, which will include all components of this lane
880
852
  };
881
853
  }
882
854
  async componentDiffStatus(componentId, sourceHead, targetHead, snapsDistance, options) {
883
- var _snapsDistance$common;
884
- if (snapsDistance !== null && snapsDistance !== void 0 && snapsDistance.err) {
855
+ if (snapsDistance?.err) {
885
856
  const noCommonSnap = snapsDistance.err instanceof _noCommonSnap().NoCommonSnap;
886
857
  return {
887
858
  componentId,
888
859
  sourceHead,
889
860
  targetHead,
890
- upToDate: snapsDistance === null || snapsDistance === void 0 ? void 0 : snapsDistance.isUpToDate(),
861
+ upToDate: snapsDistance?.isUpToDate(),
891
862
  unrelated: noCommonSnap || undefined,
892
863
  changes: []
893
864
  };
894
865
  }
895
- const commonSnap = snapsDistance === null || snapsDistance === void 0 ? void 0 : snapsDistance.commonSnapBeforeDiverge;
866
+ const commonSnap = snapsDistance?.commonSnapBeforeDiverge;
896
867
  const getChanges = async () => {
897
868
  if (!commonSnap) return [_lanesEntities().ChangeType.NEW];
898
869
 
@@ -914,37 +885,36 @@ please create a new lane instead, which will include all components of this lane
914
885
  }
915
886
  return changed;
916
887
  };
917
- const changes = !(options !== null && options !== void 0 && options.skipChanges) ? await getChanges() : undefined;
888
+ const changes = !options?.skipChanges ? await getChanges() : undefined;
918
889
  const changeType = changes ? changes[0] : undefined;
919
890
  return {
920
891
  componentId,
921
892
  changeType,
922
893
  changes,
923
894
  sourceHead,
924
- targetHead: commonSnap === null || commonSnap === void 0 ? void 0 : commonSnap.hash,
925
- upToDate: snapsDistance === null || snapsDistance === void 0 ? void 0 : snapsDistance.isUpToDate(),
895
+ targetHead: commonSnap?.hash,
896
+ upToDate: snapsDistance?.isUpToDate(),
926
897
  snapsDistance: {
927
- onSource: (snapsDistance === null || snapsDistance === void 0 ? void 0 : snapsDistance.snapsOnSourceOnly.map(s => s.hash)) ?? [],
928
- onTarget: (snapsDistance === null || snapsDistance === void 0 ? void 0 : snapsDistance.snapsOnTargetOnly.map(s => s.hash)) ?? [],
929
- common: snapsDistance === null || snapsDistance === void 0 || (_snapsDistance$common = snapsDistance.commonSnapBeforeDiverge) === null || _snapsDistance$common === void 0 ? void 0 : _snapsDistance$common.hash
898
+ onSource: snapsDistance?.snapsOnSourceOnly.map(s => s.hash) ?? [],
899
+ onTarget: snapsDistance?.snapsOnTargetOnly.map(s => s.hash) ?? [],
900
+ common: snapsDistance?.commonSnapBeforeDiverge?.hash
930
901
  }
931
902
  };
932
903
  }
933
904
  async componentDiffStatusOld(componentId, sourceHead, targetHead, options) {
934
- var _snapsDistance$common2;
935
- const snapsDistance = await this.getSnapsDistance(componentId, sourceHead, targetHead, false);
936
- if (snapsDistance !== null && snapsDistance !== void 0 && snapsDistance.err) {
905
+ const snapsDistance = await this.scope.getSnapsDistanceBetweenTwoSnaps(componentId, sourceHead, targetHead, false);
906
+ if (snapsDistance?.err) {
937
907
  const noCommonSnap = snapsDistance.err instanceof _noCommonSnap().NoCommonSnap;
938
908
  return {
939
909
  componentId,
940
910
  sourceHead,
941
911
  targetHead,
942
- upToDate: snapsDistance === null || snapsDistance === void 0 ? void 0 : snapsDistance.isUpToDate(),
912
+ upToDate: snapsDistance?.isUpToDate(),
943
913
  unrelated: noCommonSnap || undefined,
944
914
  changes: []
945
915
  };
946
916
  }
947
- const commonSnap = snapsDistance === null || snapsDistance === void 0 ? void 0 : snapsDistance.commonSnapBeforeDiverge;
917
+ const commonSnap = snapsDistance?.commonSnapBeforeDiverge;
948
918
  const getChanges = async () => {
949
919
  if (!commonSnap) return [_lanesEntities().ChangeType.NEW];
950
920
  const compare = await this.componentCompare.compare(componentId.changeVersion(commonSnap.hash).toString(), componentId.changeVersion(sourceHead).toString());
@@ -964,19 +934,19 @@ please create a new lane instead, which will include all components of this lane
964
934
  }
965
935
  return changed;
966
936
  };
967
- const changes = !(options !== null && options !== void 0 && options.skipChanges) ? await getChanges() : undefined;
937
+ const changes = !options?.skipChanges ? await getChanges() : undefined;
968
938
  const changeType = changes ? changes[0] : undefined;
969
939
  return {
970
940
  componentId,
971
941
  changeType,
972
942
  changes,
973
943
  sourceHead,
974
- targetHead: commonSnap === null || commonSnap === void 0 ? void 0 : commonSnap.hash,
975
- upToDate: snapsDistance === null || snapsDistance === void 0 ? void 0 : snapsDistance.isUpToDate(),
944
+ targetHead: commonSnap?.hash,
945
+ upToDate: snapsDistance?.isUpToDate(),
976
946
  snapsDistance: {
977
- onSource: (snapsDistance === null || snapsDistance === void 0 ? void 0 : snapsDistance.snapsOnSourceOnly.map(s => s.hash)) ?? [],
978
- onTarget: (snapsDistance === null || snapsDistance === void 0 ? void 0 : snapsDistance.snapsOnTargetOnly.map(s => s.hash)) ?? [],
979
- common: snapsDistance === null || snapsDistance === void 0 || (_snapsDistance$common2 = snapsDistance.commonSnapBeforeDiverge) === null || _snapsDistance$common2 === void 0 ? void 0 : _snapsDistance$common2.hash
947
+ onSource: snapsDistance?.snapsOnSourceOnly.map(s => s.hash) ?? [],
948
+ onTarget: snapsDistance?.snapsOnTargetOnly.map(s => s.hash) ?? [],
949
+ common: snapsDistance?.commonSnapBeforeDiverge?.hash
980
950
  }
981
951
  };
982
952
  }
@@ -1036,14 +1006,13 @@ please create a new lane instead, which will include all components of this lane
1036
1006
  * it also fetches the original lane from the remote to make sure the data is up to date.
1037
1007
  */
1038
1008
  async listUpdatesFromForked(componentsList) {
1039
- var _this$workspace4;
1040
- const consumer = (_this$workspace4 = this.workspace) === null || _this$workspace4 === void 0 ? void 0 : _this$workspace4.consumer;
1009
+ const consumer = this.workspace?.consumer;
1041
1010
  if (!consumer) throw new Error(`unable to get listUpdatesFromForked outside of a workspace`);
1042
1011
  if (consumer.isOnMain()) {
1043
1012
  return [];
1044
1013
  }
1045
1014
  const lane = await consumer.getCurrentLaneObject();
1046
- const forkedFromLaneId = lane === null || lane === void 0 ? void 0 : lane.forkedFrom;
1015
+ const forkedFromLaneId = lane?.forkedFrom;
1047
1016
  if (!forkedFromLaneId) {
1048
1017
  return [];
1049
1018
  }
@@ -1081,8 +1050,7 @@ please create a new lane instead, which will include all components of this lane
1081
1050
  return (0, _lodash().compact)(results);
1082
1051
  }
1083
1052
  async getLaneDataOfDefaultLane() {
1084
- var _this$workspace5;
1085
- const consumer = (_this$workspace5 = this.workspace) === null || _this$workspace5 === void 0 ? void 0 : _this$workspace5.consumer;
1053
+ const consumer = this.workspace?.consumer;
1086
1054
  let bitIds = [];
1087
1055
  if (!consumer) {
1088
1056
  const scopeComponents = await this.scope.list();