publ-echo-test 0.0.82 → 0.0.83

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.
@@ -51,4 +51,5 @@ export declare const findParentGroupByGroupId: (blockStructure: Block[], targetI
51
51
  export declare const addBlockToRoot: (blockStructure: Block[], newBlock: Block) => Block[];
52
52
  export declare const addBulkToTarget: (blockStructure: Block[], targetId: string, bulkIds: string[]) => Block[];
53
53
  export declare const getBlockWorkDirPath: (blockStructure: Block[], blockId: string) => string | null;
54
+ export declare const getBlockIdByComponentId: (blockStructure: Block[], componentId: number) => string | null;
54
55
  export declare const blockStructure: Block[];
@@ -247,6 +247,24 @@ export var getBlockWorkDirPath = function (blockStructure, blockId) {
247
247
  var path = findPath(blockStructure, blockId, ['']);
248
248
  return path ? path.join('/') : null;
249
249
  };
250
+ export var getBlockIdByComponentId = function (blockStructure, componentId) {
251
+ var findBlock = function (blocks) {
252
+ for (var _i = 0, blocks_6 = blocks; _i < blocks_6.length; _i++) {
253
+ var block = blocks_6[_i];
254
+ if (block.type === 'COMPONENT_BLOCK' && block.componentBlockId === componentId) {
255
+ return block.blockId;
256
+ }
257
+ if ('children' in block && block.children) {
258
+ var result = findBlock(block.children);
259
+ if (result) {
260
+ return result;
261
+ }
262
+ }
263
+ }
264
+ return null;
265
+ };
266
+ return findBlock(blockStructure);
267
+ };
250
268
  export var blockStructure = [
251
269
  {
252
270
  blockId: 'ROOT',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.82",
3
+ "version": "0.0.83",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",