publ-echo-test 0.0.91 → 0.0.93
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.
@@ -53,3 +53,7 @@ export declare const addBulkToTarget: (blockStructure: Block[], targetId: string
|
|
53
53
|
export declare const getBlockWorkDirPath: (blockStructure: Block[], blockId: string) => string | null;
|
54
54
|
export declare const getBlockIdByComponentId: (blockStructure: Block[], componentId: number) => string | null;
|
55
55
|
export declare const blockStructure: Block[];
|
56
|
+
export declare const mapComponentBlockIdsToBlockIds: (blockStructure: Block[]) => {
|
57
|
+
CB_ID: Record<number, string>;
|
58
|
+
BLOCK_ID: Record<string, number>;
|
59
|
+
};
|
@@ -414,3 +414,21 @@ export var blockStructure = [
|
|
414
414
|
]
|
415
415
|
}
|
416
416
|
];
|
417
|
+
export var mapComponentBlockIdsToBlockIds = function (blockStructure) {
|
418
|
+
var cbToBlockMap = {};
|
419
|
+
var blockToCbMap = {};
|
420
|
+
var traverse = function (blocks) {
|
421
|
+
for (var _i = 0, blocks_7 = blocks; _i < blocks_7.length; _i++) {
|
422
|
+
var block = blocks_7[_i];
|
423
|
+
if (block.type === 'COMPONENT_BLOCK') {
|
424
|
+
cbToBlockMap[block.componentBlockId] = block.blockId;
|
425
|
+
blockToCbMap[block.blockId] = block.componentBlockId;
|
426
|
+
}
|
427
|
+
if ('children' in block && block.children) {
|
428
|
+
traverse(block.children);
|
429
|
+
}
|
430
|
+
}
|
431
|
+
};
|
432
|
+
traverse(blockStructure);
|
433
|
+
return { CB_ID: cbToBlockMap, BLOCK_ID: blockToCbMap };
|
434
|
+
};
|