@crombolo/transfer 0.17.0 → 0.18.0
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/package.json +3 -3
- package/src/check.ts +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crombolo/transfer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Content transfer for crombolo: bundles of content moved between environments.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Crombolo",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@crombolo/core": "0.
|
|
32
|
-
"@crombolo/data": "0.
|
|
31
|
+
"@crombolo/core": "0.18.0",
|
|
32
|
+
"@crombolo/data": "0.18.0"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/check.ts
CHANGED
|
@@ -256,6 +256,17 @@ export async function checkBundle(
|
|
|
256
256
|
const nodeState = { version: state.version, revision: state.revision }
|
|
257
257
|
const docs = new DocumentRepository(db, { nodeState })
|
|
258
258
|
const nodes = docs.nodes
|
|
259
|
+
// Each kind reads through its own repository, as the import writes it: a
|
|
260
|
+
// document repository reads an element or a media item back without values,
|
|
261
|
+
// which made every one in a reinstalled bundle look edited here.
|
|
262
|
+
const byKind = new Map<BundleNode['kind'], DocumentRepository>([['document', docs]])
|
|
263
|
+
const repoFor = (kind: BundleNode['kind']): DocumentRepository => {
|
|
264
|
+
const found = byKind.get(kind)
|
|
265
|
+
if (found) return found
|
|
266
|
+
const repo = new DocumentRepository(db, { nodeState, kind })
|
|
267
|
+
byKind.set(kind, repo)
|
|
268
|
+
return repo
|
|
269
|
+
}
|
|
259
270
|
const types = new ContentTypeRepository(db)
|
|
260
271
|
// Media types are a separate object type, so a repository reading document
|
|
261
272
|
// types cannot see one. A bundle names its types in one flat list, without
|
|
@@ -617,7 +628,7 @@ export async function checkBundle(
|
|
|
617
628
|
}
|
|
618
629
|
|
|
619
630
|
// What the bundle would actually change, property by property.
|
|
620
|
-
const current = await
|
|
631
|
+
const current = await repoFor(node.kind).byKey(node.key)
|
|
621
632
|
const currentByKey = new Map(
|
|
622
633
|
(current?.values ?? []).map((v) => [`${v.alias}|${v.culture ?? ''}|${v.segment ?? ''}`, v]),
|
|
623
634
|
)
|