@okf/ootils 1.3.5 → 1.3.6

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.
@@ -124,5 +124,31 @@ declare const extractAllBlocksFromTpl: ({ tpl, buildersWhitelist }: {
124
124
  tpl: Template;
125
125
  buildersWhitelist?: BuilderType[];
126
126
  }) => ExtractedBlock[];
127
+ /**
128
+ * Recursively extracts blocks from a hierarchical data structure.
129
+ *
130
+ * This is the core traversal function that handles nested sections and blocks.
131
+ * It preserves two critical pieces of metadata:
132
+ *
133
+ * 1. **sectionStack**: Array of parent sections - Essential for display condition handling.
134
+ * When sections have display conditions, we need to know which blocks belong to
135
+ * hidden sections to exclude them from indexes and processing.
136
+ *
137
+ * 2. **blockPath**: Dot-notation path to the block's location - Required for precise updates.
138
+ * Used when modifying block properties or updating valuePaths in display conditions.
139
+ * See 'modifyValuesAndValuePaths' for detailed usage.
140
+ *
141
+ * @param {Object} params - Extraction parameters
142
+ * @param {Block[]} params.data - Array of blocks/sections to process
143
+ * @param {Function} params.cb - Callback function to handle each extracted block
144
+ * @param {Section[]} params.sectionStack - Current stack of parent sections
145
+ * @param {string} params.blockPathPrefix - Current path prefix for building blockPath
146
+ */
147
+ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }: {
148
+ data: Block[];
149
+ cb: (block: ExtractedBlock) => void;
150
+ sectionStack?: Section[];
151
+ blockPathPrefix?: string;
152
+ }) => void;
127
153
 
128
- export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, setVal, toArray };
154
+ export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
package/dist/browser.d.ts CHANGED
@@ -124,5 +124,31 @@ declare const extractAllBlocksFromTpl: ({ tpl, buildersWhitelist }: {
124
124
  tpl: Template;
125
125
  buildersWhitelist?: BuilderType[];
126
126
  }) => ExtractedBlock[];
127
+ /**
128
+ * Recursively extracts blocks from a hierarchical data structure.
129
+ *
130
+ * This is the core traversal function that handles nested sections and blocks.
131
+ * It preserves two critical pieces of metadata:
132
+ *
133
+ * 1. **sectionStack**: Array of parent sections - Essential for display condition handling.
134
+ * When sections have display conditions, we need to know which blocks belong to
135
+ * hidden sections to exclude them from indexes and processing.
136
+ *
137
+ * 2. **blockPath**: Dot-notation path to the block's location - Required for precise updates.
138
+ * Used when modifying block properties or updating valuePaths in display conditions.
139
+ * See 'modifyValuesAndValuePaths' for detailed usage.
140
+ *
141
+ * @param {Object} params - Extraction parameters
142
+ * @param {Block[]} params.data - Array of blocks/sections to process
143
+ * @param {Function} params.cb - Callback function to handle each extracted block
144
+ * @param {Section[]} params.sectionStack - Current stack of parent sections
145
+ * @param {string} params.blockPathPrefix - Current path prefix for building blockPath
146
+ */
147
+ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }: {
148
+ data: Block[];
149
+ cb: (block: ExtractedBlock) => void;
150
+ sectionStack?: Section[];
151
+ blockPathPrefix?: string;
152
+ }) => void;
127
153
 
128
- export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, setVal, toArray };
154
+ export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
package/dist/browser.js CHANGED
@@ -24,6 +24,7 @@ __export(browser_exports, {
24
24
  extractAllBlocksFromTpl: () => extractAllBlocksFromTpl,
25
25
  genTagId: () => genTagId,
26
26
  getVal: () => getVal,
27
+ recursivelyExtractBlocks: () => _recursExtractBlocks,
27
28
  setVal: () => setVal,
28
29
  toArray: () => toArray
29
30
  });
@@ -309,6 +310,7 @@ var _extractBlocksFromSomeBuilders = ({
309
310
  extractAllBlocksFromTpl,
310
311
  genTagId,
311
312
  getVal,
313
+ recursivelyExtractBlocks,
312
314
  setVal,
313
315
  toArray
314
316
  });
package/dist/browser.mjs CHANGED
@@ -277,6 +277,7 @@ export {
277
277
  extractAllBlocksFromTpl,
278
278
  genTagId,
279
279
  getVal,
280
+ _recursExtractBlocks as recursivelyExtractBlocks,
280
281
  setVal,
281
282
  toArray
282
283
  };
package/dist/node.d.mts CHANGED
@@ -127,6 +127,32 @@ declare const extractAllBlocksFromTpl: ({ tpl, buildersWhitelist }: {
127
127
  tpl: Template$1;
128
128
  buildersWhitelist?: BuilderType[];
129
129
  }) => ExtractedBlock[];
130
+ /**
131
+ * Recursively extracts blocks from a hierarchical data structure.
132
+ *
133
+ * This is the core traversal function that handles nested sections and blocks.
134
+ * It preserves two critical pieces of metadata:
135
+ *
136
+ * 1. **sectionStack**: Array of parent sections - Essential for display condition handling.
137
+ * When sections have display conditions, we need to know which blocks belong to
138
+ * hidden sections to exclude them from indexes and processing.
139
+ *
140
+ * 2. **blockPath**: Dot-notation path to the block's location - Required for precise updates.
141
+ * Used when modifying block properties or updating valuePaths in display conditions.
142
+ * See 'modifyValuesAndValuePaths' for detailed usage.
143
+ *
144
+ * @param {Object} params - Extraction parameters
145
+ * @param {Block[]} params.data - Array of blocks/sections to process
146
+ * @param {Function} params.cb - Callback function to handle each extracted block
147
+ * @param {Section[]} params.sectionStack - Current stack of parent sections
148
+ * @param {string} params.blockPathPrefix - Current path prefix for building blockPath
149
+ */
150
+ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }: {
151
+ data: Block[];
152
+ cb: (block: ExtractedBlock) => void;
153
+ sectionStack?: Section[];
154
+ blockPathPrefix?: string;
155
+ }) => void;
130
156
 
131
157
  interface DbConnections {
132
158
  [clusterName: string]: Connection;
@@ -269,4 +295,4 @@ declare const getAIConfigs: ({ tenant }: GetAIConfigsParams) => Promise<AIconfig
269
295
  declare const connectToRedis: () => Promise<void>;
270
296
  declare const getRedisClient: () => IORedis;
271
297
 
272
- export { connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIConfigs, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getRedisClient, getTpl, getTplModelByTenant, getVal, initializeGlobalConfig, multiConnectToMongoDB, setVal, toArray, updateGlobalConfig };
298
+ export { connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIConfigs, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getRedisClient, getTpl, getTplModelByTenant, getVal, initializeGlobalConfig, multiConnectToMongoDB, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray, updateGlobalConfig };
package/dist/node.d.ts CHANGED
@@ -127,6 +127,32 @@ declare const extractAllBlocksFromTpl: ({ tpl, buildersWhitelist }: {
127
127
  tpl: Template$1;
128
128
  buildersWhitelist?: BuilderType[];
129
129
  }) => ExtractedBlock[];
130
+ /**
131
+ * Recursively extracts blocks from a hierarchical data structure.
132
+ *
133
+ * This is the core traversal function that handles nested sections and blocks.
134
+ * It preserves two critical pieces of metadata:
135
+ *
136
+ * 1. **sectionStack**: Array of parent sections - Essential for display condition handling.
137
+ * When sections have display conditions, we need to know which blocks belong to
138
+ * hidden sections to exclude them from indexes and processing.
139
+ *
140
+ * 2. **blockPath**: Dot-notation path to the block's location - Required for precise updates.
141
+ * Used when modifying block properties or updating valuePaths in display conditions.
142
+ * See 'modifyValuesAndValuePaths' for detailed usage.
143
+ *
144
+ * @param {Object} params - Extraction parameters
145
+ * @param {Block[]} params.data - Array of blocks/sections to process
146
+ * @param {Function} params.cb - Callback function to handle each extracted block
147
+ * @param {Section[]} params.sectionStack - Current stack of parent sections
148
+ * @param {string} params.blockPathPrefix - Current path prefix for building blockPath
149
+ */
150
+ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }: {
151
+ data: Block[];
152
+ cb: (block: ExtractedBlock) => void;
153
+ sectionStack?: Section[];
154
+ blockPathPrefix?: string;
155
+ }) => void;
130
156
 
131
157
  interface DbConnections {
132
158
  [clusterName: string]: Connection;
@@ -269,4 +295,4 @@ declare const getAIConfigs: ({ tenant }: GetAIConfigsParams) => Promise<AIconfig
269
295
  declare const connectToRedis: () => Promise<void>;
270
296
  declare const getRedisClient: () => IORedis;
271
297
 
272
- export { connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIConfigs, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getRedisClient, getTpl, getTplModelByTenant, getVal, initializeGlobalConfig, multiConnectToMongoDB, setVal, toArray, updateGlobalConfig };
298
+ export { connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIConfigs, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getRedisClient, getTpl, getTplModelByTenant, getVal, initializeGlobalConfig, multiConnectToMongoDB, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray, updateGlobalConfig };
package/dist/node.js CHANGED
@@ -332,6 +332,7 @@ __export(node_exports, {
332
332
  getVal: () => getVal,
333
333
  initializeGlobalConfig: () => initializeGlobalConfig,
334
334
  multiConnectToMongoDB: () => multiConnectToMongoDB,
335
+ recursivelyExtractBlocks: () => _recursExtractBlocks,
335
336
  setVal: () => setVal,
336
337
  toArray: () => toArray,
337
338
  updateGlobalConfig: () => updateGlobalConfig
@@ -872,6 +873,7 @@ var getAIConfigs = async ({
872
873
  getVal,
873
874
  initializeGlobalConfig,
874
875
  multiConnectToMongoDB,
876
+ recursivelyExtractBlocks,
875
877
  setVal,
876
878
  toArray,
877
879
  updateGlobalConfig
package/dist/node.mjs CHANGED
@@ -826,6 +826,7 @@ export {
826
826
  getVal,
827
827
  initializeGlobalConfig,
828
828
  multiConnectToMongoDB,
829
+ _recursExtractBlocks as recursivelyExtractBlocks,
829
830
  setVal,
830
831
  toArray,
831
832
  updateGlobalConfig
@@ -124,5 +124,31 @@ declare const extractAllBlocksFromTpl: ({ tpl, buildersWhitelist }: {
124
124
  tpl: Template;
125
125
  buildersWhitelist?: BuilderType[];
126
126
  }) => ExtractedBlock[];
127
+ /**
128
+ * Recursively extracts blocks from a hierarchical data structure.
129
+ *
130
+ * This is the core traversal function that handles nested sections and blocks.
131
+ * It preserves two critical pieces of metadata:
132
+ *
133
+ * 1. **sectionStack**: Array of parent sections - Essential for display condition handling.
134
+ * When sections have display conditions, we need to know which blocks belong to
135
+ * hidden sections to exclude them from indexes and processing.
136
+ *
137
+ * 2. **blockPath**: Dot-notation path to the block's location - Required for precise updates.
138
+ * Used when modifying block properties or updating valuePaths in display conditions.
139
+ * See 'modifyValuesAndValuePaths' for detailed usage.
140
+ *
141
+ * @param {Object} params - Extraction parameters
142
+ * @param {Block[]} params.data - Array of blocks/sections to process
143
+ * @param {Function} params.cb - Callback function to handle each extracted block
144
+ * @param {Section[]} params.sectionStack - Current stack of parent sections
145
+ * @param {string} params.blockPathPrefix - Current path prefix for building blockPath
146
+ */
147
+ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }: {
148
+ data: Block[];
149
+ cb: (block: ExtractedBlock) => void;
150
+ sectionStack?: Section[];
151
+ blockPathPrefix?: string;
152
+ }) => void;
127
153
 
128
- export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, setVal, toArray };
154
+ export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
@@ -124,5 +124,31 @@ declare const extractAllBlocksFromTpl: ({ tpl, buildersWhitelist }: {
124
124
  tpl: Template;
125
125
  buildersWhitelist?: BuilderType[];
126
126
  }) => ExtractedBlock[];
127
+ /**
128
+ * Recursively extracts blocks from a hierarchical data structure.
129
+ *
130
+ * This is the core traversal function that handles nested sections and blocks.
131
+ * It preserves two critical pieces of metadata:
132
+ *
133
+ * 1. **sectionStack**: Array of parent sections - Essential for display condition handling.
134
+ * When sections have display conditions, we need to know which blocks belong to
135
+ * hidden sections to exclude them from indexes and processing.
136
+ *
137
+ * 2. **blockPath**: Dot-notation path to the block's location - Required for precise updates.
138
+ * Used when modifying block properties or updating valuePaths in display conditions.
139
+ * See 'modifyValuesAndValuePaths' for detailed usage.
140
+ *
141
+ * @param {Object} params - Extraction parameters
142
+ * @param {Block[]} params.data - Array of blocks/sections to process
143
+ * @param {Function} params.cb - Callback function to handle each extracted block
144
+ * @param {Section[]} params.sectionStack - Current stack of parent sections
145
+ * @param {string} params.blockPathPrefix - Current path prefix for building blockPath
146
+ */
147
+ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }: {
148
+ data: Block[];
149
+ cb: (block: ExtractedBlock) => void;
150
+ sectionStack?: Section[];
151
+ blockPathPrefix?: string;
152
+ }) => void;
127
153
 
128
- export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, setVal, toArray };
154
+ export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
package/dist/universal.js CHANGED
@@ -24,6 +24,7 @@ __export(universal_exports, {
24
24
  extractAllBlocksFromTpl: () => extractAllBlocksFromTpl,
25
25
  genTagId: () => genTagId,
26
26
  getVal: () => getVal,
27
+ recursivelyExtractBlocks: () => _recursExtractBlocks,
27
28
  setVal: () => setVal,
28
29
  toArray: () => toArray
29
30
  });
@@ -309,6 +310,7 @@ var _extractBlocksFromSomeBuilders = ({
309
310
  extractAllBlocksFromTpl,
310
311
  genTagId,
311
312
  getVal,
313
+ recursivelyExtractBlocks,
312
314
  setVal,
313
315
  toArray
314
316
  });
@@ -277,6 +277,7 @@ export {
277
277
  extractAllBlocksFromTpl,
278
278
  genTagId,
279
279
  getVal,
280
+ _recursExtractBlocks as recursivelyExtractBlocks,
280
281
  setVal,
281
282
  toArray
282
283
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.5",
6
+ "version": "1.3.6",
7
7
  "description": "Utility functions for both browser and Node.js",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.mjs",