{
  "schemaVersion": 1,
  "snapshotDate": "2026-10-23",
  "slug": "reference-app-core-core-map",
  "title": "Map collection",
  "section": "Library asset reference",
  "description": "Runs an expression for each item and returns the transformed collection.",
  "kind": "node",
  "url": "/wiki/reference-app-core-core-map/",
  "markdown": "/wiki/reference-app-core-core-map/index.md",
  "json": "/wiki/reference-app-core-core-map/index.json",
  "headings": [
    {
      "id": "sockets-and-configuration",
      "title": "Sockets and configuration",
      "depth": 2
    },
    {
      "id": "expression-behavior",
      "title": "Expression behavior",
      "depth": 2
    },
    {
      "id": "example",
      "title": "Example",
      "depth": 2
    },
    {
      "id": "catalog-identity",
      "title": "Catalog identity",
      "depth": 2
    },
    {
      "id": "inputs",
      "title": "Inputs",
      "depth": 2
    },
    {
      "id": "outputs",
      "title": "Outputs",
      "depth": 2
    },
    {
      "id": "configuration-schema",
      "title": "Configuration schema",
      "depth": 2
    },
    {
      "id": "source-and-installed-versions",
      "title": "Source and installed versions",
      "depth": 2
    }
  ],
  "sources": [
    "../OpenNodeFlow-Library/work/catalog-all.mjs",
    "../OpenNodeFlow-Library/work/azure-pack-consolidation-20261022/catalog-policy.mjs",
    "../OpenNodeFlow-Library/work/developer-packs-20261022/catalog.mjs",
    "shared/seed.ts",
    "shared/storage-library.ts",
    "shared/variable-library.ts",
    "shared/control-flow.ts",
    "shared/remote-routes.ts",
    "server/runtime-library.ts",
    "shared/error-library.ts",
    "shared/storage-model.ts",
    "shared/builtin-documentation.ts"
  ],
  "family": "app-core",
  "contract": {
    "key": "app.core.core.map",
    "slug": "app-core-core-map",
    "name": "Map collection",
    "kind": "node",
    "family": "app-core",
    "packId": null,
    "category": "Collections",
    "description": "Runs an expression for each item and returns the transformed collection.",
    "inputs": [
      {
        "id": "exec",
        "name": "Execute",
        "type": "control",
        "typeName": "Control",
        "required": false
      },
      {
        "id": "items",
        "name": "Items",
        "type": "array",
        "typeName": "Array",
        "required": true
      }
    ],
    "outputs": [
      {
        "id": "next",
        "name": "Next",
        "type": "control",
        "typeName": "Control",
        "required": false
      },
      {
        "id": "items",
        "name": "Items",
        "type": "array",
        "typeName": "Array",
        "required": false
      },
      {
        "id": "count",
        "name": "Count",
        "type": "number",
        "typeName": "Number",
        "required": false
      }
    ],
    "configSchema": {
      "type": "object",
      "properties": {
        "expression": {
          "type": "string",
          "title": "Item expression",
          "default": "item"
        }
      }
    },
    "documentation": "# Map collection\n\nEvaluates a JavaScript expression for every item in an input array and returns a transformed collection. This is one node execution, not separate visual child flows.\n\n## Sockets and configuration\n- **exec** (control): optional execution gate.\n- **items** (array, required): source collection.\n- **items** (array): transformed results in original item order. **count** (number): result length.\n- **next** (control): automatic success route.\n- **expression** (string): default item; an empty expression also falls back to item.\n\n## Expression behavior\nThe expression receives parameters **item** and **index** through new Function. It is an expression, so return object literals inside parentheses. It does not close over the node's inputs/config/context variables. Ordinary JavaScript globals remain available and code is trusted, not sandboxed.\n\n## Example\nWith items `[{\"kW\":1.5},{\"kW\":2}]` and expression `({ ...item, watts: item.kW * 1000 })`, the result adds watts 1500 and 2000; count is 2. Empty arrays produce an empty result and count 0.\n\nPromise.all awaits promise-valued results concurrently and preserves order; there is no per-item throttle or retry boundary. A rejected result or syntax error fails the whole node, and configured retries evaluate the entire collection again. Prefer pure expressions: external effects may be repeated and large/unbounded collections consume memory and timeout budget. This shipped wrapper does not itself use secrets, checkpoints or network, but an authored expression can execute host-accessible code. Returned values must remain JSON-transportable.",
    "tags": [
      "builtin",
      "node"
    ],
    "source": "app-builtin-catalog"
  }
}
