@teambit/objects 0.0.0-681e9601addeaf2a2be6fd1bff21f2631fcb5ea2 → 0.0.0-68390cc388612df2616d06e2ed57e2ab94fb35ad
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.
- package/dist/models/export-metadata.js +0 -2
- package/dist/models/export-metadata.js.map +1 -1
- package/dist/models/lane.d.ts +1 -1
- package/dist/models/model-component.d.ts +1 -1
- package/dist/models/model-component.js +0 -3
- package/dist/models/model-component.js.map +1 -1
- package/dist/models/scopeMeta.js +0 -3
- package/dist/models/scopeMeta.js.map +1 -1
- package/dist/models/source.d.ts +2 -2
- package/dist/models/source.js +0 -1
- package/dist/models/source.js.map +1 -1
- package/dist/models/symlink.d.ts +1 -1
- package/dist/models/version.d.ts +1 -1
- package/dist/models/version.js +0 -3
- package/dist/models/version.js.map +1 -1
- package/dist/objects/object.js +0 -1
- package/dist/objects/object.js.map +1 -1
- package/dist/objects/raw-object.d.ts +1 -1
- package/dist/objects/raw-object.js +1 -11
- package/dist/objects/raw-object.js.map +1 -1
- package/dist/objects/repository.d.ts +14 -0
- package/dist/objects/repository.js +32 -3
- package/dist/objects/repository.js.map +1 -1
- package/dist/objects/scope-index.js +0 -1
- package/dist/objects/scope-index.js.map +1 -1
- package/models/export-metadata.ts +0 -1
- package/models/model-component.ts +0 -4
- package/models/scopeMeta.ts +0 -2
- package/models/source.ts +0 -1
- package/models/version.ts +0 -6
- package/objects/object.ts +0 -1
- package/objects/raw-object.ts +1 -11
- package/objects/repository.ts +36 -3
- package/objects/scope-index.ts +0 -1
- package/package.json +35 -35
- /package/dist/{preview-1754934838968.js → preview-1755721121604.js} +0 -0
package/objects/raw-object.ts
CHANGED
|
@@ -8,7 +8,6 @@ export default class BitRawObject {
|
|
|
8
8
|
headers: string[];
|
|
9
9
|
type: string;
|
|
10
10
|
content: Buffer;
|
|
11
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
12
11
|
parsedContent: any;
|
|
13
12
|
_ref: string;
|
|
14
13
|
|
|
@@ -17,7 +16,6 @@ export default class BitRawObject {
|
|
|
17
16
|
ref: string | null | undefined,
|
|
18
17
|
type: string | null | undefined,
|
|
19
18
|
content: Buffer | null | undefined,
|
|
20
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
21
19
|
parsedContent: any | null | undefined
|
|
22
20
|
) {
|
|
23
21
|
let headers;
|
|
@@ -72,17 +70,14 @@ export default class BitRawObject {
|
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
72
|
|
|
75
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
76
73
|
set ref(ref: string) {
|
|
77
74
|
this._ref = ref;
|
|
78
75
|
}
|
|
79
76
|
|
|
80
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
81
77
|
get ref(): string {
|
|
82
78
|
return this._ref;
|
|
83
79
|
}
|
|
84
80
|
|
|
85
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
86
81
|
get id(): string {
|
|
87
82
|
switch (this.type) {
|
|
88
83
|
case 'Version':
|
|
@@ -114,11 +109,7 @@ export default class BitRawObject {
|
|
|
114
109
|
return [];
|
|
115
110
|
}
|
|
116
111
|
|
|
117
|
-
static async fromDeflatedBuffer(
|
|
118
|
-
fileContents: Buffer,
|
|
119
|
-
ref: string | null | undefined
|
|
120
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
121
|
-
): Promise<BitObject> {
|
|
112
|
+
static async fromDeflatedBuffer(fileContents: Buffer, ref: string | null | undefined): Promise<BitObject> {
|
|
122
113
|
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
123
114
|
return inflate(fileContents).then((buffer) => new BitRawObject(buffer, ref));
|
|
124
115
|
}
|
|
@@ -129,7 +120,6 @@ export default class BitRawObject {
|
|
|
129
120
|
* @param {Any} parsedContent
|
|
130
121
|
*/
|
|
131
122
|
toRealObject() {
|
|
132
|
-
// @ts-ignore
|
|
133
123
|
return types[this.type].from(this.parsedContent || this.getParsedContent(), this.headers[1]);
|
|
134
124
|
}
|
|
135
125
|
|
package/objects/repository.ts
CHANGED
|
@@ -32,7 +32,6 @@ const OBJECTS_BACKUP_DIR = `${OBJECTS_DIR}.bak`;
|
|
|
32
32
|
const TRASH_DIR = 'trash';
|
|
33
33
|
|
|
34
34
|
export default class Repository {
|
|
35
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
36
35
|
objects: { [key: string]: BitObject } = {};
|
|
37
36
|
objectsToRemove: Ref[] = [];
|
|
38
37
|
scopeJson: ScopeJson;
|
|
@@ -47,11 +46,31 @@ export default class Repository {
|
|
|
47
46
|
constructor(scopePath: string, scopeJson: ScopeJson) {
|
|
48
47
|
this.scopePath = scopePath;
|
|
49
48
|
this.scopeJson = scopeJson;
|
|
50
|
-
this.onRead =
|
|
51
|
-
this.onPersist =
|
|
49
|
+
this.onRead = this.onReadFunc();
|
|
50
|
+
this.onPersist = this.onPersistFunc();
|
|
52
51
|
this.cache = createInMemoryCache({ maxSize: getMaxSizeForObjects() });
|
|
53
52
|
}
|
|
54
53
|
|
|
54
|
+
onReadFunc(): ContentTransformer {
|
|
55
|
+
return (content: Buffer) => {
|
|
56
|
+
if (Repository.onPostObjectRead) {
|
|
57
|
+
return Repository.onPostObjectRead(content);
|
|
58
|
+
}
|
|
59
|
+
// for backward compatibility
|
|
60
|
+
return onRead(this.scopePath, this.scopeJson)(content);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
onPersistFunc(): ContentTransformer {
|
|
65
|
+
return (content: Buffer) => {
|
|
66
|
+
if (Repository.onPreObjectPersist) {
|
|
67
|
+
return Repository.onPreObjectPersist(content);
|
|
68
|
+
}
|
|
69
|
+
// for backward compatibility
|
|
70
|
+
return onPersist(this.scopePath, this.scopeJson)(content);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
55
74
|
get persistMutex() {
|
|
56
75
|
if (!this._persistMutex) {
|
|
57
76
|
this._persistMutex = new Mutex();
|
|
@@ -91,6 +110,20 @@ export default class Repository {
|
|
|
91
110
|
|
|
92
111
|
static onPostObjectsPersist: () => Promise<void>;
|
|
93
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Hook for transforming content before objects are persisted to the filesystem.
|
|
115
|
+
* Note: This function cannot be async because it's used by the synchronous `loadSync` method
|
|
116
|
+
* which needs to maintain sync behavior for compatibility with existing code.
|
|
117
|
+
*/
|
|
118
|
+
static onPreObjectPersist: (content: Buffer) => Buffer;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Hook for transforming content after objects are read from the filesystem.
|
|
122
|
+
* Note: This function cannot be async because it's used by the synchronous `loadSync` method
|
|
123
|
+
* which needs to maintain sync behavior for compatibility with existing code.
|
|
124
|
+
*/
|
|
125
|
+
static onPostObjectRead: (content: Buffer) => Buffer;
|
|
126
|
+
|
|
94
127
|
async reLoadScopeIndex() {
|
|
95
128
|
this.scopeIndex = await this.loadOptionallyCreateScopeIndex();
|
|
96
129
|
}
|
package/objects/scope-index.ts
CHANGED
|
@@ -111,7 +111,6 @@ export class ScopeIndex {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
getHashes(indexType: IndexType): string[] {
|
|
114
|
-
// @ts-ignore how to tell TS that all this.index.prop are array?
|
|
115
114
|
return this.index[indexType].map((indexItem: IndexItem) => indexItem.hash);
|
|
116
115
|
}
|
|
117
116
|
getHashesByQuery(indexType: IndexType, filter: Function): string[] {
|
package/package.json
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/objects",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-68390cc388612df2616d06e2ed57e2ab94fb35ad",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/scope/objects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.scope",
|
|
8
8
|
"name": "objects",
|
|
9
|
-
"version": "
|
|
9
|
+
"version": "68390cc388612df2616d06e2ed57e2ab94fb35ad"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@pnpm/dependency-path": "1001.1.0",
|
|
13
|
-
"@pnpm/lockfile.types": "^1002.0.0",
|
|
14
|
-
"semver": "7.7.1",
|
|
15
12
|
"lodash": "4.17.21",
|
|
16
|
-
"uuid": "8.3.2",
|
|
17
|
-
"async-mutex": "0.3.1",
|
|
18
|
-
"p-map-series": "2.1.0",
|
|
19
13
|
"tar-stream": "2.2.0",
|
|
14
|
+
"p-map-series": "2.1.0",
|
|
20
15
|
"is-relative-path": "2.0.0",
|
|
16
|
+
"async-mutex": "0.3.1",
|
|
21
17
|
"fs-extra": "10.0.0",
|
|
22
18
|
"uid-number": "0.0.6",
|
|
19
|
+
"@pnpm/dependency-path": "1001.1.0",
|
|
20
|
+
"@pnpm/lockfile.types": "^1002.0.0",
|
|
21
|
+
"semver": "7.7.1",
|
|
22
|
+
"uuid": "8.3.2",
|
|
23
23
|
"@teambit/harmony": "0.4.7",
|
|
24
|
+
"@teambit/cli": "0.0.1268",
|
|
24
25
|
"@teambit/component-id": "1.2.4",
|
|
25
|
-
"@teambit/
|
|
26
|
-
"@teambit/
|
|
26
|
+
"@teambit/component.snap-distance": "0.0.70",
|
|
27
|
+
"@teambit/graph.cleargraph": "0.0.11",
|
|
28
|
+
"@teambit/harmony.modules.concurrency": "0.0.16",
|
|
29
|
+
"@teambit/legacy.logger": "0.0.25",
|
|
30
|
+
"@teambit/legacy.scope": "0.0.69",
|
|
31
|
+
"@teambit/toolbox.promise.map-pool": "0.0.7",
|
|
32
|
+
"@teambit/legacy.constants": "0.0.15",
|
|
33
|
+
"@teambit/legacy.utils": "0.0.24",
|
|
34
|
+
"@teambit/toolbox.crypto.sha1": "0.0.8",
|
|
27
35
|
"@teambit/bit-error": "0.0.404",
|
|
28
36
|
"@teambit/component-version": "1.0.4",
|
|
29
|
-
"@teambit/
|
|
37
|
+
"@teambit/harmony.modules.in-memory-cache": "0.0.18",
|
|
38
|
+
"@teambit/toolbox.fs.remove-empty-dir": "0.0.6",
|
|
30
39
|
"@teambit/lane-id": "0.0.312",
|
|
31
|
-
"@teambit/
|
|
32
|
-
"@teambit/
|
|
33
|
-
"@teambit/legacy.
|
|
34
|
-
"@teambit/
|
|
35
|
-
"@teambit/toolbox.crypto.sha1": "0.0.7",
|
|
36
|
-
"@teambit/component.sources": "0.0.117",
|
|
40
|
+
"@teambit/harmony.modules.get-basic-log": "0.0.70",
|
|
41
|
+
"@teambit/config-store": "0.0.148",
|
|
42
|
+
"@teambit/legacy.cli.error": "0.0.25",
|
|
43
|
+
"@teambit/component.sources": "0.0.121",
|
|
37
44
|
"@teambit/legacy-bit-id": "1.1.3",
|
|
38
|
-
"@teambit/legacy-component-log": "0.0.
|
|
39
|
-
"@teambit/legacy.consumer-component": "0.0.
|
|
40
|
-
"@teambit/legacy.consumer-config": "0.0.
|
|
41
|
-
"@teambit/legacy.extension-data": "0.0.
|
|
42
|
-
"@teambit/pkg.modules.semver-helper": "0.0.
|
|
45
|
+
"@teambit/legacy-component-log": "0.0.409",
|
|
46
|
+
"@teambit/legacy.consumer-component": "0.0.70",
|
|
47
|
+
"@teambit/legacy.consumer-config": "0.0.69",
|
|
48
|
+
"@teambit/legacy.extension-data": "0.0.71",
|
|
49
|
+
"@teambit/pkg.modules.semver-helper": "0.0.14",
|
|
43
50
|
"@teambit/toolbox.array.duplications-finder": "0.0.3",
|
|
44
|
-
"@teambit/
|
|
45
|
-
"@teambit/
|
|
46
|
-
"@teambit/
|
|
47
|
-
"@teambit/harmony.modules.concurrency": "0.0.15",
|
|
48
|
-
"@teambit/toolbox.promise.map-pool": "0.0.6",
|
|
49
|
-
"@teambit/harmony.modules.in-memory-cache": "0.0.17",
|
|
50
|
-
"@teambit/toolbox.fs.remove-empty-dir": "0.0.5",
|
|
51
|
-
"@teambit/cli": "0.0.0-7a7c4fd57478a27c847e477d1053781a96e5bdc2",
|
|
52
|
-
"@teambit/config-store": "0.0.0-661bd28814fc60eabbca2ba8888f24997b5b9546",
|
|
53
|
-
"@teambit/graph": "0.0.0-323e59eb24bea3389f0adc3bbdb04697f34ef891"
|
|
51
|
+
"@teambit/bit.get-bit-version": "0.0.7",
|
|
52
|
+
"@teambit/semantics.doc-parser": "0.0.77",
|
|
53
|
+
"@teambit/graph": "0.0.0-9b5e9aaaea3e4e38c1808832b0a6b1bb33433ee9"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@types/semver": "7.5.8",
|
|
57
56
|
"@types/lodash": "4.14.165",
|
|
58
|
-
"@types/uuid": "8.3.4",
|
|
59
57
|
"@types/fs-extra": "9.0.7",
|
|
60
|
-
"@
|
|
58
|
+
"@types/semver": "7.5.8",
|
|
59
|
+
"@types/uuid": "8.3.4",
|
|
60
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.78"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"chai": "5.2.1",
|
|
File without changes
|