Namespace

contracts

for-fabric.contracts

Contracts submodule for Hyperledger Fabric integration

View Source contracts/index.ts, line 2

Methods

# static pkFabricOnCreate(this, context, data, key, model) → {Promise.<void>}

Generates and assigns a primary key value to the specified model property using a Fabric-backed sequence when the model is created. If the sequence name is not provided in options, it is derived from the model via sequenceNameForModel. The assigned key is defined as non-writable and enumerable.

Primary key auto-assignment callback for Fabric models

sequenceDiagram participant R as Repository participant C as Context participant S as FabricContractDBSequence participant M as Model R->>R: derive sequence name if missing R->>S: adapter.Sequence(options) S-->>R: sequence instance R->>S: next(context) S-->>R: next value R->>M: define non-writable primary key
Parameters:
Name Type Description
this R

The repository instance invoking the callback

context FabricContractContext

Fabric contract context containing invocation metadata

data V

Sequence options used to configure or locate the sequence

key string

The primary key property name to assign on the model

model M

The model instance to receive the generated primary key

View Source contracts/ContractAdapter.ts, line 861

Resolves when the key is assigned or when no action is required

Promise.<void>