publ-echo-test 0.0.120 → 0.0.123

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.
@@ -46,7 +46,7 @@ export declare const findDirectChildrenCbIds: (block: Block, targetId: string) =
46
46
  export declare const findAllChildrenCbIds: (block: Block, targetId: string) => number[];
47
47
  export declare const findAllChildrenBlockIds: (block: Block, targetId: string) => string[];
48
48
  export declare const findDirectChildrenBlockIds: (block: Block, targetId: string) => string[];
49
- export declare const findGroupBlocks: (blockStructure: Block, targetId: string) => GroupBlock[];
49
+ export declare const findGroupBlocks: (block: Block, targetId: string) => GroupBlock[];
50
50
  export declare const addBulkToTarget: (block: Block, targetId: string, bulkBlockIds: string[]) => Block;
51
51
  export declare const getBlockWorkDirPath: (block: Block, blockId: string) => string | null;
52
52
  export declare function formatBlockIdToCbId(blockId: string): number | null;
@@ -98,36 +98,41 @@ export var findDirectChildrenBlockIds = function (block, targetId) {
98
98
  }
99
99
  return collectChildrenBlockIds(targetBlock, 'current');
100
100
  };
101
- export var findGroupBlocks = function (blockStructure, targetId) {
102
- var targetBlock = findBlockByBlockId(blockStructure, targetId);
103
- var groupBlocks = [];
104
- if (targetBlock && targetBlock.blockId === 'ROOT') {
105
- if ('children' in targetBlock) {
106
- groupBlocks.push.apply(groupBlocks, targetBlock.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; }));
107
- // Include BULK children if present
108
- var bulkBlocks = targetBlock.children.filter(function (child) { return child.blockId === 'BULK'; });
109
- bulkBlocks.forEach(function (bulk) {
110
- if ('children' in bulk && bulk.children) {
111
- groupBlocks.push.apply(groupBlocks, bulk.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; }));
112
- }
113
- });
114
- return groupBlocks;
115
- }
101
+ export var findGroupBlocks = function (block, targetId) {
102
+ var targetBlock = findBlockByBlockId(block, targetId);
103
+ // const groupBlocks: Set<GroupBlock> = new Set();
104
+ if (!targetBlock) {
105
+ console.error('Target block not found');
106
+ return [];
116
107
  }
117
- if (targetBlock && targetBlock.type === 'GROUP_BLOCK') {
118
- groupBlocks.push(targetBlock);
119
- if (targetBlock.children) {
120
- groupBlocks.push.apply(groupBlocks, targetBlock.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; }));
121
- // Include BULK children if present
122
- var bulkBlocks = targetBlock.children.filter(function (child) { return child.blockId === 'BULK'; });
123
- bulkBlocks.forEach(function (bulk) {
124
- if ('children' in bulk && bulk.children) {
125
- groupBlocks.push.apply(groupBlocks, bulk.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; }));
126
- }
127
- });
128
- }
108
+ // const addGroupBlocks = (block: GroupBlock | BulkBlockInternal) => {
109
+ // block.children.forEach(child => {
110
+ // if (child.type === 'GROUP_BLOCK') {
111
+ // groupBlocks.add(child as GroupBlock);
112
+ // }
113
+ // });
114
+ // };
115
+ if (targetBlock.type !== 'GROUP_BLOCK') {
116
+ console.error('Target block is not a group block');
117
+ return [];
129
118
  }
119
+ var groupBlocks = targetBlock.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; });
130
120
  return groupBlocks;
121
+ // if (targetBlock.blockId === 'ROOT') {
122
+ // addGroupBlocks(targetBlock as RootBlock);
123
+ // }
124
+ // if (targetBlock.type === 'GROUP_BLOCK') {
125
+ // groupBlocks.add(targetBlock as GroupBlock);
126
+ // addGroupBlocks(targetBlock);
127
+ // }
128
+ // // Handle BULK blocks
129
+ // if (targetBlock.type === 'GROUP_BLOCK') {
130
+ // const bulkBlocks = targetBlock.children.filter(child => child.blockId === 'BULK') as BulkBlockInternal[];
131
+ // bulkBlocks.forEach(bulk => {
132
+ // addGroupBlocks(bulk);
133
+ // });
134
+ // }
135
+ // return Array.from(groupBlocks); // Convert Set back to array
131
136
  };
132
137
  // export const findAllComponentBlockIds = (blockStructure: Block[]): number[] => {
133
138
  // const collectComponentBlockIds = (blocks: Block[]): number[] => {
@@ -221,8 +226,8 @@ var findPath = function (block, id, path) {
221
226
  if (child.blockId === id) {
222
227
  return currentPath;
223
228
  }
224
- if ('children' in block && block.children) {
225
- var result = findPath(block, id, currentPath);
229
+ if ('children' in child && child.children) {
230
+ var result = findPath(child, id, currentPath); // Pass the correct child block here
226
231
  if (result) {
227
232
  return result;
228
233
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.120",
3
+ "version": "0.0.123",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",