SPB Git

Repository Public License

inventory.blueprint.json 6.7 KB 316 lines json

1{2  "entrypoint": "inventory",3  "id": "app_inventory",4  "name": "Inventory",5  "objects": [6    {7      "id": "items",8      "name": "Items",9      "props": {10        "columns": [11          {12            "label": "Item",13            "name": "name",14            "required": true,15            "type": "text"16          },17          {18            "default": 0,19            "label": "Quantity",20            "name": "quantity",21            "required": true,22            "type": "integer"23          },24          {25            "default": 0,26            "label": "Unit price",27            "name": "unit_price",28            "required": true,29            "type": "currency"30          },31          {32            "default": 0,33            "label": "Stock value",34            "name": "stock_value",35            "type": "currency"36          }37        ],38        "seed": [39          {40            "name": "USB-C cable",41            "quantity": 24,42            "stock_value": 204,43            "unit_price": 8.544          },45          {46            "name": "Wireless mouse",47            "quantity": 10,48            "stock_value": 199.9,49            "unit_price": 19.9950          },51          {52            "name": "Laptop stand",53            "quantity": 0,54            "stock_value": 0,55            "unit_price": 3456          },57          {58            "name": "HDMI adapter",59            "quantity": 15,60            "stock_value": 191.25,61            "unit_price": 12.7562          },63          {64            "name": "Keyboard",65            "quantity": 6,66            "stock_value": 270,67            "unit_price": 4568          }69        ]70      },71      "provenance": {72        "source": "agent"73      },74      "schemaVersion": 1,75      "type": "prism.data.table",76      "version": 177    },78    {79      "children": [80        "root"81      ],82      "id": "inventory",83      "name": "Inventory",84      "props": {85        "icon": "shippingbox"86      },87      "provenance": {88        "source": "agent"89      },90      "schemaVersion": 1,91      "type": "prism.page",92      "version": 193    },94    {95      "children": [96        "header",97        "out_of_stock_alert",98        "stats",99        "items_manager"100      ],101      "id": "root",102      "props": {103        "align": "stretch",104        "grow": true105      },106      "provenance": {107        "source": "agent"108      },109      "schemaVersion": 1,110      "type": "prism.stack",111      "version": 1112    },113    {114      "dependencies": [115        "items"116      ],117      "id": "out_of_stock",118      "name": "Out-of-stock items",119      "props": {120        "query": {121          "filters": [122            {123              "column": "quantity",124              "op": "lte",125              "value": 0126            }127          ],128          "sort": [129            {130              "column": "name"131            }132          ],133          "table": "items"134        }135      },136      "provenance": {137        "generated": true,138        "source": "agent"139      },140      "schemaVersion": 1,141      "type": "prism.data.query",142      "version": 1143    },144    {145      "id": "header",146      "props": {147        "text": "Inventory"148      },149      "provenance": {150        "source": "agent"151      },152      "schemaVersion": 1,153      "type": "prism.heading",154      "version": 1155    },156    {157      "id": "out_of_stock_alert",158      "props": {159        "message": {160          "$expr": "concat('Restock: ', text(pluck(queries.out_of_stock, 'name')))"161        },162        "title": {163          "$expr": "count(queries.out_of_stock) == 1 ? '1 item is out of stock' : concat(text(count(queries.out_of_stock)), ' items are out of stock')"164        },165        "tone": "danger",166        "visible": {167          "$expr": "count(queries.out_of_stock) > 0"168        }169      },170      "provenance": {171        "source": "agent"172      },173      "schemaVersion": 1,174      "type": "prism.alert",175      "version": 1176    },177    {178      "children": [179        "total_value",180        "total_units",181        "out_count"182      ],183      "id": "stats",184      "props": {185        "columns": 3186      },187      "provenance": {188        "source": "agent"189      },190      "schemaVersion": 1,191      "type": "prism.grid",192      "version": 1193    },194    {195      "dependencies": [196        "items"197      ],198      "id": "total_value",199      "props": {200        "format": "currency",201        "icon": "dollarsign.circle",202        "label": "Total stock value",203        "query": {204          "aggregates": [205            {206              "as": "total",207              "column": "stock_value",208              "fn": "sum"209            }210          ],211          "table": "items"212        },213        "tone": "accent",214        "valueColumn": "total"215      },216      "provenance": {217        "source": "agent"218      },219      "schemaVersion": 1,220      "type": "prism.aggregation",221      "version": 1222    },223    {224      "dependencies": [225        "items"226      ],227      "id": "total_units",228      "props": {229        "format": "number",230        "icon": "shippingbox",231        "label": "Units in stock",232        "query": {233          "aggregates": [234            {235              "as": "units",236              "column": "quantity",237              "fn": "sum"238            }239          ],240          "table": "items"241        },242        "valueColumn": "units"243      },244      "provenance": {245        "source": "agent"246      },247      "schemaVersion": 1,248      "type": "prism.aggregation",249      "version": 1250    },251    {252      "id": "out_count",253      "props": {254        "format": "number",255        "icon": "exclamationmark.triangle",256        "label": "Out of stock",257        "tone": {258          "$expr": "count(queries.out_of_stock) > 0 ? 'danger' : 'success'"259        },260        "value": {261          "$expr": "count(queries.out_of_stock)"262        }263      },264      "provenance": {265        "source": "agent"266      },267      "schemaVersion": 1,268      "type": "prism.aggregation",269      "version": 1270    },271    {272      "dependencies": [273        "items"274      ],275      "events": {276        "saved": [277          {278            "id": {279              "$expr": "row.id"280            },281            "table": "items",282            "type": "updateRecord",283            "values": {284              "stock_value": {285                "$expr": "row.quantity * row.unit_price"286              }287            }288          }289        ]290      },291      "id": "items_manager",292      "props": {293        "columns": [294          "name",295          "quantity",296          "unit_price"297        ],298        "grow": true,299        "table": "items",300        "title": "Items"301      },302      "provenance": {303        "source": "agent"304      },305      "schemaVersion": 1,306      "type": "prism.crud",307      "version": 1308    }309  ],310  "permissions": [311    "storage.local"312  ],313  "schemaVersion": 1,314  "summary": "A small inventory of items with quantity and unit price, total stock value, and an out-of-stock warning.",315  "version": 1316}
Files main
Menu

Theme