@teambit/component 1.0.106 → 1.0.108

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 (84) hide show
  1. package/aspect-entry.ts +73 -0
  2. package/aspect-list.ts +132 -0
  3. package/component-factory.ts +190 -0
  4. package/component-fs.ts +66 -0
  5. package/component-interface.ts +26 -0
  6. package/component-meta.ts +29 -0
  7. package/component.aspect.ts +9 -0
  8. package/component.graphql.ts +256 -0
  9. package/component.main.runtime.ts +170 -0
  10. package/component.route.ts +38 -0
  11. package/component.ts +319 -0
  12. package/config.ts +24 -0
  13. package/dist/aspect-entry.d.ts +4 -4
  14. package/dist/aspect-entry.js +1 -2
  15. package/dist/aspect-entry.js.map +1 -1
  16. package/dist/aspect-list.js +2 -2
  17. package/dist/aspect-list.js.map +1 -1
  18. package/dist/aspect.section.d.ts +3 -3
  19. package/dist/component-factory.d.ts +3 -3
  20. package/dist/component-interface.d.ts +1 -1
  21. package/dist/component-map/component-map.d.ts +2 -2
  22. package/dist/component.composition.d.ts +2 -2
  23. package/dist/component.d.ts +3 -3
  24. package/dist/component.graphql.d.ts +13 -13
  25. package/dist/component.graphql.js +3 -6
  26. package/dist/component.graphql.js.map +1 -1
  27. package/dist/component.js +5 -9
  28. package/dist/component.js.map +1 -1
  29. package/dist/component.main.runtime.d.ts +2 -2
  30. package/dist/component.route.d.ts +2 -2
  31. package/dist/component.ui.runtime.d.ts +7 -7
  32. package/dist/component.ui.runtime.js +12 -27
  33. package/dist/component.ui.runtime.js.map +1 -1
  34. package/dist/get-component-opts.d.ts +1 -1
  35. package/dist/hash.d.ts +1 -1
  36. package/dist/{preview-1703505948637.js → preview-1703647408454.js} +2 -2
  37. package/dist/snap/author.d.ts +1 -1
  38. package/dist/snap/snap.d.ts +1 -1
  39. package/dist/tag/tag.d.ts +1 -1
  40. package/dist/tag-map.d.ts +1 -1
  41. package/dist/ui/aspect-page/aspect-page.d.ts +2 -2
  42. package/dist/ui/aspect-page/aspect-page.js +1 -2
  43. package/dist/ui/aspect-page/aspect-page.js.map +1 -1
  44. package/dist/ui/component-error/component-error.d.ts +4 -4
  45. package/dist/ui/component-model/component-model.d.ts +21 -21
  46. package/dist/ui/component-model/component-model.js +1 -1
  47. package/dist/ui/component-model/component-model.js.map +1 -1
  48. package/dist/ui/component-searcher/component-result.d.ts +4 -4
  49. package/dist/ui/component-searcher/component-result.js +2 -2
  50. package/dist/ui/component-searcher/component-result.js.map +1 -1
  51. package/dist/ui/component-searcher/component-searcher.d.ts +2 -2
  52. package/dist/ui/component.d.ts +5 -5
  53. package/dist/ui/component.js +6 -6
  54. package/dist/ui/component.js.map +1 -1
  55. package/dist/ui/context/component-context.d.ts +1 -1
  56. package/dist/ui/context/component-provider.d.ts +5 -5
  57. package/dist/ui/menu/menu-nav.d.ts +2 -2
  58. package/dist/ui/menu/menu-nav.js +5 -5
  59. package/dist/ui/menu/menu-nav.js.map +1 -1
  60. package/dist/ui/menu/menu.d.ts +9 -9
  61. package/dist/ui/menu/menu.js +28 -31
  62. package/dist/ui/menu/menu.js.map +1 -1
  63. package/dist/ui/menu/nav-plugin.d.ts +7 -7
  64. package/dist/ui/top-bar-nav/top-bar-nav.d.ts +2 -2
  65. package/dist/ui/use-component-from-location.js +1 -1
  66. package/dist/ui/use-component-from-location.js.map +1 -1
  67. package/dist/ui/use-component-logs.d.ts +7 -7
  68. package/dist/ui/use-component-logs.js +5 -6
  69. package/dist/ui/use-component-logs.js.map +1 -1
  70. package/dist/ui/use-component-query.js +13 -17
  71. package/dist/ui/use-component-query.js.map +1 -1
  72. package/dist/ui/use-component.model.d.ts +7 -7
  73. package/get-component-opts.ts +14 -0
  74. package/hash.ts +4 -0
  75. package/head.ts +0 -0
  76. package/history-graph.ts +1 -0
  77. package/index.ts +50 -0
  78. package/on-load.ts +0 -0
  79. package/package.json +34 -41
  80. package/state.ts +88 -0
  81. package/store.ts +3 -0
  82. package/tag-map.ts +87 -0
  83. package/tsconfig.json +16 -21
  84. package/types/asset.d.ts +15 -3
package/component.ts ADDED
@@ -0,0 +1,319 @@
1
+ import { AnyFS } from '@teambit/any-fs';
2
+ import { capitalize } from '@teambit/toolbox.string.capitalize';
3
+ import { SemVer } from 'semver';
4
+ import { ComponentID } from '@teambit/component-id';
5
+ import { BitError } from '@teambit/bit-error';
6
+ import { BuildStatus } from '@teambit/legacy/dist/constants';
7
+
8
+ import { slice } from 'lodash';
9
+ import { ComponentFactory } from './component-factory';
10
+ import ComponentFS from './component-fs';
11
+ // import { NothingToSnap } from './exceptions';
12
+ import { Config as ComponentConfig } from './config';
13
+ // eslint-disable-next-line import/no-cycle
14
+ import { Snap } from './snap';
15
+ import { State } from './state';
16
+ import { TagMap } from './tag-map';
17
+ import { Tag } from './tag';
18
+ import { CouldNotFindLatest } from './exceptions';
19
+ import { IComponent, RawComponentMetadata } from './component-interface';
20
+ // import { Author } from './types';
21
+
22
+ type SnapsIterableOpts = {
23
+ firstParentOnly?: boolean;
24
+ stopFn?: (snap: Snap) => Promise<boolean>;
25
+ };
26
+
27
+ export type InvalidComponent = { id: ComponentID; err: Error };
28
+
29
+ /**
30
+ * in-memory representation of a component.
31
+ */
32
+ export class Component implements IComponent {
33
+ constructor(
34
+ /**
35
+ * component ID represented by the `ComponentId` type.
36
+ */
37
+ readonly id: ComponentID,
38
+
39
+ /**
40
+ * head version of the component. can be `null` for new components.
41
+ */
42
+ readonly head: Snap | null = null,
43
+
44
+ /**
45
+ * state of the component.
46
+ */
47
+ private _state: State,
48
+
49
+ /**
50
+ * tags of the component.
51
+ */
52
+ readonly tags: TagMap = new TagMap(),
53
+
54
+ /**
55
+ * the component factory
56
+ */
57
+ private factory: ComponentFactory
58
+ ) {}
59
+
60
+ get mainFile() {
61
+ return this.state.mainFile;
62
+ }
63
+
64
+ get state(): State {
65
+ return this._state;
66
+ }
67
+
68
+ set state(state: State) {
69
+ this._state = state;
70
+ }
71
+
72
+ /**
73
+ * component configuration which is later generated to a component `package.json` and `bit.json`.
74
+ */
75
+ get config(): ComponentConfig {
76
+ return this.state.config;
77
+ }
78
+
79
+ /**
80
+ * in-memory representation of the component current filesystem.
81
+ */
82
+ get filesystem(): ComponentFS {
83
+ return this.state.filesystem;
84
+ }
85
+
86
+ /**
87
+ * build status of the component
88
+ */
89
+ get buildStatus(): BuildStatus {
90
+ return this._state._consumer.buildStatus;
91
+ }
92
+
93
+ get headTag() {
94
+ if (!this.head) return undefined;
95
+ return this.tags.byHash(this.head.hash);
96
+ }
97
+
98
+ get latest(): string | undefined {
99
+ if (!this.head) return undefined;
100
+ try {
101
+ return this.tags.getLatest();
102
+ } catch (err: any) {
103
+ if (err instanceof CouldNotFindLatest) {
104
+ return this.head.hash;
105
+ }
106
+ throw err;
107
+ }
108
+ }
109
+
110
+ /**
111
+ * get aspect data from current state.
112
+ */
113
+ get(id: string): RawComponentMetadata | undefined {
114
+ return this.state.aspects.get(id)?.serialize();
115
+ }
116
+
117
+ async getLogs(filter?: { type?: string; offset?: number; limit?: number; head?: string; sort?: string }) {
118
+ const allLogs = await this.factory.getLogs(this.id, false, filter?.head);
119
+
120
+ if (!filter) return allLogs;
121
+
122
+ const { type, limit, offset, sort } = filter;
123
+
124
+ const typeFilter = (snap) => {
125
+ if (type === 'tag') return snap.tag;
126
+ if (type === 'snap') return !snap.tag;
127
+ return true;
128
+ };
129
+
130
+ let filteredLogs = (type && allLogs.filter(typeFilter)) || allLogs;
131
+ if (sort !== 'asc') filteredLogs = filteredLogs.reverse();
132
+
133
+ if (limit) {
134
+ filteredLogs = slice(filteredLogs, offset, limit + (offset || 0));
135
+ }
136
+
137
+ return filteredLogs;
138
+ }
139
+
140
+ stringify(): string {
141
+ return JSON.stringify({
142
+ id: this.id,
143
+ head: this.head,
144
+ });
145
+ }
146
+
147
+ /**
148
+ * record component changes in the `Scope`.
149
+ */
150
+ // snap(author: Author, message = '') {
151
+ // if (!this.isModified()) throw new NothingToSnap();
152
+ // const snap = new Snap(this, author, message);
153
+
154
+ // return new Component(this.id, snap, snap.state);
155
+ // }
156
+
157
+ /**
158
+ * display name of the component.
159
+ */
160
+ get displayName() {
161
+ const tokens = this.id.name.split('-').map((token) => capitalize(token));
162
+ return tokens.join(' ');
163
+ }
164
+
165
+ /**
166
+ * tag a component `Snap` with a semantic version. we follow SemVer specs as defined [here](https://semver.org/)).
167
+ */
168
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
169
+ tag(version: SemVer) {
170
+ // const snap = this.snap();
171
+ // const tag = new Tag(version, snap);
172
+ // this.tags.set(tag);
173
+ }
174
+
175
+ /**
176
+ * determines whether this component is modified in the workspace.
177
+ */
178
+ isModified(): Promise<boolean> {
179
+ return this.factory.isModified(this);
180
+ }
181
+
182
+ /**
183
+ * whether a component is marked as deleted.
184
+ */
185
+ isDeleted(): boolean {
186
+ return this.state._consumer.isRemoved();
187
+ }
188
+
189
+ /**
190
+ * is component isOutdated
191
+ */
192
+ isOutdated(): boolean {
193
+ if (!this.latest) return false;
194
+ const latestTag = this.tags.byVersion(this.latest);
195
+ if (!latestTag) return false;
196
+ if (this.head?.hash !== latestTag?.hash) return true;
197
+ return false;
198
+ }
199
+
200
+ /**
201
+ * determines whether this component is new.
202
+ */
203
+ isNew(): Promise<boolean> {
204
+ return Promise.resolve(this.head === null);
205
+ }
206
+
207
+ // TODO: @david after snap we need to make sure to refactor here.
208
+ loadState(snapId: string): Promise<State> {
209
+ return this.factory.getState(this.id, snapId);
210
+ }
211
+
212
+ loadSnap(snapId?: string): Promise<Snap> {
213
+ const snapToGet = snapId || this.head?.hash;
214
+ if (!snapToGet) {
215
+ throw new BitError('could not load snap for new components');
216
+ }
217
+ return this.factory.getSnap(this.id, snapToGet);
218
+ }
219
+
220
+ /**
221
+ * Get iterable which iterate over snap parents lazily
222
+ * @param snapId
223
+ * @param options
224
+ */
225
+ snapsIterable(snapId?: string, options: SnapsIterableOpts = {}): AsyncIterable<Snap> {
226
+ const snapToStart = snapId || this.head?.hash;
227
+ let nextSnaps = [snapToStart];
228
+ let done;
229
+ if (!snapToStart) {
230
+ done = true;
231
+ }
232
+
233
+ const iterator: AsyncIterator<Snap> = {
234
+ next: async () => {
235
+ if (done) {
236
+ return { value: undefined, done };
237
+ }
238
+ const currSnapId = nextSnaps.shift();
239
+ const snap = await this.loadSnap(currSnapId);
240
+ if (snap.parents && snap.parents.length) {
241
+ if (options.firstParentOnly) {
242
+ nextSnaps.push(snap.parents[0]);
243
+ } else {
244
+ nextSnaps = nextSnaps.concat(snap.parents);
245
+ }
246
+ }
247
+ if (!nextSnaps.length) {
248
+ done = true;
249
+ } else if (options.stopFn) {
250
+ done = await options.stopFn(snap);
251
+ }
252
+ return { value: snap, done: undefined };
253
+ },
254
+ };
255
+ return {
256
+ [Symbol.asyncIterator]: () => iterator,
257
+ };
258
+ }
259
+
260
+ /**
261
+ * traverse recursively from the provided snap (or head) upwards until it finds a tag
262
+ * @param snapToStartFrom
263
+ */
264
+ async getClosestTag(snapToStartFrom?: string): Promise<Tag | undefined> {
265
+ const tagsHashMap = this.tags.getHashMap();
266
+ const stopFn = async (snap: Snap) => {
267
+ if (tagsHashMap.has(snap.hash)) {
268
+ return true;
269
+ }
270
+ return false;
271
+ };
272
+ const iterable = this.snapsIterable(snapToStartFrom, { firstParentOnly: true, stopFn });
273
+ const snaps: Snap[] = [];
274
+ for await (const snap of iterable) {
275
+ snaps.push(snap);
276
+ }
277
+ if (snaps.length) {
278
+ const hashOfLastSnap = snaps[snaps.length - 1].hash;
279
+ return tagsHashMap.get(hashOfLastSnap);
280
+ }
281
+ return undefined;
282
+ }
283
+
284
+ /**
285
+ * checkout the component to a different version in its working tree.
286
+ */
287
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
288
+ checkout(version: SemVer) {}
289
+
290
+ /**
291
+ * examine difference between two components.
292
+ */
293
+ // diff(other: Component): Difference {}
294
+
295
+ /**
296
+ * merge two different components
297
+ */
298
+ // merge(other: Component): Component {}
299
+
300
+ /**
301
+ * write a component to a given file system.
302
+ * @param path root path to write the component
303
+ * @param fs instance of any fs to use.
304
+ */
305
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
306
+ write(path: string, fs?: AnyFS) {}
307
+
308
+ /**
309
+ *
310
+ * Check if 2 components are equal
311
+ * @param {Component} component
312
+ * @returns {boolean}
313
+ * @memberof Component
314
+ */
315
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
316
+ equals(component: Component): boolean {
317
+ return component.id.toString() === this.id.toString();
318
+ }
319
+ }
package/config.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
2
+ import { PathLinuxRelative, PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';
3
+
4
+ /**
5
+ * in-memory representation of the component configuration.
6
+ */
7
+ export class Config {
8
+ constructor(private consumerComponent: any) {}
9
+
10
+ /**
11
+ * component main file
12
+ * when loaded from the workspace, it's PathOsBasedRelative. otherwise, PathLinuxRelative.
13
+ */
14
+ get main(): PathLinuxRelative | PathOsBasedRelative {
15
+ return this.consumerComponent.mainFile;
16
+ }
17
+
18
+ /**
19
+ * configured extensions
20
+ */
21
+ get extensions(): ExtensionDataList {
22
+ return this.consumerComponent.extensions;
23
+ }
24
+ }
@@ -4,16 +4,16 @@
4
4
  import type { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';
5
5
  import { ComponentID } from '@teambit/component-id';
6
6
  import { RawComponentMetadata } from './component-interface';
7
- export declare type Serializable = {
7
+ export type Serializable = {
8
8
  toString(): string;
9
9
  };
10
- export declare type SerializableMap = {
10
+ export type SerializableMap = {
11
11
  [key: string]: Serializable;
12
12
  };
13
- export declare type AspectData = {
13
+ export type AspectData = {
14
14
  [key: string]: any;
15
15
  };
16
- export declare type ResolveComponentIdFunc = (id: string) => Promise<ComponentID>;
16
+ export type ResolveComponentIdFunc = (id: string) => Promise<ComponentID>;
17
17
  export declare class AspectEntry {
18
18
  id: ComponentID;
19
19
  private legacyEntry;
@@ -17,8 +17,7 @@ class AspectEntry {
17
17
  return this.legacyEntry;
18
18
  }
19
19
  get isLegacy() {
20
- var _this$config;
21
- if ((_this$config = this.config) !== null && _this$config !== void 0 && _this$config.__legacy) return true;
20
+ if (this.config?.__legacy) return true;
22
21
  return false;
23
22
  }
24
23
  get config() {
@@ -1 +1 @@
1
- {"version":3,"names":["AspectEntry","constructor","id","legacyEntry","legacy","isLegacy","_this$config","config","__legacy","data","isRemoved","val","transform","newData","newEntry","clone","serialize","toString","icon","exports"],"sources":["aspect-entry.ts"],"sourcesContent":["/**\n * avoid importing any (non-type) legacy code here. otherwise, PreviewTask will throw cryptic errors\n */\n\nimport type { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { ComponentID } from '@teambit/component-id';\nimport { RawComponentMetadata } from './component-interface';\n\nexport type Serializable = {\n toString(): string;\n};\n\nexport type SerializableMap = {\n [key: string]: Serializable;\n};\n\nexport type AspectData = {\n [key: string]: any;\n};\n\nexport type ResolveComponentIdFunc = (id: string) => Promise<ComponentID>;\nexport class AspectEntry {\n constructor(public id: ComponentID, private legacyEntry: ExtensionDataEntry) {}\n\n get legacy() {\n return this.legacyEntry;\n }\n\n get isLegacy(): boolean {\n if (this.config?.__legacy) return true;\n return false;\n }\n\n get config() {\n return this.legacy.config;\n }\n\n set config(config) {\n this.legacy.config = config;\n }\n\n get data(): { [key: string]: any } {\n return this.legacy.data;\n }\n\n get isRemoved(): boolean {\n return this.legacy.isRemoved;\n }\n\n // eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures\n set data(val: { [key: string]: any }) {\n this.legacy.data = val;\n }\n\n transform(newData: SerializableMap): AspectEntry {\n const newEntry = this.clone();\n newEntry.data = newData;\n return new AspectEntry(this.id, newEntry.legacy);\n }\n\n clone(): AspectEntry {\n return new AspectEntry(this.id, this.legacyEntry.clone());\n }\n\n serialize(): RawComponentMetadata {\n return {\n id: this.id.toString(),\n config: this.config,\n data: this.data,\n icon: 'https://static.bit.dev/extensions-icons/default.svg', // TODO @gilad - once you connect the icon here please use this url as the default icon\n };\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAmBO,MAAMA,WAAW,CAAC;EACvBC,WAAWA,CAAQC,EAAe,EAAUC,WAA+B,EAAE;IAAA,KAA1DD,EAAe,GAAfA,EAAe;IAAA,KAAUC,WAA+B,GAA/BA,WAA+B;EAAG;EAE9E,IAAIC,MAAMA,CAAA,EAAG;IACX,OAAO,IAAI,CAACD,WAAW;EACzB;EAEA,IAAIE,QAAQA,CAAA,EAAY;IAAA,IAAAC,YAAA;IACtB,KAAAA,YAAA,GAAI,IAAI,CAACC,MAAM,cAAAD,YAAA,eAAXA,YAAA,CAAaE,QAAQ,EAAE,OAAO,IAAI;IACtC,OAAO,KAAK;EACd;EAEA,IAAID,MAAMA,CAAA,EAAG;IACX,OAAO,IAAI,CAACH,MAAM,CAACG,MAAM;EAC3B;EAEA,IAAIA,MAAMA,CAACA,MAAM,EAAE;IACjB,IAAI,CAACH,MAAM,CAACG,MAAM,GAAGA,MAAM;EAC7B;EAEA,IAAIE,IAAIA,CAAA,EAA2B;IACjC,OAAO,IAAI,CAACL,MAAM,CAACK,IAAI;EACzB;EAEA,IAAIC,SAASA,CAAA,EAAY;IACvB,OAAO,IAAI,CAACN,MAAM,CAACM,SAAS;EAC9B;;EAEA;EACA,IAAID,IAAIA,CAACE,GAA2B,EAAE;IACpC,IAAI,CAACP,MAAM,CAACK,IAAI,GAAGE,GAAG;EACxB;EAEAC,SAASA,CAACC,OAAwB,EAAe;IAC/C,MAAMC,QAAQ,GAAG,IAAI,CAACC,KAAK,CAAC,CAAC;IAC7BD,QAAQ,CAACL,IAAI,GAAGI,OAAO;IACvB,OAAO,IAAIb,WAAW,CAAC,IAAI,CAACE,EAAE,EAAEY,QAAQ,CAACV,MAAM,CAAC;EAClD;EAEAW,KAAKA,CAAA,EAAgB;IACnB,OAAO,IAAIf,WAAW,CAAC,IAAI,CAACE,EAAE,EAAE,IAAI,CAACC,WAAW,CAACY,KAAK,CAAC,CAAC,CAAC;EAC3D;EAEAC,SAASA,CAAA,EAAyB;IAChC,OAAO;MACLd,EAAE,EAAE,IAAI,CAACA,EAAE,CAACe,QAAQ,CAAC,CAAC;MACtBV,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBE,IAAI,EAAE,IAAI,CAACA,IAAI;MACfS,IAAI,EAAE,qDAAqD,CAAE;IAC/D,CAAC;EACH;AACF;AAACC,OAAA,CAAAnB,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["AspectEntry","constructor","id","legacyEntry","legacy","isLegacy","config","__legacy","data","isRemoved","val","transform","newData","newEntry","clone","serialize","toString","icon","exports"],"sources":["aspect-entry.ts"],"sourcesContent":["/**\n * avoid importing any (non-type) legacy code here. otherwise, PreviewTask will throw cryptic errors\n */\n\nimport type { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { ComponentID } from '@teambit/component-id';\nimport { RawComponentMetadata } from './component-interface';\n\nexport type Serializable = {\n toString(): string;\n};\n\nexport type SerializableMap = {\n [key: string]: Serializable;\n};\n\nexport type AspectData = {\n [key: string]: any;\n};\n\nexport type ResolveComponentIdFunc = (id: string) => Promise<ComponentID>;\nexport class AspectEntry {\n constructor(public id: ComponentID, private legacyEntry: ExtensionDataEntry) {}\n\n get legacy() {\n return this.legacyEntry;\n }\n\n get isLegacy(): boolean {\n if (this.config?.__legacy) return true;\n return false;\n }\n\n get config() {\n return this.legacy.config;\n }\n\n set config(config) {\n this.legacy.config = config;\n }\n\n get data(): { [key: string]: any } {\n return this.legacy.data;\n }\n\n get isRemoved(): boolean {\n return this.legacy.isRemoved;\n }\n\n // eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures\n set data(val: { [key: string]: any }) {\n this.legacy.data = val;\n }\n\n transform(newData: SerializableMap): AspectEntry {\n const newEntry = this.clone();\n newEntry.data = newData;\n return new AspectEntry(this.id, newEntry.legacy);\n }\n\n clone(): AspectEntry {\n return new AspectEntry(this.id, this.legacyEntry.clone());\n }\n\n serialize(): RawComponentMetadata {\n return {\n id: this.id.toString(),\n config: this.config,\n data: this.data,\n icon: 'https://static.bit.dev/extensions-icons/default.svg', // TODO @gilad - once you connect the icon here please use this url as the default icon\n };\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAmBO,MAAMA,WAAW,CAAC;EACvBC,WAAWA,CAAQC,EAAe,EAAUC,WAA+B,EAAE;IAAA,KAA1DD,EAAe,GAAfA,EAAe;IAAA,KAAUC,WAA+B,GAA/BA,WAA+B;EAAG;EAE9E,IAAIC,MAAMA,CAAA,EAAG;IACX,OAAO,IAAI,CAACD,WAAW;EACzB;EAEA,IAAIE,QAAQA,CAAA,EAAY;IACtB,IAAI,IAAI,CAACC,MAAM,EAAEC,QAAQ,EAAE,OAAO,IAAI;IACtC,OAAO,KAAK;EACd;EAEA,IAAID,MAAMA,CAAA,EAAG;IACX,OAAO,IAAI,CAACF,MAAM,CAACE,MAAM;EAC3B;EAEA,IAAIA,MAAMA,CAACA,MAAM,EAAE;IACjB,IAAI,CAACF,MAAM,CAACE,MAAM,GAAGA,MAAM;EAC7B;EAEA,IAAIE,IAAIA,CAAA,EAA2B;IACjC,OAAO,IAAI,CAACJ,MAAM,CAACI,IAAI;EACzB;EAEA,IAAIC,SAASA,CAAA,EAAY;IACvB,OAAO,IAAI,CAACL,MAAM,CAACK,SAAS;EAC9B;;EAEA;EACA,IAAID,IAAIA,CAACE,GAA2B,EAAE;IACpC,IAAI,CAACN,MAAM,CAACI,IAAI,GAAGE,GAAG;EACxB;EAEAC,SAASA,CAACC,OAAwB,EAAe;IAC/C,MAAMC,QAAQ,GAAG,IAAI,CAACC,KAAK,CAAC,CAAC;IAC7BD,QAAQ,CAACL,IAAI,GAAGI,OAAO;IACvB,OAAO,IAAIZ,WAAW,CAAC,IAAI,CAACE,EAAE,EAAEW,QAAQ,CAACT,MAAM,CAAC;EAClD;EAEAU,KAAKA,CAAA,EAAgB;IACnB,OAAO,IAAId,WAAW,CAAC,IAAI,CAACE,EAAE,EAAE,IAAI,CAACC,WAAW,CAACW,KAAK,CAAC,CAAC,CAAC;EAC3D;EAEAC,SAASA,CAAA,EAAyB;IAChC,OAAO;MACLb,EAAE,EAAE,IAAI,CAACA,EAAE,CAACc,QAAQ,CAAC,CAAC;MACtBV,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBE,IAAI,EAAE,IAAI,CAACA,IAAI;MACfS,IAAI,EAAE,qDAAqD,CAAE;IAC/D,CAAC;EACH;AACF;AAACC,OAAA,CAAAlB,WAAA,GAAAA,WAAA"}
@@ -113,9 +113,9 @@ class AspectList {
113
113
  return serializedEntries;
114
114
  }
115
115
  filter(ids) {
116
- if (!(ids !== null && ids !== void 0 && ids.length)) return new AspectList(this.entries);
116
+ if (!ids?.length) return new AspectList(this.entries);
117
117
  const entries = this.entries.filter(aspectEntry => {
118
- return ids === null || ids === void 0 ? void 0 : ids.includes(aspectEntry.id.toStringWithoutVersion());
118
+ return ids?.includes(aspectEntry.id.toStringWithoutVersion());
119
119
  });
120
120
  return new AspectList(entries);
121
121
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_extensionData","data","require","_componentId","_aspectEntry","AspectList","constructor","entries","addEntry","aspectId","extensionDataEntry","ExtensionDataEntry","undefined","entry","AspectEntry","push","upsertEntry","existingEntry","find","id","isEqual","withoutEntries","aspectIds","filter","includes","legacy","stringId","ids","list","map","toString","get","toStringWithoutVersion","ignoreVersion","aspectEntry","predicate","pmap","entriesP","Promise","all","toConfigObject","res","forEach","config","removeInternalConfigFields","rawConfig","serialize","serializedEntries","length","toLegacy","legacyEntries","ExtensionDataList","fromArray","stringIds","clone","fromLegacyExtensions","legacyDataList","newEntries","getAspectId","exports","extensionId","name","ComponentID","fromString","Error"],"sources":["aspect-list.ts"],"sourcesContent":["import {\n ExtensionDataList,\n ExtensionDataEntry,\n removeInternalConfigFields,\n} from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { ComponentID } from '@teambit/component-id';\nimport { AspectEntry, SerializableMap } from './aspect-entry';\n\n/**\n * list of aspects, each may have data and artifacts saved per component.\n */\nexport class AspectList {\n constructor(readonly entries: AspectEntry[]) {}\n\n addEntry(aspectId: ComponentID, data: SerializableMap = {}) {\n const extensionDataEntry = new ExtensionDataEntry(undefined, aspectId, undefined, {}, data);\n const entry = new AspectEntry(aspectId, extensionDataEntry);\n this.entries.push(entry);\n return entry;\n }\n\n upsertEntry(aspectId: ComponentID, data: SerializableMap = {}) {\n const existingEntry = this.entries.find((entry) => entry.id.isEqual(aspectId));\n if (existingEntry) {\n existingEntry.data = data;\n return existingEntry;\n }\n return this.addEntry(aspectId, data);\n }\n\n /**\n * transform an aspect list into a new one without the given aspect ids\n */\n withoutEntries(aspectIds: string[]): AspectList {\n const entries = this.entries.filter((entry) => !aspectIds.includes(entry.legacy.stringId));\n return new AspectList(entries);\n }\n\n /**\n * get all ids as strings from the aspect list.\n */\n get ids(): string[] {\n const list = this.entries.map((entry) => entry.id.toString());\n return list;\n }\n\n /**\n * get an aspect from the list using a serialized ID.\n */\n get(id: string): AspectEntry | undefined {\n return this.entries.find((entry) => {\n return entry.legacy.stringId === id || entry.id.toStringWithoutVersion() === id;\n });\n }\n\n /**\n * find aspect by component ID.\n */\n find(id: ComponentID, ignoreVersion = false): AspectEntry | undefined {\n return this.entries.find((aspectEntry) => {\n return id.isEqual(aspectEntry.id, { ignoreVersion });\n });\n }\n\n /**\n * transform an aspect list into a new one.\n */\n map(predicate: (entry: AspectEntry) => AspectEntry) {\n const entries = this.entries.map(predicate);\n return new AspectList(entries);\n }\n\n /**\n * transform an aspect list into a new one.\n */\n async pmap(predicate: (entry: AspectEntry) => Promise<AspectEntry>) {\n const entriesP = this.entries.map(predicate);\n const entries = await Promise.all(entriesP);\n return new AspectList(entries);\n }\n\n toConfigObject() {\n const res = {};\n this.entries.forEach((entry) => {\n if (entry.config) {\n res[entry.id.toString()] = removeInternalConfigFields(entry.legacy.rawConfig);\n }\n });\n return res;\n }\n\n serialize() {\n const serializedEntries = this.entries.map((entry) => entry.serialize());\n return serializedEntries;\n }\n\n filter(ids?: string[]): AspectList {\n if (!ids?.length) return new AspectList(this.entries);\n const entries = this.entries.filter((aspectEntry) => {\n return ids?.includes(aspectEntry.id.toStringWithoutVersion());\n });\n return new AspectList(entries);\n }\n\n toLegacy(): ExtensionDataList {\n const legacyEntries = this.entries.map((entry) => entry.legacy);\n return ExtensionDataList.fromArray(legacyEntries);\n }\n\n stringIds(): string[] {\n const ids = this.entries.map((entry) => entry.id.toString());\n return ids;\n }\n\n clone(): AspectList {\n return new AspectList(this.entries.map((entry) => entry.clone()));\n }\n\n static fromLegacyExtensions(legacyDataList: ExtensionDataList): AspectList {\n const newEntries = legacyDataList.map((entry) => {\n return new AspectEntry(getAspectId(entry), entry);\n });\n\n return new AspectList(newEntries);\n }\n}\n\nfunction getAspectId(entry: ExtensionDataEntry) {\n if (!entry.extensionId && entry.name) return ComponentID.fromString(entry.name);\n if (entry.extensionId) return entry.extensionId;\n throw new Error('aspect cannot be loaded without setting an ID');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA;AACA;AACA;AACO,MAAMI,UAAU,CAAC;EACtBC,WAAWA,CAAUC,OAAsB,EAAE;IAAA,KAAxBA,OAAsB,GAAtBA,OAAsB;EAAG;EAE9CC,QAAQA,CAACC,QAAqB,EAAER,IAAqB,GAAG,CAAC,CAAC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C,EAAEA,KAAK,CAAC;IACnD,CAAC,CAAC;IAEF,OAAO,IAAIR,UAAU,CAACoD,UAAU,CAAC;EACnC;AACF;AAACE,OAAA,CAAAtD,UAAA,GAAAA,UAAA;AAED,SAASqD,WAAWA,CAAC7C,KAAyB,EAAE;EAC9C,IAAI,CAACA,KAAK,CAAC+C,WAAW,IAAI/C,KAAK,CAACgD,IAAI,EAAE,OAAOC,0BAAW,CAACC,UAAU,CAAClD,KAAK,CAACgD,IAAI,CAAC;EAC/E,IAAIhD,KAAK,CAAC+C,WAAW,EAAE,OAAO/C,KAAK,CAAC+C,WAAW;EAC/C,MAAM,IAAII,KAAK,CAAC,+CAA+C,CAAC;AAClE"}
1
+ {"version":3,"names":["_extensionData","data","require","_componentId","_aspectEntry","AspectList","constructor","entries","addEntry","aspectId","extensionDataEntry","ExtensionDataEntry","undefined","entry","AspectEntry","push","upsertEntry","existingEntry","find","id","isEqual","withoutEntries","aspectIds","filter","includes","legacy","stringId","ids","list","map","toString","get","toStringWithoutVersion","ignoreVersion","aspectEntry","predicate","pmap","entriesP","Promise","all","toConfigObject","res","forEach","config","removeInternalConfigFields","rawConfig","serialize","serializedEntries","length","toLegacy","legacyEntries","ExtensionDataList","fromArray","stringIds","clone","fromLegacyExtensions","legacyDataList","newEntries","getAspectId","exports","extensionId","name","ComponentID","fromString","Error"],"sources":["aspect-list.ts"],"sourcesContent":["import {\n ExtensionDataList,\n ExtensionDataEntry,\n removeInternalConfigFields,\n} from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { ComponentID } from '@teambit/component-id';\nimport { AspectEntry, SerializableMap } from './aspect-entry';\n\n/**\n * list of aspects, each may have data and artifacts saved per component.\n */\nexport class AspectList {\n constructor(readonly entries: AspectEntry[]) {}\n\n addEntry(aspectId: ComponentID, data: SerializableMap = {}) {\n const extensionDataEntry = new ExtensionDataEntry(undefined, aspectId, undefined, {}, data);\n const entry = new AspectEntry(aspectId, extensionDataEntry);\n this.entries.push(entry);\n return entry;\n }\n\n upsertEntry(aspectId: ComponentID, data: SerializableMap = {}) {\n const existingEntry = this.entries.find((entry) => entry.id.isEqual(aspectId));\n if (existingEntry) {\n existingEntry.data = data;\n return existingEntry;\n }\n return this.addEntry(aspectId, data);\n }\n\n /**\n * transform an aspect list into a new one without the given aspect ids\n */\n withoutEntries(aspectIds: string[]): AspectList {\n const entries = this.entries.filter((entry) => !aspectIds.includes(entry.legacy.stringId));\n return new AspectList(entries);\n }\n\n /**\n * get all ids as strings from the aspect list.\n */\n get ids(): string[] {\n const list = this.entries.map((entry) => entry.id.toString());\n return list;\n }\n\n /**\n * get an aspect from the list using a serialized ID.\n */\n get(id: string): AspectEntry | undefined {\n return this.entries.find((entry) => {\n return entry.legacy.stringId === id || entry.id.toStringWithoutVersion() === id;\n });\n }\n\n /**\n * find aspect by component ID.\n */\n find(id: ComponentID, ignoreVersion = false): AspectEntry | undefined {\n return this.entries.find((aspectEntry) => {\n return id.isEqual(aspectEntry.id, { ignoreVersion });\n });\n }\n\n /**\n * transform an aspect list into a new one.\n */\n map(predicate: (entry: AspectEntry) => AspectEntry) {\n const entries = this.entries.map(predicate);\n return new AspectList(entries);\n }\n\n /**\n * transform an aspect list into a new one.\n */\n async pmap(predicate: (entry: AspectEntry) => Promise<AspectEntry>) {\n const entriesP = this.entries.map(predicate);\n const entries = await Promise.all(entriesP);\n return new AspectList(entries);\n }\n\n toConfigObject() {\n const res = {};\n this.entries.forEach((entry) => {\n if (entry.config) {\n res[entry.id.toString()] = removeInternalConfigFields(entry.legacy.rawConfig);\n }\n });\n return res;\n }\n\n serialize() {\n const serializedEntries = this.entries.map((entry) => entry.serialize());\n return serializedEntries;\n }\n\n filter(ids?: string[]): AspectList {\n if (!ids?.length) return new AspectList(this.entries);\n const entries = this.entries.filter((aspectEntry) => {\n return ids?.includes(aspectEntry.id.toStringWithoutVersion());\n });\n return new AspectList(entries);\n }\n\n toLegacy(): ExtensionDataList {\n const legacyEntries = this.entries.map((entry) => entry.legacy);\n return ExtensionDataList.fromArray(legacyEntries);\n }\n\n stringIds(): string[] {\n const ids = this.entries.map((entry) => entry.id.toString());\n return ids;\n }\n\n clone(): AspectList {\n return new AspectList(this.entries.map((entry) => entry.clone()));\n }\n\n static fromLegacyExtensions(legacyDataList: ExtensionDataList): AspectList {\n const newEntries = legacyDataList.map((entry) => {\n return new AspectEntry(getAspectId(entry), entry);\n });\n\n return new AspectList(newEntries);\n }\n}\n\nfunction getAspectId(entry: ExtensionDataEntry) {\n if (!entry.extensionId && entry.name) return ComponentID.fromString(entry.name);\n if (entry.extensionId) return entry.extensionId;\n throw new Error('aspect cannot be loaded without setting an ID');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA;AACA;AACA;AACO,MAAMI,UAAU,CAAC;EACtBC,WAAWA,CAAUC,OAAsB,EAAE;IAAA,KAAxBA,OAAsB,GAAtBA,OAAsB;EAAG;EAE9CC,QAAQA,CAACC,QAAqB,EAAER,IAAqB,GAAG,CAAC,CAAC,EAAE;IAC1D,MAAMS,kBAAkB,GAAG,KAAIC,mCAAkB,EAACC,SAAS,EAAEH,QAAQ,EAAEG,SAAS,EAAE,CAAC,CAAC,EAAEX,IAAI,CAAC;IAC3F,MAAMY,KAAK,GAAG,KAAIC,0BAAW,EAACL,QAAQ,EAAEC,kBAAkB,CAAC;IAC3D,IAAI,CAACH,OAAO,CAACQ,IAAI,CAACF,KAAK,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AC/E,IAAIhD,KAAK,CAAC+C,WAAW,EAAE,OAAO/C,KAAK,CAAC+C,WAAW;EAC/C,MAAM,IAAII,KAAK,CAAC,+CAA+C,CAAC;AAClE"}
@@ -1,13 +1,13 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { Section } from './section';
3
3
  export declare class AspectSection implements Section {
4
4
  route: {
5
5
  path: string;
6
- element: React.JSX.Element;
6
+ element: JSX.Element;
7
7
  };
8
8
  navigationLink: {
9
9
  href: string;
10
- children: React.JSX.Element;
10
+ children: JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  order: number;
@@ -7,7 +7,7 @@ import type { AspectDefinition } from '@teambit/aspect-loader';
7
7
  import { Component, InvalidComponent } from './component';
8
8
  import { State } from './state';
9
9
  import { Snap } from './snap';
10
- export declare type ResolveAspectsOptions = FilterAspectsOptions & {
10
+ export type ResolveAspectsOptions = FilterAspectsOptions & {
11
11
  throwOnError?: boolean;
12
12
  useScopeAspectsCapsule?: boolean;
13
13
  workspaceName?: string;
@@ -15,13 +15,13 @@ export declare type ResolveAspectsOptions = FilterAspectsOptions & {
15
15
  resolveEnvsFromRoots?: boolean;
16
16
  packageManagerConfigRootDir?: string;
17
17
  };
18
- export declare type LoadAspectsOptions = {
18
+ export type LoadAspectsOptions = {
19
19
  throwOnError?: boolean;
20
20
  hideMissingModuleError?: boolean;
21
21
  ignoreErrors?: boolean;
22
22
  [key: string]: any;
23
23
  };
24
- export declare type FilterAspectsOptions = {
24
+ export type FilterAspectsOptions = {
25
25
  /**
26
26
  * Do not return results for the core aspects
27
27
  */
@@ -14,7 +14,7 @@ export interface IComponent {
14
14
  */
15
15
  isModified(): Promise<boolean>;
16
16
  }
17
- export declare type RawComponentMetadata = {
17
+ export type RawComponentMetadata = {
18
18
  id: string;
19
19
  config: Record<string, any>;
20
20
  data: Record<string, any>;
@@ -9,12 +9,12 @@ export declare class ComponentMap<T> {
9
9
  /**
10
10
  * @deprecated please use `get` instead
11
11
  */
12
- byComponent(component: Component): [Component, T] | undefined;
12
+ byComponent(component: Component): [Component, T];
13
13
  get components(): Component[];
14
14
  /**
15
15
  * get a value for a component.
16
16
  */
17
- get(component: Component): [Component, T] | undefined;
17
+ get(component: Component): [Component, T];
18
18
  /**
19
19
  * get a value by the component-id
20
20
  */
@@ -1,2 +1,2 @@
1
- import React from 'react';
2
- export declare const Logo: () => React.JSX.Element;
1
+ /// <reference types="react" />
2
+ export declare const Logo: () => JSX.Element;
@@ -10,11 +10,11 @@ import { State } from './state';
10
10
  import { TagMap } from './tag-map';
11
11
  import { Tag } from './tag';
12
12
  import { IComponent, RawComponentMetadata } from './component-interface';
13
- declare type SnapsIterableOpts = {
13
+ type SnapsIterableOpts = {
14
14
  firstParentOnly?: boolean;
15
15
  stopFn?: (snap: Snap) => Promise<boolean>;
16
16
  };
17
- export declare type InvalidComponent = {
17
+ export type InvalidComponent = {
18
18
  id: ComponentID;
19
19
  err: Error;
20
20
  };
@@ -78,7 +78,7 @@ export declare class Component implements IComponent {
78
78
  * build status of the component
79
79
  */
80
80
  get buildStatus(): BuildStatus;
81
- get headTag(): Tag | undefined;
81
+ get headTag(): Tag;
82
82
  get latest(): string | undefined;
83
83
  /**
84
84
  * get aspect data from current state.
@@ -12,7 +12,7 @@ export declare function componentSchema(componentExtension: ComponentMain): {
12
12
  log: (component: Component) => Promise<{
13
13
  date: number;
14
14
  email: string;
15
- username: string | undefined;
15
+ username: string;
16
16
  displayName: string;
17
17
  id: string;
18
18
  hash: string;
@@ -23,13 +23,13 @@ export declare function componentSchema(componentExtension: ComponentMain): {
23
23
  }>;
24
24
  getFile: (component: Component, { path }: {
25
25
  path: string;
26
- }) => string | undefined;
26
+ }) => string;
27
27
  mainFile: (component: Component) => any;
28
- headTag: (component: Component) => import(".").TagProps | undefined;
29
- latest: (component: Component) => string | undefined;
28
+ headTag: (component: Component) => import(".").TagProps;
29
+ latest: (component: Component) => string;
30
30
  tags: (component: any) => any;
31
31
  aspects: (component: Component, { include }: {
32
- include?: string[] | undefined;
32
+ include?: string[];
33
33
  }) => import("./component-interface").RawComponentMetadata[];
34
34
  logs: (component: Component, filter?: {
35
35
  type?: string;
@@ -41,21 +41,21 @@ export declare function componentSchema(componentExtension: ComponentMain): {
41
41
  }) => Promise<{
42
42
  id: string;
43
43
  message: string;
44
- username?: string | undefined;
45
- displayName?: string | undefined;
46
- email?: string | undefined;
47
- date?: string | undefined;
44
+ username?: string;
45
+ displayName?: string;
46
+ email?: string;
47
+ date?: string;
48
48
  hash: string;
49
- tag?: string | undefined;
49
+ tag?: string;
50
50
  parents: string[];
51
- profileImage?: string | undefined;
52
- onLane?: boolean | undefined;
51
+ profileImage?: string;
52
+ onLane?: boolean;
53
53
  }[]>;
54
54
  };
55
55
  ComponentHost: {
56
56
  get: (host: ComponentFactory, { id }: {
57
57
  id: string;
58
- }) => Promise<Component | null | undefined>;
58
+ }) => Promise<Component>;
59
59
  snaps: (host: ComponentFactory, { id }: {
60
60
  id: string;
61
61
  }) => Promise<import("@teambit/legacy-component-log").LegacyComponentLog[]>;
@@ -216,10 +216,7 @@ function componentSchema(componentExtension) {
216
216
  mainFile: component => {
217
217
  return component.state._consumer.mainFile;
218
218
  },
219
- headTag: component => {
220
- var _component$headTag;
221
- return (_component$headTag = component.headTag) === null || _component$headTag === void 0 ? void 0 : _component$headTag.toObject();
222
- },
219
+ headTag: component => component.headTag?.toObject(),
223
220
  latest: component => component.latest,
224
221
  tags: component => {
225
222
  // graphql doesn't support map types
@@ -231,8 +228,8 @@ function componentSchema(componentExtension) {
231
228
  return component.state.aspects.filter(include).serialize();
232
229
  },
233
230
  logs: async (component, filter) => {
234
- let head = filter === null || filter === void 0 ? void 0 : filter.head;
235
- if (!head && filter !== null && filter !== void 0 && filter.takeHeadFromComponent) {
231
+ let head = filter?.head;
232
+ if (!head && filter?.takeHeadFromComponent) {
236
233
  head = component.id.version;
237
234
  }
238
235
  const finalFilter = _objectSpread(_objectSpread({}, filter), {