documentation/dsls/DSL-DurableObject.Dsl.Extension.md

<!--
This file was generated by Spark. Do not edit it by hand.
-->
# DurableObject.Dsl.Extension

Spark DSL extension defining the structure for Durable Objects.

This extension provides three sections:

- `state` - Define state fields
- `handlers` - Define RPC handlers
- `options` - Configure lifecycle options


## state
Define the state fields for this Durable Object

### Nested DSLs
 * [field](#state-field)





### state.field
```elixir
field name, type
```


A field in the Durable Object's state





### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#state-field-name){: #state-field-name .spark-required} | `atom` |  | The name of the field |
| [`type`](#state-field-type){: #state-field-type .spark-required} | `atom` |  | The type of the field (for documentation) |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`default`](#state-field-default){: #state-field-default } | `any` |  | The default value for the field |





### Introspection

Target: `DurableObject.Dsl.Field`




## handlers
Define the handlers (RPC methods) for this Durable Object

### Nested DSLs
 * [handler](#handlers-handler)





### handlers.handler
```elixir
handler name
```


An RPC handler for the Durable Object





### Arguments

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#handlers-handler-name){: #handlers-handler-name .spark-required} | `atom` |  | The name of the handler |
### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`args`](#handlers-handler-args){: #handlers-handler-args } | `list(atom)` | `[]` | List of argument names for the handler |





### Introspection

Target: `DurableObject.Dsl.Handler`




## options
Configure lifecycle options






### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`hibernate_after`](#options-hibernate_after){: #options-hibernate_after } | `pos_integer \| :infinity` | `300000` | Hibernate process after this many ms of inactivity (default: 5 minutes) |
| [`shutdown_after`](#options-shutdown_after){: #options-shutdown_after } | `pos_integer \| :infinity \| nil` |  | Stop process after this many ms of inactivity (nil = never) |
| [`object_keys`](#options-object_keys){: #options-object_keys } | `:strings \| :atoms! \| :atoms` |  | How to convert string keys within field values when loading from JSON. :strings (default, no conversion), :atoms! (existing atoms only, raises otherwise), :atoms (creates atoms if needed). |







<style type="text/css">.spark-required::after { content: "*"; color: red !important; }</style>