# Lifecycle demo (test fixture)

addons.desc.integration.lifecycle This is a **test fixture** used by the integration tests; it is not offered in the marketplace.

| Field | Value |
|---|---|
| Addon id | `integration-lifecycle` |
| Kind | `integration` |
| Provides | `lifecycle` |
| Engine | `wasm` |
| ABI | `0.3.0` |
| Version | 0.1.0 |
| Author | MythicalSystems |
| Source | `extensions/addons/fixture-lifecycle` |
| Permissions (shown at install) | none |

## Capabilities

| Capability | Value |
|---|---|
| [`emits`](capabilities.md) | `integration-lifecycle:greet` |
| [`hooks`](capabilities.md) | `[{"event":"before:PUT /api/v1/client/profile","priority":"normal"},{"event":"during:PUT /api/v1/client/profile"},{"event":"after:PUT /api/v1/client/profile"},{"event":"finished:PUT /api/v1/client/profile","priority":"monitor"},{"event":"before:integration-lifecycle:greet","ignore_cancelled":true,"priority":"highest"}]` |
| [`kv`](capabilities.md) | true |
| [`mixins`](capabilities.md) | `[{"at":"around","target":"PUT /api/v1/client/profile"},{"at":"after","priority":10,"target":"GET /api/v1/client/profile"},{"at":"return","priority":20,"target":"GET /api/v1/client/profile"}]` |
| [`routes`](capabilities.md) | `[{"access":"client","method":"POST","path":"/greet"},{"access":"client","method":"POST","path":"/greet-other"},{"access":"client","method":"GET","path":"/log"}]` |
| [`ui`](capabilities.md) | `iframe` |

## Events and hooks

| What | Value |
|---|---|
| Listens to (`events`) | none |
| Hooks | `before:PUT /api/v1/client/profile`, `during:PUT /api/v1/client/profile`, `after:PUT /api/v1/client/profile`, `finished:PUT /api/v1/client/profile`, `before:integration-lifecycle:greet` |
| Emits | `integration-lifecycle:greet` |
| Mixins | `PUT /api/v1/client/profile` (around), `GET /api/v1/client/profile` (after), `GET /api/v1/client/profile` (return) |
| Scheduled jobs | none |

## Settings and secrets

No admin settings are declared in `addon.json` or in the source.

Secrets (stored encrypted, never returned by the API): none.

Outbound HTTP allowed to: none. `$server` is the hostname of the server configured for the product, `$setting:<key>` the host of that setting.

## HTTP routes

Mounted under `/api/v1/addons/integration-lifecycle/`.

| Method | Path | Access | Permission |
|---|---|---|---|
| POST | `/greet` | client | - |
| POST | `/greet-other` | client | - |
| GET | `/log` | client | - |

## UI

Pages: `log` (client), `frame` (client). Slots: `client.invoices.toolbar`, `client.dashboard.after`. See [Widgets and slots](widgets.md).

## addon.json

_extensions/addons/fixture-lifecycle/addon.json_

```json
{
  "abi": "0.3.0",
  "author": "MythicalSystems",
  "capabilities": {
    "emits": [
      "integration-lifecycle:greet"
    ],
    "hooks": [
      {
        "event": "before:PUT /api/v1/client/profile",
        "priority": "normal"
      },
      {
        "event": "during:PUT /api/v1/client/profile"
      },
      {
        "event": "after:PUT /api/v1/client/profile"
      },
      {
        "event": "finished:PUT /api/v1/client/profile",
        "priority": "monitor"
      },
      {
        "event": "before:integration-lifecycle:greet",
        "ignore_cancelled": true,
        "priority": "highest"
      }
    ],
    "kv": true,
    "mixins": [
      {
        "at": "around",
        "target": "PUT /api/v1/client/profile"
      },
      {
        "at": "after",
        "priority": 10,
        "target": "GET /api/v1/client/profile"
      },
      {
        "at": "return",
        "priority": 20,
        "target": "GET /api/v1/client/profile"
      }
    ],
    "routes": [
      {
        "access": "client",
        "method": "POST",
        "path": "/greet"
      },
      {
        "access": "client",
        "method": "POST",
        "path": "/greet-other"
      },
      {
        "access": "client",
        "method": "GET",
        "path": "/log"
      }
    ],
    "ui": [
      "iframe"
    ]
  },
  "description": "addons.desc.integration.lifecycle",
  "engine": "wasm",
  "i18n": {
    "en": {
      "badge": "Lifecycle on",
      "frame_title": "Lifecycle frame",
      "key": "Phase",
      "log_hint": "Counters of every event phase and mixin.",
      "log_title": "Event log",
      "value": "Count"
    },
    "ro": {
      "badge": "Lifecycle activ",
      "frame_title": "Cadru lifecycle",
      "key": "Fază",
      "log_hint": "Contoare pentru fiecare fază de eveniment și mixin.",
      "log_title": "Jurnal evenimente",
      "value": "Număr"
    }
  },
  "id": "integration-lifecycle",
  "kind": "integration",
  "name": "Lifecycle demo (test fixture)",
  "permissions": [],
  "provides": "lifecycle",
  "settings": [],
  "ui": {
    "pages": [
      {
        "area": "client",
        "body": {
          "children": [
            {
              "text": "{{t:plugin.integration-lifecycle.log_hint}}",
              "type": "text"
            },
            {
              "columns": [
                {
                  "header": "plugin.integration-lifecycle.key",
                  "value": "{{row.key}}"
                },
                {
                  "header": "plugin.integration-lifecycle.value",
                  "value": "{{row.value}}"
                }
              ],
              "rows": "{{data.log.rows}}",
              "type": "table"
            }
          ],
          "type": "stack"
        },
        "data": {
          "log": {
            "get": "/api/v1/addons/integration-lifecycle/log"
          }
        },
        "icon": "Lightning",
        "id": "log",
        "nav": true,
        "title": "plugin.integration-lifecycle.log_title"
      },
      {
        "area": "client",
        "frame": {
          "height": 200,
          "src": "assets/ui.html"
        },
        "icon": "AppWindow",
        "id": "frame",
        "nav": true,
        "title": "plugin.integration-lifecycle.frame_title"
      }
    ],
    "slots": [
      {
        "body": {
          "text": "{{t:plugin.integration-lifecycle.badge}}",
          "type": "badge"
        },
        "slot": "client.invoices.toolbar"
      },
      {
        "body": {
          "height": 120,
          "src": "assets/ui.html",
          "type": "frame"
        },
        "slot": "client.dashboard.after"
      }
    ]
  },
  "version": "0.1.0",
  "wasm": "addon.wasm"
}
```

