### Inheritance of `options.after` Hooks Source: https://github.com/descript-org/descript/blob/master/docs/options_after.md Demonstrates how `options.after` hooks are inherited and executed in a chain, starting from the oldest ancestor. Each hook receives the result of the previous one. ```javascript const parent = de.block( { options: { // Если экшен блока успешно завершился, то выполнится родительский after. // И в result придет результат экшена. // after: ( { result } ) => { return { // Возвращаем новый результат. // ...result, foo: 42, }; }, }, } ); const child = parent.extend( { options: { // Если родительский after отработал без ошибок и вернул что-то, // то это что-то приходит в after потомка в качестве результата. // after: ( { result } ) => { return { ...result, bar: 24, }; }, }, } ); de.run( child, ... ); ``` -------------------------------- ### Descript Logger Implementation Source: https://github.com/descript-org/descript/blob/master/docs/logs.md Implement a logger object with a `log` method to handle Descript events. This logger differentiates between request start, success, and error events, extracting relevant data from `event.requestOptions`. ```javascript import * as de from 'descript'; const logger = { log: function( event, context ) { switch ( event.type ) { case de.EVENT.REQUEST_START: { const { requestOptions } = event; ... break; } case de.EVENT.REQUEST_SUCCESS: { const { requestOptions, result, timestamps } = event; ... break; } case de.EVENT.REQUEST_ERROR: { const { requestOptions, error, timestamps } = event; ... break; } } }, }; ``` -------------------------------- ### Create an HTTP Block Source: https://github.com/descript-org/descript/blob/master/docs/blocks.md Demonstrates the basic structure for creating an HTTP block using the `de.http` factory. Specific parameters go into the `block` object, while general options are placed in the `options` object. ```javascript const block = de.http( { block: { // Тут специфичные для этого типа блока параметры. }, options: { // Тут общие для всех типов блоков параметры. }, } ); ``` -------------------------------- ### Configure Block Caching Options Source: https://github.com/descript-org/descript/blob/master/docs/cache.md Set up caching for a block by providing a `key` function to generate a unique cache key, `maxage` for the cache duration in milliseconds, and the `cache` instance to use. ```javascript const cache = new de.Cache(); const block = de.block( { options: { // Кэшируем по имени метода и параметру id. key: ( { params } ) => `my_method:id=${ params.id }`, // Храним 1 час. maxage: 60 * 60 * 1000, // Задаем в каком кэше все храним. cache: cache, }, } ); ``` -------------------------------- ### `de.func` with `generateId` for Dependencies Source: https://github.com/descript-org/descript/blob/master/docs/function_block.md Demonstrates the usage of the `generateId` function within `de.func` to establish dependencies between blocks. ```js const block = de.func( { block: ( { params, generateId } ) => { const id = generateId(); ... }, } ); ``` -------------------------------- ### Shorthand Function with `generateId` for Dependencies Source: https://github.com/descript-org/descript/blob/master/docs/function_block.md Shows how to use the `generateId` function within the shorthand function block syntax for managing dependencies. ```js const block = ( { params, generateId } ) => { const id = generateId(); ... }; ``` -------------------------------- ### Initialize a Descript Cache Instance Source: https://github.com/descript-org/descript/blob/master/docs/cache.md Create a new instance of the built-in in-memory cache. For production, consider using a more robust solution like `descript-redis-cache`. ```javascript const cache = new de.Cache(); ``` -------------------------------- ### Remove options.guard and Use options.before in v3 Source: https://github.com/descript-org/descript/blob/master/docs/v2-v3.md v3 removes `options.guard` and introduces `options.before` for pre-execution logic. Guards should be implemented as functions within `options.before` that throw an error if the condition is not met. ```javascript options: { guard: ( params ) => Boolean( params.id ), }, ``` ```javascript options: { before: ( { params } ) => { if ( !params.id ) { throw de.error( { id: 'BLOCK_GUARDED', } ); } }, }, ``` -------------------------------- ### Обработка перенаправления (неправильный подход) Source: https://github.com/descript-org/descript/blob/master/docs/cancel.md Пример некорректной реализации перенаправления пользователя путем прямой отправки заголовков ответа изнутри блока. Это может привести к ошибкам 'Headers already sent' или race conditions. ```javascript options: { after: ( { result, context } ) => { if ( result.redirectUrl ) { const { res } = context; res.statusCode = 302; res.setHeader( 'location', result.redirectUrl ); res.end(); } }, }, ``` -------------------------------- ### Parameter Handling in HTTP Blocks Source: https://github.com/descript-org/descript/blob/master/docs/v2-v3.md Parameter handling for HTTP blocks has been updated. Path parameters are now defined using `{ params.param_name }` syntax. Query parameters are directly specified. Body parameters are generated by a function that receives `params`. The `valid_params` option is removed, and parameters are implicitly handled based on their usage in path, query, or body. ```javascript module.exports = de.http( { block: { path: de.jstring( '/1.0/foo/{ params.foo }' ), query: { bar: null, }, body: ( params ) => { return { quu: params.quu, }, }, }, options: { valid_params: { // Это было нужно, чтобы params.foo использовать в path. foo: null, // Этот параметр как есть отправлялся в query, // но было недостаточно просто прописать его там. bar: null, // Это было нужно, чтобы params.quu использовать в body. quu: null, }, }, } ); ``` -------------------------------- ### Handling Results with `options.after` Source: https://github.com/descript-org/descript/blob/master/docs/v2-v3.md The `options.result` functionality is removed. Instead, use `options.after` to perform actions with the result and return the new result if needed. If `after` returns a value other than `undefined`, it becomes the new result. ```javascript options: { after: function( { context, result } ) { // Это то, что раньше делалось в after. // context.res.cookie( 'some_id', no.jpath( '.some.id', result ) ); // А это то, что раньше возвращалось из options.result. // return no.jpath( '.foo.bar', result ); }, }, ``` -------------------------------- ### Dependency Management: Dynamic Block Creation Source: https://github.com/descript-org/descript/blob/master/docs/v2-v3.md Blocks are now wrapped in a closure that provides a `generate_id` function. IDs are generated dynamically using this function instead of using static strings. `de.object` is created dynamically within this closure, and dependencies are managed via the `deps` array in `options`, with results accessed from the `deps` object in the `params` callback. ```javascript const de = require( 'descript' ); const block_foo = require( '.../blocks/foo' ); const block_bar = require( '.../blocks/bar' ); // de.object статический. // const block = de.object( { block: { foo: block_foo( { options: { // Используем обычные строки в качестве id. // id: 'foo', }, select: { // Достаем из результата значение // и кладем его в state.bar. // bar: de.jexpr( '.bar' ), }, } ), bar: block_bar( { options: { deps: 'foo', params: ( params, context, state ) => { return { // Достаем значение из стейта. // bar: state.bar, }; }, }, } ), }, }; ``` ```javascript const de = require( 'descript' ); const block_foo = require( '.../blocks/foo' ); const block_bar = require( '.../blocks/bar' ); // Оборачиваем все в специальное замыкание. // Чтобы получить генератор id-шников. // const block = function( { generate_id } ) { // Не исользуем строки в качестве id, // генерим id специальной функцией. // const foo_id = generate_id(); // de.object создается динамически. // Блоки внутри него связываются только внутри этого замыкания. // Снаружи id не доступен. // return de.object( { block: { foo: block_foo( { options: { id: foo_id, }, // Тут ничего специально не делаем. // options.select больше нет, равно как и стейта. } ), bar: block_bar( { options: { deps: [ foo_id ], // Результат выполнения зависимостей приходит // в колбэк в поле deps. params: ( { deps } ) => { // По id достаем результат нужного блока. const result_foo = deps[ id ]; // Вычисляем параметры для блока bar из // результата блока foo. return { bar: result_foo.bar, }; }, }, } ), }, } ); }; ``` -------------------------------- ### Helper Function for Guarding in v3 Source: https://github.com/descript-org/descript/blob/master/docs/v2-v3.md A helper function `guard` is provided for a smoother transition, allowing conditional checks within `options.before`. ```javascript function guard( condition ) { if ( typeof condition === 'function' ) { return ( args ) => { if ( !condition( args ) ) { throw de.error( { id: 'BLOCK_GUARDED', } ); } }; } if ( !condition ) { throw de.error( { id: 'BLOCK_GUARDED', } ); } } const block = de.block( { options: { before: guard( ( params ) => Boolean( params.id ) ), // Или так: before: ( { params } ) => { guard( Boolean( params.id ) ); ... }, }, } ) ``` -------------------------------- ### Update HTTP Block Configuration in v3 Source: https://github.com/descript-org/descript/blob/master/docs/v2-v3.md In v3, `options.valid_params` are no longer used and have been removed. Query parameters are now defined directly within the `block.query` object. ```javascript module.exports = de.http( { block: { pathname: ( { params } ) => `/1.0/foo/${ params.foo }`, query: { bar: null, }, body: ( { params } ) => { return { quu: params.quu, }, }, }, // options.valid_params не нужны и их больше нет. } ); ``` -------------------------------- ### Change Path/Host to Pathname/Hostname in v3 Source: https://github.com/descript-org/descript/blob/master/docs/v2-v3.md v3 replaces `block.host` with `block.hostname` and `block.path` with `block.pathname` for defining network endpoints. ```javascript de.http( { block: { host: 'my.host.com', path: '/foo/bar', }, }) ``` ```javascript de.http( { block: { hostname: 'my.host.com', pathname: '/foo/bar', }, }) ``` -------------------------------- ### Set Cookies with `options.after` Source: https://github.com/descript-org/descript/blob/master/docs/options_after.md Perform side effects like setting cookies within the `options.after` hook, using the `context` object to access the response. ```javascript options: { after: ( { result, context } ) => { if ( result.foo ) { const { res } = context; // Выставляем в ответ куки (например, сессионные и т.д.) // res.cookie( 'foo', result.foo, ... ); } }, }, ``` -------------------------------- ### Обработка перенаправления (рекомендуемый подход) Source: https://github.com/descript-org/descript/blob/master/docs/cancel.md Рекомендуемый способ обработки перенаправлений: вместо прямой отправки ответа, блок инициирует отмену с специальной ошибкой, содержащей информацию о перенаправлении. Внешний код перехватывает эту ошибку и выполняет перенаправление. ```javascript const block = de.block( { options: { after: ( { result, cancel } ) => { if ( result.redirectUrl ) { // Не делаем редирект изнутри блока, // но кидаем специальную ошибку о том, что нужно сделать редирект. // cancel.cancel( de.error( { id: 'REDIRECT', location: result.redirectUrl, status_code: 302, } ) ); } }, }, } ); ``` ```javascript try { const result = await de.run( block ); ... } catch ( error ) { // Ловим ошибку, смотрим, что это редирект. // if ( error.error.id === 'REDIRECT' ) { res.statusCode = error.error.status_code || 302; res.setHeader( 'location', error.error.location ); res.end(); return; } ... ``` -------------------------------- ### Define Cache Key Dynamically Source: https://github.com/descript-org/descript/blob/master/docs/cache.md Use a function for the `key` option to dynamically generate a cache key based on the block's parameters, ensuring unique caching for different inputs. ```javascript options: { // Кэшируем по имени метода и параметру id. key: ( { params } ) => `my_method:id=${ params.id }`, }, ``` -------------------------------- ### `de.func` Block Logic and Return Types Source: https://github.com/descript-org/descript/blob/master/docs/function_block.md Illustrates how the `block` function within `de.func` can handle different return types (another block, a promise, other values) or throw errors for conditional execution. ```js const anotherBlock = require( '...' ); const block = de.func( { block: ( { params } ) => { if ( !params.id ) { throw de.error( { id: 'INVALID_PARAMS', } ); } if ( params.bar ) { return { bar: params.bar, }; } if ( params.foo ) { return anotherBlock; } return new Promise( ( resolve ) => { ... } ); }, } ); ``` -------------------------------- ### Arguments for `options.after` Hook Source: https://github.com/descript-org/descript/blob/master/docs/options_after.md The `options.after` hook receives `params`, `context`, `deps`, `cancel`, and `result` as arguments, providing access to various aspects of the block's execution. ```javascript options: { after: ( { params, context, deps, cancel, result } ) => { }, }, ``` -------------------------------- ### Return Different Block with `options.after` Source: https://github.com/descript-org/descript/blob/master/docs/options_after.md The `options.after` hook can return a different block if a condition is met, otherwise it returns the original result. ```javascript options: { after: ( { result } ) => { if ( !result.foo ) { return anotherBlock; } return result; }, }, ``` -------------------------------- ### Shorthand Function Block Source: https://github.com/descript-org/descript/blob/master/docs/function_block.md Provides a concise alternative to `de.func` when `options` are not required, directly defining the block logic as a function. ```js const block = ( { params } ) => { return ( params.foo ) ? blockFoo : blockBar; }; ``` -------------------------------- ### Создание и использование токена отмены Source: https://github.com/descript-org/descript/blob/master/docs/cancel.md Создайте экземпляр `de.Cancel` для управления отменой. Используйте его для сигнализации о необходимости остановки выполнения из-за внешних событий, таких как таймауты или закрытие входящих запросов. ```javascript const cancel = new de.Cancel(); ``` ```javascript // На самом деле, так задавать таймаут не нужно, // лучше воспользоваться `options.timeout` у блока. // setTimeout( () => { cancel.cancel( de.error( { id: 'TIMEOUT', } ) ); }, 1000 ); ``` ```javascript // Если вдруг входящий коннект закрылся, тормозим все наши запросы тоже. // req.once( 'close', () => { cancel.cancel( de.error( { id: 'INCOMING_REQUST_CLOSED', } ) ); } ); ``` ```javascript // Запускаем блок и передаем туда наш токен // const result = de.run( block, { cancel } ); ``` -------------------------------- ### Отмена выполнения изнутри блока Source: https://github.com/descript-org/descript/blob/master/docs/cancel.md Обрабатывайте ошибки внутри блока, чтобы инициировать отмену выполнения. Если возникает определенная ошибка, вы можете вызвать `cancel.cancel()` для остановки дальнейшей обработки и сигнализации о новой ошибке. ```javascript const block = de.block( { options: { error: ( { error, cancel } ) => { if ( error.error.id === 'SOME_ERROR' ) { cancel.cancel( de.error( { id: 'SOME_OTHER_ERROR', } ) ); } }, }, } ); ``` -------------------------------- ### Configuring Descript Block with Logger Source: https://github.com/descript-org/descript/blob/master/docs/logs.md Integrate a custom logger into a Descript block by passing it via the `options.logger` property during block creation. This enables Descript to emit HTTP-related events to your logger. ```javascript const block = de.block( { options: { logger: logger, }, } ); ``` -------------------------------- ### Throw Error with `options.after` Source: https://github.com/descript-org/descript/blob/master/docs/options_after.md If the `result` from a block's action is not satisfactory, `options.after` can be used to throw an error, halting the process. ```javascript options: { after: ( { result } ) => { if ( !result.foo ) { // Что-то пошло не так, результат нас не устраивает. // Кидаем ошибку. // throw de.error( { id: 'INVALID_RESULT', } ); } }, }, ``` -------------------------------- ### Basic `de.func` Structure Source: https://github.com/descript-org/descript/blob/master/docs/function_block.md Defines the fundamental structure of a `de.func` block, including the `block` function for logic and optional `options`. ```js const block = de.func( { block: ( { params, context, deps, cancel } ) => { ... return ...; }, options: ..., } ); ``` -------------------------------- ### Extend a Descript Block Source: https://github.com/descript-org/descript/blob/master/docs/inheritance.md Use the `extend` method to create a child block that inherits and modifies the functionality of a parent block. This allows for customization of the block's structure and options. ```javascript const parentBlock = de.block( ... ); const childBlock = parentBlock.extend( { block: { // Модификации блока. }, options: { // Модификации опций блока. }, } ); ``` -------------------------------- ### Replace de.jstring and de.jexpr with Arrow Functions in v3 Source: https://github.com/descript-org/descript/blob/master/docs/v2-v3.md v3 encourages the use of arrow functions for defining `pathname` instead of `de.jstring` or `de.jexpr` for cleaner interpolation. ```javascript const block = de.http( { block: { pathname: de.jstring( '/item/{ params.id }' ), } } ); ``` ```javascript const block = de.http( { block: { pathname: ( { params } ) => `/item/${ params.id }`, }, } ); ``` -------------------------------- ### Set Cache Expiration Time Source: https://github.com/descript-org/descript/blob/master/docs/cache.md Specify the `maxage` option in milliseconds to control how long a cache entry remains valid. A value of 0 indicates indefinite storage for the `de.Cache` implementation. ```javascript options: { // Храним 1 секунду. maxage: 1000, }, ``` -------------------------------- ### Запуск блока Source: https://github.com/descript-org/descript/blob/master/docs/cancel.md Получите промис после запуска блока для дальнейшего управления. Этот промис сам по себе не позволяет отменить выполнение. ```javascript const promise = de.run( block, ... ); ``` -------------------------------- ### Callback Arguments: Object Destructuring Source: https://github.com/descript-org/descript/blob/master/docs/v2-v3.md Callback functions now receive a single object argument containing parameters, context, and state, instead of individual arguments. The `state` argument is no longer provided directly. ```javascript options: { before: ( params, context, state ) => { ... }, after: ( params, context, state, result ) => { ... }, error: ( params, context, state, error ) => { ... }, }, ``` ```javascript options: { before: ( { params, context, state } ) => { ... }, after: ( { params, context, state, result } ) => { ... }, error: ( { params, context, state, error } ) => { ... }, }, ``` -------------------------------- ### Define a Basic `de.object` Block Source: https://github.com/descript-org/descript/blob/master/docs/object_block.md Use `de.object` to define a block that composes other blocks into an object. The structure of the resulting object mirrors the structure defined within the `block` property. ```javascript import blockFoo from '.../blocks/foo'; import blockBar from '.../blocks/bar'; ... const block = de.object( { block: { foo: blockFoo, bar: blockBar, ... }, } ); ``` -------------------------------- ### Update Descript Module Requirement Source: https://github.com/descript-org/descript/blob/master/docs/v2-v3.md Update the `require` statement to point to the new 'descript' package instead of 'descript2'. Also, update the package version in `package.json`. ```javascript const de = require( 'descript2' ); ``` ```javascript const de = require( 'descript' ); ``` ```diff + "descript": "3.0.8", - "descript2": "0.0.45", ``` -------------------------------- ### Defining Nested `de.object` Blocks Source: https://github.com/descript-org/descript/blob/master/docs/object_block.md Nested `de.object` blocks are supported, allowing for the creation of deeply structured data. The resulting object will reflect the nested structure of the defined `de.object` blocks. ```javascript const block = de.object( { block: { foo: blockFoo, bar: de.object( { block: { quu: blockQuu, ... }, } ), ... }, } ); ``` ```javascript const result = { foo: resultFoo, bar: { quu: resultQuu, ... }, ... }; ``` -------------------------------- ### Object fails due to a required sub-block error Source: https://github.com/descript-org/descript/blob/master/docs/options_required.md If a sub-block marked as `required` (`blockBar` in this case) fails, the parent `de.object` block will fail. The error details will include the `path` to the failing required sub-block and the `reason` for its failure. ```javascript { error: { id: de.ERROR_ID.REQUIRED_BLOCK_FAILED, // Эта строчка показывает нам, кто именно из подблоков завершился ошибкой. path: '.bar', // Это та самая ошибка в required-блоке, из-за которой весь de.object упал с ошибкой. reason: { error: { id: 'SOME_ERROR', }, }, }, } ``` -------------------------------- ### Arguments for `options.error` Hook Source: https://github.com/descript-org/descript/blob/master/docs/options_error.md The `options.error` hook receives an object containing `params`, `context`, `deps`, `cancel`, and the `error` itself. This provides comprehensive access to the execution environment. ```javascript options: { error: ( { params, context, deps, cancel, error } ) => { }, }, ``` -------------------------------- ### Enforcing Required Sub-blocks with options.required Source: https://github.com/descript-org/descript/blob/master/docs/array_block.md To make de.array fail if any sub-block fails, set `options.required: true` on the specific sub-block. This ensures that the entire de.array block will fail if the required sub-block encounters an error. ```javascript const block = de.array( { block: [ // Если этот блок зафейлится, то и весь de.array так же зафейлится. blockFoo.extend( { options: { required: true, }, } ), blockBar, ... ], } ); ``` -------------------------------- ### Modify Return Value with `options.after` Source: https://github.com/descript-org/descript/blob/master/docs/options_after.md Use `options.after` to modify the successful result of a block's action. The hook receives the `result` and can return a new object. ```javascript options: { after: ( { result } ) => { // Модифицируем результат. // return { ...result, foo: 42, }; }, }, ``` -------------------------------- ### Enforcing Required Sub-blocks in `de.object` Source: https://github.com/descript-org/descript/blob/master/docs/object_block.md To ensure that `de.object` fails if any of its sub-blocks fail, use the `options.required: true` setting on the specific sub-block. This makes the parent `de.object` block also fail if this sub-block encounters an error. ```javascript const block = de.object( { block: { // Если этот блок зафейлится, то и весь de.object так же зафейлится. foo: blockFoo( { options: { required: true, }, } ), bar: blockBar, ... }, } ); ``` -------------------------------- ### Define a de.array Block Source: https://github.com/descript-org/descript/blob/master/docs/array_block.md Use de.array to combine multiple blocks into a single array block. The sub-blocks are executed, and their results are collected in the order they are defined. ```javascript const blockFoo = require( '.../blocks/foo' ); const blockBar = require( '.../blocks/bar' ); ... const block = de.array( { block: [ blockFoo, blockBar, ... ], } ); ``` -------------------------------- ### Handling Errors in `de.object` Sub-blocks Source: https://github.com/descript-org/descript/blob/master/docs/object_block.md If a sub-block within `de.object` fails, it does not necessarily cause the entire `de.object` to fail. The result will contain the error for the failed sub-block while other successful sub-blocks will return their results. ```javascript const result = { // Ошибка blockFoo foo: errorFoo, // Результат работы blockBar bar: resultBar, ... }; ``` -------------------------------- ### Define an object with a required sub-block Source: https://github.com/descript-org/descript/blob/master/docs/options_required.md Use `required: true` within the `options` of a sub-block to make it mandatory. If this sub-block fails, the parent `de.object` will also report an error. ```javascript const block = de.object( { block: { foo: blockFoo, bar: blockBar.extend( { options: { required: true, }, } ), }, } ); ``` -------------------------------- ### Replace an Error with Another Source: https://github.com/descript-org/descript/blob/master/docs/options_error.md Use this when you need to substitute a specific error with a different one. The hook receives the original error and allows you to throw a new error using `de.error()`. ```javascript options: { error: ( { error } ) => { // Какая-то неправильная ошибка. // Возвращаем другую взамен. // if ( error.error.id === 'SOME_ERROR' ) { throw de.error( { id: 'ANOTHER_ERROR', } ); } }, }, ``` -------------------------------- ### Return a Result Instead of an Error Source: https://github.com/descript-org/descript/blob/master/docs/options_error.md This allows you to treat a perceived error as a successful result. If the condition is met, the hook returns a value, and the block execution concludes successfully. Returning `undefined` is also considered a valid result. ```javascript options: { error: ( { error } ) => { if ( error.error.id === 'SOME_ERROR' ) { // На самом деле это только так кажется, что это ошибка! // Возвращаем результат. // return { foo: 42, }; } }, }, ``` -------------------------------- ### Nested de.array Blocks Source: https://github.com/descript-org/descript/blob/master/docs/array_block.md de.array can contain other de.array blocks as sub-blocks, allowing for hierarchical construction of complex data structures. The results will mirror this nested structure. ```javascript const block = de.array( { block: [ blockFoo, de.array( { block: [ blockQuu, ... ], } ), ... ], } ); ``` -------------------------------- ### Result of de.array Execution Source: https://github.com/descript-org/descript/blob/master/docs/array_block.md The output of a de.array block is an array containing the results of its sub-blocks. The order of results matches the order of sub-blocks in the definition. ```javascript const result = [ // Результат работы blockFoo resultFoo, // Результат работы blockBar resultBar, ... ]; ``` -------------------------------- ### Handling Errors in Sub-blocks Source: https://github.com/descript-org/descript/blob/master/docs/array_block.md By default, if a sub-block fails, de.array continues execution and includes the error in the results array. The de.array block itself does not fail unless explicitly configured. ```javascript const result = [ // Ошибка blockFoo errorFoo, // Результат работы blockBar resultBar, ... ]; ``` -------------------------------- ### Object succeeds despite a non-required sub-block error Source: https://github.com/descript-org/descript/blob/master/docs/options_required.md When a non-required sub-block (`blockFoo` in this case) fails, the parent `de.object` block still succeeds, reporting the error within the result for that specific sub-block. ```javascript { foo: { error: { id: 'SOME_ERROR', }, }, bar: { // Some result. bar: 24, }, } ``` -------------------------------- ### Result of Nested de.array Execution Source: https://github.com/descript-org/descript/blob/master/docs/array_block.md When de.array contains nested de.array blocks, the resulting output will be a nested array structure that reflects the hierarchy of the defined blocks. ```javascript const result = [ resultFoo, [ resultQuu, ... ], ... ]; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.