@teambit/objects 0.0.0-00042bc99514ea12d897f81bcd0181e2b034c615

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 (121) hide show
  1. package/dist/fixtures/version-model-extended.json +48 -0
  2. package/dist/fixtures/version-model-object.json +87 -0
  3. package/dist/index.d.ts +19 -0
  4. package/dist/index.js +371 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/models/dependencies-graph.d.ts +46 -0
  7. package/dist/models/dependencies-graph.js +105 -0
  8. package/dist/models/dependencies-graph.js.map +1 -0
  9. package/dist/models/detach-heads.d.ts +25 -0
  10. package/dist/models/detach-heads.js +84 -0
  11. package/dist/models/detach-heads.js.map +1 -0
  12. package/dist/models/export-metadata.d.ts +24 -0
  13. package/dist/models/export-metadata.js +74 -0
  14. package/dist/models/export-metadata.js.map +1 -0
  15. package/dist/models/index.d.ts +10 -0
  16. package/dist/models/index.js +125 -0
  17. package/dist/models/index.js.map +1 -0
  18. package/dist/models/lane-history.d.ts +43 -0
  19. package/dist/models/lane-history.js +131 -0
  20. package/dist/models/lane-history.js.map +1 -0
  21. package/dist/models/lane-history.spec.d.ts +1 -0
  22. package/dist/models/lane-history.spec.js +46 -0
  23. package/dist/models/lane-history.spec.js.map +1 -0
  24. package/dist/models/lane.d.ts +128 -0
  25. package/dist/models/lane.js +485 -0
  26. package/dist/models/lane.js.map +1 -0
  27. package/dist/models/model-component.d.ts +338 -0
  28. package/dist/models/model-component.js +1509 -0
  29. package/dist/models/model-component.js.map +1 -0
  30. package/dist/models/model-component.spec.d.ts +1 -0
  31. package/dist/models/model-component.spec.js +71 -0
  32. package/dist/models/model-component.spec.js.map +1 -0
  33. package/dist/models/scopeMeta.d.ts +20 -0
  34. package/dist/models/scopeMeta.js +68 -0
  35. package/dist/models/scopeMeta.js.map +1 -0
  36. package/dist/models/source.d.ts +10 -0
  37. package/dist/models/source.js +42 -0
  38. package/dist/models/source.js.map +1 -0
  39. package/dist/models/symlink.d.ts +30 -0
  40. package/dist/models/symlink.js +91 -0
  41. package/dist/models/symlink.js.map +1 -0
  42. package/dist/models/version-history.d.ts +59 -0
  43. package/dist/models/version-history.js +296 -0
  44. package/dist/models/version-history.js.map +1 -0
  45. package/dist/models/version.d.ts +288 -0
  46. package/dist/models/version.js +780 -0
  47. package/dist/models/version.js.map +1 -0
  48. package/dist/models/version.spec.d.ts +1 -0
  49. package/dist/models/version.spec.js +332 -0
  50. package/dist/models/version.spec.js.map +1 -0
  51. package/dist/objects/bit-object-list.d.ts +24 -0
  52. package/dist/objects/bit-object-list.js +65 -0
  53. package/dist/objects/bit-object-list.js.map +1 -0
  54. package/dist/objects/index.d.ts +5 -0
  55. package/dist/objects/index.js +60 -0
  56. package/dist/objects/index.js.map +1 -0
  57. package/dist/objects/object-list-to-graph.d.ts +13 -0
  58. package/dist/objects/object-list-to-graph.js +93 -0
  59. package/dist/objects/object-list-to-graph.js.map +1 -0
  60. package/dist/objects/object-list.d.ts +58 -0
  61. package/dist/objects/object-list.js +389 -0
  62. package/dist/objects/object-list.js.map +1 -0
  63. package/dist/objects/object.d.ts +35 -0
  64. package/dist/objects/object.js +189 -0
  65. package/dist/objects/object.js.map +1 -0
  66. package/dist/objects/objects-readable-generator.d.ts +31 -0
  67. package/dist/objects/objects-readable-generator.js +203 -0
  68. package/dist/objects/objects-readable-generator.js.map +1 -0
  69. package/dist/objects/raw-object.d.ts +23 -0
  70. package/dist/objects/raw-object.js +145 -0
  71. package/dist/objects/raw-object.js.map +1 -0
  72. package/dist/objects/ref.d.ts +14 -0
  73. package/dist/objects/ref.js +45 -0
  74. package/dist/objects/ref.js.map +1 -0
  75. package/dist/objects/repository.d.ts +165 -0
  76. package/dist/objects/repository.js +866 -0
  77. package/dist/objects/repository.js.map +1 -0
  78. package/dist/objects/scope-index.d.ts +74 -0
  79. package/dist/objects/scope-index.js +255 -0
  80. package/dist/objects/scope-index.js.map +1 -0
  81. package/dist/objects/scope-index.spec.d.ts +1 -0
  82. package/dist/objects/scope-index.spec.js +152 -0
  83. package/dist/objects/scope-index.spec.js.map +1 -0
  84. package/dist/objects.aspect.d.ts +2 -0
  85. package/dist/objects.aspect.js +18 -0
  86. package/dist/objects.aspect.js.map +1 -0
  87. package/dist/objects.main.runtime.d.ts +7 -0
  88. package/dist/objects.main.runtime.js +36 -0
  89. package/dist/objects.main.runtime.js.map +1 -0
  90. package/dist/preview-1781548568469.js +7 -0
  91. package/fixtures/version-model-extended.json +48 -0
  92. package/fixtures/version-model-object.json +87 -0
  93. package/models/dependencies-graph.ts +120 -0
  94. package/models/detach-heads.ts +79 -0
  95. package/models/export-metadata.ts +56 -0
  96. package/models/index.ts +11 -0
  97. package/models/lane-history.spec.ts +35 -0
  98. package/models/lane-history.ts +131 -0
  99. package/models/lane.ts +400 -0
  100. package/models/model-component.spec.ts +55 -0
  101. package/models/model-component.ts +1522 -0
  102. package/models/scopeMeta.ts +58 -0
  103. package/models/source.ts +31 -0
  104. package/models/symlink.ts +66 -0
  105. package/models/version-history.ts +283 -0
  106. package/models/version.spec.ts +280 -0
  107. package/models/version.ts +821 -0
  108. package/objects/bit-object-list.ts +59 -0
  109. package/objects/index.ts +6 -0
  110. package/objects/object-list-to-graph.ts +69 -0
  111. package/objects/object-list.ts +327 -0
  112. package/objects/object.ts +152 -0
  113. package/objects/objects-readable-generator.ts +174 -0
  114. package/objects/raw-object.ts +132 -0
  115. package/objects/ref.ts +45 -0
  116. package/objects/repository.ts +780 -0
  117. package/objects/scope-index.spec.ts +95 -0
  118. package/objects/scope-index.ts +197 -0
  119. package/package.json +97 -0
  120. package/types/asset.d.ts +41 -0
  121. package/types/style.d.ts +42 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_uuid","data","require","_semver","_lodash","_bitError","_componentId","_componentVersion","_laneId","_legacy","_legacyCli","_legacy2","_legacy3","_toolboxCrypto","_component","_objects","_configStore","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","OLD_LANE_SCHEMA","SCHEMA_INCLUDING_DELETED_COMPONENTS_DATA","CURRENT_LANE_SCHEMA","Lane","BitObject","constructor","props","name","scope","components","log","date","Date","now","toString","_hash","hash","readmeComponent","forkedFrom","schema","updateDependents","overrideUpdateDependents","id","LANE_REMOTE_DELIMITER","Error","Ref","changeName","hasChanged","changeScope","refs","map","c","head","validateBeforePersisting","str","logger","debug","lane","parse","validate","toObject","obj","pickBy","component","fullName","isDeleted","val","from","create","bitCloudUser","username","getConfig","CFG_USER_NAME_KEY","email","CFG_USER_EMAIL_KEY","profileImage","sha1","v4","isNew","contents","laneObject","JSON","ComponentID","fromObject","LaneId","fromString","toBuffer","pretty","args","getStringifyArgs","stringify","validateBeforePersist","Buffer","addComponent","existsComponent","getComponent","isEqual","Boolean","findUpdateDependent","componentId","find","isEqualWithoutVersion","getUpdateDependentAsLaneComponent","found","version","undefined","changeVersion","removeComponentFromUpdateDependentsIfExist","addComponentToUpdateDependents","hasVersion","ValidationError","removeAllUpdateDependents","setOverrideUpdateDependents","shouldOverrideUpdateDependents","removeComponent","getComponentHead","bitId","setLaneComponents","laneComponents","clone","setReadmeComponent","previousReadme","isFullyMerged","unmerged","getMergedAndUnmergedIds","merged","Promise","all","modelComponent","getModelComponentIfExist","startTraverseFrom","getHead","headExist","hasVersionByRef","objects","toBitIds","toComponentIds","ComponentIdList","fromArray","toComponentIdsIncludeUpdateDependents","concat","toLaneId","collectObjectsById","repo","headVersion","load","collect","includeDeletedData","gte","setSchemaToSupportDeletedData","setSchemaToNotSupportDeletedData","getCompHeadIncludeUpdateDependents","comp","message","bitIds","filterWithoutVersion","isSnap","toStringWithoutVersion","DEFAULT_LANE","BitError","PREVIOUS_DEFAULT_LANE","normalize","l","sort","a","b","localeCompare","thisUpdDeps","otherUpdDeps","cloneDeep","exports","default"],"sources":["lane.ts"],"sourcesContent":["import { v4 } from 'uuid';\nimport { gte } from 'semver';\nimport { cloneDeep, isEqual, pickBy } from 'lodash';\nimport { BitError } from '@teambit/bit-error';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { isSnap } from '@teambit/component-version';\nimport { LaneId, DEFAULT_LANE, LANE_REMOTE_DELIMITER } from '@teambit/lane-id';\nimport type { Scope } from '@teambit/legacy.scope';\nimport { CFG_USER_EMAIL_KEY, CFG_USER_NAME_KEY, PREVIOUS_DEFAULT_LANE } from '@teambit/legacy.constants';\nimport { ValidationError } from '@teambit/legacy.cli.error';\nimport { logger } from '@teambit/legacy.logger';\nimport { getStringifyArgs } from '@teambit/legacy.utils';\nimport { sha1 } from '@teambit/toolbox.crypto.sha1';\nimport { hasVersionByRef } from '@teambit/component.snap-distance';\nimport type { Repository } from '../objects';\nimport { BitObject, Ref } from '../objects';\nimport type Version from './version';\nimport { getConfig } from '@teambit/config-store';\n\nexport type Log = { date: string; username?: string; email?: string; profileImage?: string };\n\nexport type LaneProps = {\n name: string;\n scope: string;\n log: Log;\n components?: LaneComponent[];\n hash: string;\n schema?: string;\n readmeComponent?: LaneReadmeComponent;\n forkedFrom?: LaneId;\n updateDependents?: ComponentID[];\n overrideUpdateDependents?: boolean;\n};\n\nconst OLD_LANE_SCHEMA = '0.0.0';\nconst SCHEMA_INCLUDING_DELETED_COMPONENTS_DATA = '1.0.0';\nconst CURRENT_LANE_SCHEMA = SCHEMA_INCLUDING_DELETED_COMPONENTS_DATA;\n\nexport type LaneComponent = { id: ComponentID; head: Ref; isDeleted?: boolean };\nexport type LaneReadmeComponent = { id: ComponentID; head: Ref | null };\nexport default class Lane extends BitObject {\n name: string;\n scope: string;\n components: LaneComponent[];\n log: Log;\n schema: string;\n readmeComponent?: LaneReadmeComponent;\n forkedFrom?: LaneId;\n _hash: string; // reason for the underscore prefix is that we already have hash as a method\n isNew = false; // doesn't get saved in the object. only needed for in-memory instance\n hasChanged = false; // doesn't get saved in the object. only needed for in-memory instance\n /**\n * components that are dependents of components in the lane and need to be re-snapped against the\n * lane's heads. populated by the bare-scope cascade producer (UI \"snap updates\" / `bit _snap`)\n * and by `bit _merge-lane`. these entries are part of the lane's graph (Ripple CI builds them,\n * merge engine refreshes them) but are intentionally hidden from workspace-facing flows\n * (`bit status`, `bit compile`, `bit install`, the bitmap).\n */\n updateDependents?: ComponentID[];\n private overrideUpdateDependents?: boolean;\n constructor(props: LaneProps) {\n super();\n if (!props.name) throw new TypeError('Lane constructor expects to get a name parameter');\n this.name = props.name;\n this.scope = props.scope;\n this.components = props.components || [];\n this.log = props.log || { date: Date.now().toString() };\n this._hash = props.hash;\n this.readmeComponent = props.readmeComponent;\n this.forkedFrom = props.forkedFrom;\n this.schema = props.schema || OLD_LANE_SCHEMA;\n this.updateDependents = props.updateDependents;\n this.overrideUpdateDependents = props.overrideUpdateDependents;\n }\n id(): string {\n return this.scope + LANE_REMOTE_DELIMITER + this.name;\n }\n hash(): Ref {\n if (!this._hash) {\n throw new Error('hash is missing from a Lane object');\n }\n return new Ref(this._hash);\n }\n changeName(name: string) {\n this.name = name;\n this.hasChanged = true;\n }\n changeScope(scope: string) {\n this.scope = scope;\n this.hasChanged = true;\n }\n refs(): Ref[] {\n return this.components.map((c) => c.head);\n }\n validateBeforePersisting(str: string) {\n logger.debug(`validating lane object: ${this.hash().toString()} ${this.id()}`);\n const lane = Lane.parse(str, this.hash().toString());\n lane.validate();\n }\n toObject() {\n const obj = pickBy(\n {\n name: this.name,\n scope: this.scope,\n components: this.components.map((component) => ({\n id: { scope: component.id.scope, name: component.id.fullName },\n head: component.head.toString(),\n ...(component.isDeleted && { isDeleted: component.isDeleted }),\n })),\n log: this.log,\n readmeComponent: this.readmeComponent && {\n id: { scope: this.readmeComponent.id.scope, name: this.readmeComponent.id.fullName },\n head: this.readmeComponent.head?.toString() ?? null,\n },\n forkedFrom: this.forkedFrom && this.forkedFrom.toObject(),\n schema: this.schema,\n updateDependents: this.updateDependents?.map((c) => c.toString()),\n overrideUpdateDependents: this.overrideUpdateDependents,\n },\n (val) => !!val\n );\n return obj;\n }\n static from(props: LaneProps): Lane {\n return new Lane(props);\n }\n static create(\n name: string,\n scope: string,\n forkedFrom?: LaneId,\n bitCloudUser?: {\n username?: string;\n email?: string;\n profileImage?: string;\n }\n ) {\n const log = {\n date: Date.now().toString(),\n username: bitCloudUser?.username || getConfig(CFG_USER_NAME_KEY),\n email: bitCloudUser?.email || getConfig(CFG_USER_EMAIL_KEY),\n profileImage: bitCloudUser?.profileImage,\n };\n const lane = new Lane({ name, scope, hash: sha1(v4()), log, forkedFrom, schema: CURRENT_LANE_SCHEMA });\n lane.isNew = true;\n lane.hasChanged = true;\n return lane;\n }\n static parse(contents: string, hash: string): Lane {\n const laneObject = JSON.parse(contents);\n return Lane.from({\n name: laneObject.name,\n scope: laneObject.scope,\n log: laneObject.log,\n components: laneObject.components.map((component) => ({\n id: ComponentID.fromObject({ scope: component.id.scope, name: component.id.name }),\n head: new Ref(component.head),\n isDeleted: component.isDeleted,\n })),\n readmeComponent: laneObject.readmeComponent && {\n id: ComponentID.fromObject({\n scope: laneObject.readmeComponent.id.scope,\n name: laneObject.readmeComponent.id.name,\n }),\n head: laneObject.readmeComponent.head && new Ref(laneObject.readmeComponent.head),\n },\n forkedFrom: laneObject.forkedFrom && LaneId.from(laneObject.forkedFrom.name, laneObject.forkedFrom.scope),\n updateDependents: laneObject.updateDependents?.map((c) => ComponentID.fromString(c)),\n overrideUpdateDependents: laneObject.overrideUpdateDependents,\n hash: laneObject.hash || hash,\n schema: laneObject.schema,\n });\n }\n toBuffer(pretty?: boolean) {\n const args = getStringifyArgs(pretty);\n const obj = this.toObject();\n const str = JSON.stringify(obj, ...args);\n if (this.validateBeforePersist) this.validateBeforePersisting(str);\n return Buffer.from(str);\n }\n addComponent(component: LaneComponent) {\n const existsComponent = this.getComponent(component.id);\n if (existsComponent) {\n if (\n !existsComponent.head.isEqual(component.head) ||\n Boolean(existsComponent.isDeleted) !== Boolean(component.isDeleted)\n ) {\n this.hasChanged = true;\n }\n existsComponent.id = component.id;\n existsComponent.head = component.head;\n existsComponent.isDeleted = component.isDeleted;\n } else {\n logger.debug(`Lane.addComponent, adding component ${component.id.toString()} to lane ${this.id()}`);\n this.components.push(component);\n this.hasChanged = true;\n }\n }\n findUpdateDependent(componentId: ComponentID): ComponentID | undefined {\n return this.updateDependents?.find((c) => c.isEqualWithoutVersion(componentId));\n }\n getUpdateDependentAsLaneComponent(componentId: ComponentID): LaneComponent | undefined {\n const found = this.findUpdateDependent(componentId);\n if (!found?.version) return undefined;\n return { id: found.changeVersion(undefined), head: Ref.from(found.version) };\n }\n removeComponentFromUpdateDependentsIfExist(componentId: ComponentID) {\n if (!this.findUpdateDependent(componentId)) return;\n this.updateDependents = this.updateDependents?.filter((c) => !c.isEqualWithoutVersion(componentId));\n if (!this.updateDependents?.length) this.updateDependents = undefined;\n this.hasChanged = true;\n }\n addComponentToUpdateDependents(componentId: ComponentID) {\n if (!componentId.hasVersion()) {\n throw new ValidationError(`Lane.addComponentToUpdateDependents: ${componentId.toString()} is missing a version`);\n }\n this.removeComponentFromUpdateDependentsIfExist(componentId);\n (this.updateDependents ||= []).push(componentId);\n this.hasChanged = true;\n }\n removeAllUpdateDependents() {\n if (!this.updateDependents?.length) return;\n this.updateDependents = undefined;\n this.hasChanged = true;\n }\n /**\n * Signals an explicit `_snap --update-dependents` insertion. On export, the receiving scope\n * gates its \"add this new hidden entry\" branch on this flag so a stale workspace lane can't\n * resurrect entries the Cloud UI dropped. Workspace cascades — which only update existing\n * entries — deliberately do NOT set the flag. The field is also serialized by `Lane.toObject`\n * for older remotes that gate their pre-diverge-check override branch on it.\n */\n setOverrideUpdateDependents(overrideUpdateDependents: boolean) {\n this.overrideUpdateDependents = overrideUpdateDependents;\n this.hasChanged = true;\n }\n\n shouldOverrideUpdateDependents(): boolean {\n return Boolean(this.overrideUpdateDependents);\n }\n\n removeComponent(id: ComponentID): boolean {\n const existsComponent = this.getComponent(id);\n if (!existsComponent) return false;\n this.components = this.components.filter((c) => !c.id.isEqualWithoutVersion(id));\n this.hasChanged = true;\n return true;\n }\n getComponent(id: ComponentID): LaneComponent | undefined {\n return this.components.find((c) => c.id.isEqualWithoutVersion(id));\n }\n getComponentHead(bitId: ComponentID): Ref | null {\n const found = this.components.find((c) => c.id.isEqual(bitId));\n if (found) return found.head;\n return null;\n }\n setLaneComponents(laneComponents: LaneComponent[]) {\n // this gets called when adding lane-components from other lanes/remotes, so it's better to\n // clone the objects to not change the original data.\n this.components = laneComponents.map((c) => ({\n id: c.id.clone(),\n head: c.head.clone(),\n ...(c.isDeleted && { isDeleted: c.isDeleted }),\n }));\n this.hasChanged = true;\n }\n setReadmeComponent(id?: ComponentID) {\n const previousReadme = this.readmeComponent;\n if (!id) {\n this.readmeComponent = undefined;\n if (previousReadme) this.hasChanged = true;\n return;\n }\n const readmeComponent = this.getComponent(id);\n if (!readmeComponent) {\n this.readmeComponent = { id, head: null };\n } else {\n this.readmeComponent = readmeComponent;\n }\n if (\n !previousReadme ||\n !previousReadme.id.isEqual(id) ||\n previousReadme.head?.toString() !== this.readmeComponent.head?.toString()\n ) {\n this.hasChanged = true;\n }\n }\n\n async isFullyMerged(scope: Scope): Promise<boolean> {\n const { unmerged } = await this.getMergedAndUnmergedIds(scope);\n return unmerged.length === 0;\n }\n async getMergedAndUnmergedIds(scope: Scope): Promise<{ merged: ComponentID[]; unmerged: ComponentID[] }> {\n const merged: ComponentID[] = [];\n const unmerged: ComponentID[] = [];\n await Promise.all(\n this.components.map(async (component) => {\n const modelComponent = await scope.getModelComponentIfExist(component.id);\n if (!modelComponent) {\n unmerged.push(component.id);\n return;\n }\n const startTraverseFrom = modelComponent.getHead() || null; // it's important to have it as null and not as undefined, see hasVersionByRef\n const headExist = await hasVersionByRef(modelComponent, component.head, scope.objects, startTraverseFrom);\n if (headExist) merged.push(component.id);\n else unmerged.push(component.id);\n })\n );\n return { merged, unmerged };\n }\n /**\n * @deprecated use toComponentIds instead\n */\n toBitIds(): ComponentIdList {\n return this.toComponentIds();\n }\n toComponentIds(): ComponentIdList {\n return ComponentIdList.fromArray(this.components.map((c) => c.id.changeVersion(c.head.toString())));\n }\n toComponentIdsIncludeUpdateDependents(): ComponentIdList {\n return ComponentIdList.fromArray(this.toComponentIds().concat(this.updateDependents || []));\n }\n toLaneId() {\n return new LaneId({ scope: this.scope, name: this.name });\n }\n collectObjectsById(repo: Repository): Promise<Array<{ id: ComponentID; objects: BitObject[] }>> {\n return Promise.all(\n this.components.map(async (component) => {\n const headVersion = (await component.head.load(repo)) as Version;\n const objects = [headVersion, ...headVersion.collect(repo)];\n return { id: component.id, objects };\n })\n );\n }\n includeDeletedData(): boolean {\n return gte(this.schema, SCHEMA_INCLUDING_DELETED_COMPONENTS_DATA);\n }\n setSchemaToSupportDeletedData() {\n this.schema = SCHEMA_INCLUDING_DELETED_COMPONENTS_DATA;\n this.hasChanged = true;\n }\n setSchemaToNotSupportDeletedData() {\n this.schema = OLD_LANE_SCHEMA;\n this.hasChanged = true;\n }\n getCompHeadIncludeUpdateDependents(componentId: ComponentID): Ref | undefined {\n const comp = this.getComponent(componentId);\n if (comp) return comp.head;\n return this.getUpdateDependentAsLaneComponent(componentId)?.head;\n }\n validate() {\n const message = `unable to save Lane object \"${this.id()}\"`;\n const bitIds = this.toComponentIds();\n this.components.forEach((component) => {\n if (bitIds.filterWithoutVersion(component.id).length > 1) {\n throw new ValidationError(`${message}, the following component is duplicated \"${component.id.fullName}\"`);\n }\n if (!isSnap(component.head.hash)) {\n throw new ValidationError(\n `${message}, lane component ${component.id.toStringWithoutVersion()} head should be a hash, got ${\n component.head.hash\n }`\n );\n }\n });\n if (this.name === DEFAULT_LANE) {\n throw new BitError(`${message}, this name is reserved as the default lane`);\n }\n if (this.name === PREVIOUS_DEFAULT_LANE) {\n throw new BitError(`${message}, this name is reserved as the old default lane`);\n }\n }\n isEqual(lane: Lane): boolean {\n if (this.id() !== lane.id()) return false;\n // include isDeleted in equality so a soft-delete flip with the same head still counts as a\n // state change — `Lane.isEqual` is used by importers to decide whether to write a\n // LaneHistory entry.\n const normalize = (l: Lane) =>\n l.components\n .map((c) => ({\n id: c.id.toStringWithoutVersion(),\n head: c.head.toString(),\n isDeleted: Boolean(c.isDeleted),\n }))\n .sort((a, b) =>\n `${a.id}@${a.head}:${a.isDeleted ? 1 : 0}`.localeCompare(`${b.id}@${b.head}:${b.isDeleted ? 1 : 0}`)\n );\n const thisUpdDeps = (this.updateDependents || []).map((c) => c.toString()).sort();\n const otherUpdDeps = (lane.updateDependents || []).map((c) => c.toString()).sort();\n return isEqual(normalize(this), normalize(lane)) && isEqual(thisUpdDeps, otherUpdDeps);\n }\n clone() {\n return new Lane({\n ...this,\n hash: this._hash,\n overrideUpdateDependents: this.overrideUpdateDependents,\n components: cloneDeep(this.components),\n updateDependents: this.updateDependents ? cloneDeep(this.updateDependents) : undefined,\n });\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,YAAA,YAAAA,CAAA;I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AC,GAAGiE;IAAS,EACvF,CAAC;EACJ;AACF;AAACiE,OAAA,CAAAC,OAAA,GAAApJ,IAAA","ignoreList":[]}
@@ -0,0 +1,338 @@
1
+ import * as semver from 'semver';
2
+ import { LaneId } from '@teambit/lane-id';
3
+ import { ComponentID } from '@teambit/component-id';
4
+ import type { LegacyComponentLog } from '@teambit/legacy-component-log';
5
+ import { BitId } from '@teambit/legacy-bit-id';
6
+ import { ConsumerComponent } from '@teambit/legacy.consumer-component';
7
+ import type { SnapsDistance } from '@teambit/component.snap-distance';
8
+ import { ComponentObjects, ComponentVersion } from '@teambit/legacy.scope';
9
+ import type { Repository } from '../objects';
10
+ import { BitObject, Ref } from '../objects';
11
+ import type Lane from './lane';
12
+ import type Version from './version';
13
+ import type { VersionParents } from './version-history';
14
+ import VersionHistory from './version-history';
15
+ import type { ObjectItem } from '../objects/object-list';
16
+ import type { Scope } from '@teambit/legacy.scope';
17
+ import { DetachedHeads } from './detach-heads';
18
+ type State = {
19
+ versions?: {
20
+ [version: string]: {
21
+ local?: boolean;
22
+ };
23
+ };
24
+ };
25
+ export type AddVersionOpts = {
26
+ addToUpdateDependentsInLane?: boolean;
27
+ /**
28
+ * kind of rebase.
29
+ * if true, set the head as the parent of the new version.
30
+ * by default, the parent is the currently used version in .bitmap.
31
+ * (this prop takes affect only when the component is checked out to an older version)
32
+ */
33
+ setHeadAsParent?: boolean;
34
+ detachHead?: boolean;
35
+ overrideHead?: boolean;
36
+ };
37
+ type Versions = {
38
+ [version: string]: Ref;
39
+ };
40
+ export type ScopeListItem = {
41
+ url: string;
42
+ name: string;
43
+ date: string;
44
+ };
45
+ export type ComponentLog = LegacyComponentLog;
46
+ export type ComponentProps = {
47
+ scope: string;
48
+ name: string;
49
+ versions?: Versions;
50
+ orphanedVersions?: Versions;
51
+ lang: string;
52
+ deprecated: boolean;
53
+ bindingPrefix: string;
54
+ state?: State;
55
+ scopesList?: ScopeListItem[];
56
+ head?: Ref;
57
+ schema?: string | undefined;
58
+ detachedHeads?: DetachedHeads;
59
+ };
60
+ export declare const VERSION_ZERO = "0.0.0";
61
+ /**
62
+ * we can't rename the class as ModelComponent because old components are already saved in the model
63
+ * with 'Component' in their headers. see object-registrar.types()
64
+ */
65
+ export default class Component extends BitObject {
66
+ scope: string;
67
+ name: string;
68
+ versions: Versions;
69
+ orphanedVersions: Versions;
70
+ lang: string;
71
+ /**
72
+ * @deprecated moved to the Version object inside teambit/deprecation aspect
73
+ */
74
+ deprecated: boolean;
75
+ bindingPrefix: string;
76
+ /**
77
+ * @deprecated since 0.12.6 (long long ago :) probably can be removed)
78
+ */
79
+ local: boolean | null | undefined;
80
+ state: State;
81
+ scopesList: ScopeListItem[];
82
+ head?: Ref;
83
+ remoteHead?: Ref | null;
84
+ /**
85
+ * doesn't get saved in the scope, used to easier access the local snap head data
86
+ * when checked out to a lane, this prop is either Ref or null. otherwise (when on main), this prop is undefined.
87
+ */
88
+ laneHeadLocal?: Ref | null;
89
+ /**
90
+ * doesn't get saved in the scope, used to easier access the remote snap head data
91
+ * when checked out to a lane, this prop is either Ref or null. otherwise (when on main), this prop is undefined.
92
+ */
93
+ laneHeadRemote?: Ref | null;
94
+ /**
95
+ * when checked out to a lane, calculate what should be the head on the remote.
96
+ * if the laneHeadRemote is null, for example, when the lane is new, then used the the lane it was forked from.
97
+ * it no head is found on the lane/forked, then use the component.head.
98
+ */
99
+ calculatedRemoteHeadWhenOnLane?: Ref | null;
100
+ laneId?: LaneId;
101
+ laneDataIsPopulated: boolean;
102
+ schema: string | undefined;
103
+ detachedHeads: DetachedHeads;
104
+ private divergeData?;
105
+ private _populateVersionHistoryMutex?;
106
+ constructor(props: ComponentProps);
107
+ private get populateVersionHistoryMutex();
108
+ get versionArray(): Ref[];
109
+ setVersion(tag: string, ref: Ref): void;
110
+ setOrphanedVersion(tag: string, ref: Ref): void;
111
+ getRef(version: string): Ref | null;
112
+ getHeadStr(): string | null;
113
+ getHead(): Ref | undefined;
114
+ /**
115
+ * returns the head hash. regardless of whether current lane is the default or not.
116
+ * if on a lane, it returns the head of the component on the lane.
117
+ */
118
+ getHeadRegardlessOfLane(): Ref | undefined;
119
+ getHeadAsTagIfExist(): string | undefined;
120
+ hasHead(): boolean;
121
+ setHead(head: Ref | undefined): void;
122
+ listVersions(sort?: 'ASC' | 'DESC'): string[];
123
+ listVersionsIncludeOrphaned(sort?: 'ASC' | 'DESC'): string[];
124
+ hasVersion(version: string, repo: Repository, includeOrphaned?: boolean): Promise<boolean>;
125
+ hasTag(version: string): boolean;
126
+ get versionsIncludeOrphaned(): Versions;
127
+ hasTagIncludeOrphaned(version: string): boolean;
128
+ /**
129
+ * whether the head is a snap (not a tag)
130
+ */
131
+ isHeadSnap(): boolean | undefined;
132
+ /**
133
+ * add a new remote if it is not there already
134
+ */
135
+ addScopeListItem(scopeListItem: ScopeListItem): void;
136
+ /**
137
+ * on main - it checks local-head (or .bitmap version if given) vs remote-head.
138
+ * on lane - it checks local-head on lane vs remote-head on lane.
139
+ * however, to get an accurate `divergeData.snapsOnSourceOnly`, the above is not enough.
140
+ * for example, comp-a@snap-x from lane-a is merged into lane-b. we don't want this snap-x to be "local", because
141
+ * then, bit-status will show it as "staged" and bit-reset will remove it unexpectedly.
142
+ * if we only check by the local-head and remote-head on lane, it'll be local because the remote-head of lane-b is empty.
143
+ * to address this, we search all remote-refs files for this bit-id and during the local history traversal, if a hash
144
+ * is found there, it'll stop the traversal and not mark it as remote.
145
+ * in this example, during the merge, lane-a was fetched, and the remote-ref of this lane has snap-x as the head.
146
+ */
147
+ setDivergeData(repo: Repository, throws?: boolean, fromCache?: boolean, workspaceId?: ComponentID): Promise<void>;
148
+ isOnLane(): boolean;
149
+ /**
150
+ * this is used (among others) by `bit status` to check whether snaps are local (staged), for `bit reset` to remove them
151
+ * and for `bit export` to push them. for "merge pending" status, use `this.getDivergeDataForMergePending()`.
152
+ */
153
+ getDivergeData(): SnapsDistance;
154
+ /**
155
+ * don't use modelComponent.getDivergeData() because in some scenarios when on a lane, it compares the head
156
+ * on the lane against the head on the main, which could show the component as diverged incorrectly.
157
+ */
158
+ getDivergeDataForMergePending(repo: Repository): Promise<SnapsDistance>;
159
+ populateLocalAndRemoteHeads(repo: Repository, lane?: Lane): Promise<void>;
160
+ setLaneHeadLocal(lane?: Lane): void;
161
+ /**
162
+ * returns only the versions that exist in both components (regardless whether the hash are the same)
163
+ * e.g. this.component = [0.0.1, 0.0.2, 0.0.3], other component = [0.0.3, 0.0.4]. it returns only [0.0.3].
164
+ * also, in case it is coming from 'bit import', the version must be locally changed.
165
+ * otherwise, it doesn't matter whether the hashes are different.
166
+ */
167
+ _getComparableVersionsObjects(otherComponent: Component, // in case of merging, the otherComponent is the existing component, and "this" is the incoming component
168
+ local: boolean): {
169
+ thisComponentVersions: Versions;
170
+ otherComponentVersions: Versions;
171
+ };
172
+ compatibleWith(component: Component, local: boolean): boolean;
173
+ diffWith(component: Component, local: boolean): string[];
174
+ isEmpty(): boolean;
175
+ /**
176
+ * on main return main head, on lane, return lane head.
177
+ * if the head is also a tag, return the tag, otherwise, return the hash.
178
+ */
179
+ getHeadRegardlessOfLaneAsTagOrHash(returnVersionZeroForNoHead?: boolean): string;
180
+ /**
181
+ * get the recent head. if locally is ahead, return the local head. otherwise, return the remote head.
182
+ *
183
+ * a user can be checked out to a lane, in which case, `this.laneHeadLocal` and `this.laneHeadRemote`
184
+ * may be populated.
185
+ * `this.head` may not be populated, e.g. when a component was created on
186
+ * this lane and never got snapped on main.
187
+ * it's impossible that `this.head.isEqual(this.laneHeadLocal)`, because when snapping it's either
188
+ * on main, which goes to this.head OR on a lane, which goes to this.laneHeadLocal.
189
+ */
190
+ headIncludeRemote(repo: Repository): Promise<string>;
191
+ getRefOfAncestor(repo: Repository, generationsToGoBack: number): Promise<Ref>;
192
+ latestVersion(): string;
193
+ latestVersionIfExist(): string | undefined;
194
+ isLatestGreaterThan(version: string | null | undefined): boolean;
195
+ /**
196
+ * Return the lateset version which actuall exists in the scope
197
+ * (exists means the object itself exists)
198
+ * This relevant for cases when the component version array has few versions
199
+ * but we don't have all the refs in the object
200
+ *
201
+ * @returns {number}
202
+ * @memberof Component
203
+ */
204
+ latestExisting(repository: Repository): string;
205
+ /**
206
+ * get component log and sort by the timestamp in ascending order (from the earliest to the latest)
207
+ */
208
+ collectLogs(scope: Scope, shortHash?: boolean, startFrom?: Ref): Promise<ComponentLog[]>;
209
+ collectVersions(repo: Repository): Promise<ConsumerComponent[]>;
210
+ getTagOfRefIfExists(ref: Ref, allTags?: Versions): string | undefined;
211
+ getTag(version: string): string | undefined;
212
+ switchHashesWithTagsIfExist(refs: Ref[]): string[];
213
+ /**
214
+ * if exactVersion is defined, add exact version instead of using the semver mechanism
215
+ */
216
+ getVersionToAdd(releaseType?: semver.ReleaseType, exactVersion?: string | null, incrementBy?: number, preReleaseId?: string): string;
217
+ isEqual(component: Component, considerOrphanedVersions?: boolean): boolean;
218
+ addVersion(version: Version, versionToAdd: string, lane?: Lane, previouslyUsedVersion?: string, { addToUpdateDependentsInLane, setHeadAsParent, detachHead, overrideHead }?: AddVersionOpts): string;
219
+ version(releaseType?: semver.ReleaseType, incrementBy?: number, preReleaseId?: string): string;
220
+ id(): string;
221
+ /**
222
+ * @deprecated use toComponentId() instead
223
+ */
224
+ toBitId(): BitId;
225
+ toComponentId(): ComponentID;
226
+ /**
227
+ * @deprecated use toComponentIdWithLatestVersion() instead
228
+ */
229
+ toBitIdWithLatestVersion(): BitId;
230
+ toComponentIdWithLatestVersion(): ComponentID;
231
+ toComponentIdWithHead(): ComponentID;
232
+ toBitIdWithLatestVersionAllowNull(): ComponentID;
233
+ toObject(): {
234
+ name: string;
235
+ scope: string;
236
+ versions: {};
237
+ lang: string;
238
+ deprecated: boolean;
239
+ bindingPrefix: string;
240
+ remotes: ScopeListItem[];
241
+ schema: string | undefined;
242
+ detachedHeads: {
243
+ heads?: string[];
244
+ deleted?: string[];
245
+ current?: string;
246
+ } | undefined;
247
+ };
248
+ loadVersion(versionStr: string, repository: Repository, throws?: boolean): Promise<Version>;
249
+ loadVersionSync(version: string, repository: Repository, throws?: boolean): Version;
250
+ collectVersionsObjects(repo: Repository, versions: string[], throwForMissingLocalArtifacts?: boolean, workspaceId?: ComponentID): Promise<ObjectItem[]>;
251
+ collectObjects(repo: Repository): Promise<ComponentObjects>;
252
+ /**
253
+ * to delete a version from a component, don't call this method directly. Instead, use sources.removeVersion()
254
+ */
255
+ removeVersion(version: string): Ref;
256
+ toComponentVersion(versionStr?: string): ComponentVersion;
257
+ /**
258
+ * if no "specificVersion" is given, it returns according to the head
259
+ */
260
+ isDeprecated(repo: Repository, specificVersion?: string): Promise<boolean | null>;
261
+ /**
262
+ * whether the head is marked as internal. internal components are still versioned and exported,
263
+ * but are hidden by default in the UI (workspace, scope and Bit Cloud).
264
+ */
265
+ isInternal(repo: Repository): Promise<boolean | null>;
266
+ isRemoved(repo: Repository, specificVersion?: string): Promise<boolean | null>;
267
+ isLaneReadmeOf(repo: Repository): Promise<string[]>;
268
+ /**
269
+ * convert a ModelComponent of a specific version to ConsumerComponent
270
+ * @see sources.consumerComponentToVersion() for the opposite action.
271
+ */
272
+ toConsumerComponent(versionStr: string, scopeName: string, repository: Repository): Promise<ConsumerComponent>;
273
+ private addDepsInfoFromDepsResolver;
274
+ refs(): Ref[];
275
+ validateBeforePersisting(componentStr: string): void;
276
+ toBuffer(pretty: boolean): Buffer<ArrayBuffer>;
277
+ /**
278
+ * Clear data that is relevant only for the local scope and should not be moved to the remote scope
279
+ */
280
+ clearStateData(): void;
281
+ markVersionAsLocal(version: string): void;
282
+ /**
283
+ * local versions that are not exported on the main lane.
284
+ * @see `this.getLocalTagsOrHashes()`, to get local snaps on the current lane
285
+ */
286
+ getLocalVersions(): string[];
287
+ hasLocalTag(tag: string): boolean;
288
+ getLocalTagsOrHashes(repo: Repository, workspaceId?: ComponentID, lane?: Lane): Promise<string[]>;
289
+ /**
290
+ * Raw divergence (`snapsOnSourceOnly`). When `lane` is provided, applies the lean-lane filter:
291
+ * drops refs whose Version is main-origin. Those refs already live on the component's home
292
+ * scope (and on the destination too in the same-scope case), so `bit export` shouldn't be
293
+ * re-pushing them. Pass `lane` from status/export/reset to share the same "what's actually
294
+ * local on this lane" view.
295
+ *
296
+ * The lane's recorded head for this component is always kept, even if it's main-origin — the
297
+ * lane object references it and the destination scope must be able to resolve the hash. Versions
298
+ * marked `squashed` or `unrelated` are kept as well — they're locally-mutated and the
299
+ * destination needs them to reconstruct the lane history.
300
+ */
301
+ getLocalHashes(repo: Repository, workspaceId?: ComponentID, lane?: Lane): Promise<Ref[]>;
302
+ private filterLeanLaneRefs;
303
+ /**
304
+ * for most cases, use `isLocallyChanged`, which takes into account lanes.
305
+ * this is for cases when we only care about the versions exist in the `state` prop.
306
+ */
307
+ isLocallyChangedRegardlessOfLanes(): boolean;
308
+ /**
309
+ * whether the component was locally changed, either by adding a new snap/tag or by merging
310
+ * components from different lanes.
311
+ */
312
+ isLocallyChanged(repo: Repository, lane?: Lane | null, workspaceId?: ComponentID): Promise<boolean>;
313
+ getVersionHistory(repo: Repository): Promise<VersionHistory>;
314
+ getAndPopulateVersionHistory(repo: Repository, head: Ref): Promise<VersionHistory>;
315
+ /**
316
+ * careful! the `versions` passed here can belong to other components, not necessarily to this one.
317
+ * that's why it checks whether the version-hash exists in the VersionHistory, and if it's not,
318
+ * it won't update it.
319
+ */
320
+ updateRebasedVersionHistory(repo: Repository, versions: Version[]): Promise<VersionHistory | undefined>;
321
+ updateVersionHistory(repo: Repository, versions: Version[]): Promise<VersionHistory>;
322
+ populateVersionHistoryIfMissingGracefully(repo: Repository, versionHistory: VersionHistory, head: Ref,
323
+ /**
324
+ * during traversal, if a hash is found in the VersionHistory it probably means that it has all history until this
325
+ * point, so we can stop there for better performance. In some rare cases (e.g. the export was interrupted), we
326
+ * need the ability of full traversal to repair the VersionHistory.
327
+ */
328
+ exitWhenFind?: boolean): Promise<{
329
+ err?: Error;
330
+ added?: VersionParents[];
331
+ }>;
332
+ static parse(contents: string): Component;
333
+ static from(props: ComponentProps): Component;
334
+ static fromBitId(bitId: ComponentID): Component;
335
+ get isLegacy(): boolean;
336
+ validate(): void;
337
+ }
338
+ export {};