The static deep properties are properties attached to stamp itself. But unlike regular (shallow) static properties these are deeply merged together by stamp deep merging algorithm.
constSchemaTypes=stampit.deepStatics({ Types: { String, Number, Array }})constObjectIdSchemaType=stampit.deepStatics({ Types: { ID: String, ObjectId:require('./object-id') }})constSchema=stampit(SchemaTypes, ObjectIdSchemaType, { // stamp deep merging kicks in this lineinit(data, { stamp }) {// stamp.Types.String, stamp.Types.ID, ... }})// Schema.Types.String// Schema.Types.Number// Schema.Types.Array// as well as// Schema.Types.ID// Schema.Types.ObjectId
Descriptor merging algorithm
The staticDeepProperties are deeply merged using stamp deep merging algorithm. See below - the Types value is always a new object.
SchemaTypes.Types !==Schema.Types // NEVER EQUAL! NO MATTER WHAT!
Sometimes a regular (shallow) static property has the same name as a deep static property. The shallow static property always wins.
constNullTypes=stampit.statics({ Types:null})constNoTypesSchema=Schema.compose(NullTypes)NoTypesSchema.Types ===null// the regular property overwrites deep property
Other ways to add static deep properties
Exactly the same stamp can be created in few ways. Here they all are.