@teambit/snapping 1.0.507 → 1.0.508

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.
@@ -3,6 +3,7 @@ import { LegacyOnTagResult } from '@teambit/legacy.scope';
3
3
  import { Workspace, AutoTagResult } from '@teambit/workspace';
4
4
  import { ReleaseType } from 'semver';
5
5
  import { ComponentID, ComponentIdList } from '@teambit/component-id';
6
+ import { BuildStatus } from '@teambit/legacy.constants';
6
7
  import { Logger, LoggerMain } from '@teambit/logger';
7
8
  import { ConsumerComponent } from '@teambit/legacy.consumer-component';
8
9
  import { InsightsMain } from '@teambit/insights';
@@ -166,8 +167,20 @@ export declare class SnappingMain {
166
167
  version: Version;
167
168
  addedVersionStr: string;
168
169
  }>;
169
- _enrichComp(consumerComponent: ConsumerComponent, modifiedLog?: Log): Promise<ConsumerComponent>;
170
- _getObjectsToEnrichComp(consumerComponent: ConsumerComponent, modifiedLog?: Log): Promise<BitObject[]>;
170
+ /**
171
+ * for an existing component in the local scope, add the updated Version-object/artifacts to the repository
172
+ * so the next "persist()" call will save them to the filesystem
173
+ */
174
+ enrichComp(component: Component, modifiedLog?: Log): Promise<void>;
175
+ /**
176
+ * needed to be updated after the build-pipeline was running
177
+ */
178
+ setBuildStatus(component: Component, buildStatus: BuildStatus): void;
179
+ /**
180
+ * for an existing component in the local scope, update the Version object with the updated data from the
181
+ * consumer-component and return the objects that need to be saved in the filesystem
182
+ */
183
+ getObjectsToEnrichComp(component: Component, modifiedLog?: Log): Promise<BitObject[]>;
171
184
  private transformArtifactsFromVinylToSource;
172
185
  private loadComponentsForTagOrSnap;
173
186
  private throwForPendingImport;
@@ -1176,16 +1176,33 @@ another option, in case this dependency is not in main yet is to remove all refe
1176
1176
  addedVersionStr
1177
1177
  };
1178
1178
  }
1179
- async _enrichComp(consumerComponent, modifiedLog) {
1180
- const objects = await this._getObjectsToEnrichComp(consumerComponent, modifiedLog);
1179
+
1180
+ /**
1181
+ * for an existing component in the local scope, add the updated Version-object/artifacts to the repository
1182
+ * so the next "persist()" call will save them to the filesystem
1183
+ */
1184
+ async enrichComp(component, modifiedLog) {
1185
+ const objects = await this.getObjectsToEnrichComp(component, modifiedLog);
1181
1186
  objects.forEach(obj => this.objectsRepo.add(obj));
1182
- return consumerComponent;
1183
1187
  }
1184
- async _getObjectsToEnrichComp(consumerComponent, modifiedLog) {
1185
- const component = consumerComponent.modelComponent || (
1188
+
1189
+ /**
1190
+ * needed to be updated after the build-pipeline was running
1191
+ */
1192
+ setBuildStatus(component, buildStatus) {
1193
+ component.state._consumer.buildStatus = buildStatus;
1194
+ }
1195
+
1196
+ /**
1197
+ * for an existing component in the local scope, update the Version object with the updated data from the
1198
+ * consumer-component and return the objects that need to be saved in the filesystem
1199
+ */
1200
+ async getObjectsToEnrichComp(component, modifiedLog) {
1201
+ const consumerComponent = component.state._consumer;
1202
+ const modelComp = consumerComponent.modelComponent || (
1186
1203
  // @todo: fix the ts error here with "source"
1187
1204
  await this.scope.legacyScope.sources.findOrAddComponent(consumerComponent));
1188
- const version = await component.loadVersion(consumerComponent.id.version, this.objectsRepo, true);
1205
+ const version = await modelComp.loadVersion(consumerComponent.id.version, this.objectsRepo, true);
1189
1206
  if (modifiedLog) version.addModifiedLog(modifiedLog);
1190
1207
  const artifactFiles = (0, _component().getArtifactsFiles)(consumerComponent.extensions);
1191
1208
  const artifacts = this.transformArtifactsFromVinylToSource(artifactFiles);