Deep configuration

Deep Configuration is a storage of an arbitrary data in the .deepConfiguration metadata of stamp's descriptor. But unlike regular (shallow) configuration these are deeply merged together by stamp deep merging algorithm.

let Kue = stampit.deepConf({
  Kue: {
    name: 'kue',
    priority: 'normal',
    attempts: 3,
    delay: 500,
    ttl: 5,
    events: false
  }
})

const HighPriorityKue = stampit.deepConf({
  Kue: {
    priority: 'high'
  }
})

const MyKue = stampit(Kue, HighPriorityKue) // composing them together

MyKue.compose.deepConfiguration.Kue.attempts === 3
MyKue.compose.deepConfiguration.Kue.priority === 'high'

You can set deep configuration in static methods:

You can access the configuration in stamp initializers (aka constructors).

Descriptor merging algorithm

The deepConfiguration is deeply merged using stamp deep merging algorithm.

See below - the Kue value is always a new object.

Other ways to add deep configuration

Exactly the same stamp can be created in few ways. Here they all are.

Last updated