Value encoded by the Attribute's codec.
Creates an Attribute definition for a PersistenceSchema.
Non-empty logical name without /, unique within the Flow.
Value codec used by handlers and Client calls.
Optionalindex: AttributeIndexOptional visibility search index.
ReadonlycodecValue codec used by handlers and Client calls.
Optional ReadonlyindexOptional visibility search index.
ReadonlynameNon-empty logical name without /, unique within the Flow.
Stages deletion in the current decision.
Current Step or RPC Context.
Returns an immutable Attribute definition for short-lived secrets that Dex can permanently delete.
Use this option for values such as API keys that must not remain in Flow history. Dex stores
each value of a hard-delete Attribute only in the Dex blob store, never in Flow history.
Deleting the Attribute or setting it to null or undefined permanently deletes the stored value.
Register the returned definition in the Flow's PersistenceSchema. Use that same definition for
handler reads and writes, InitialAttribute values, and SubFlow initial Attributes.
Only string and object values are supported. Object values include JSON values and byte arrays. Numeric and Boolean values are rejected. A built-in numeric or Boolean codec fails here. A custom codec that encodes a number or Boolean fails when the value is written. Deletion is always allowed. A hard-delete Attribute cannot have an index and cannot use Attribute.syncToAttributeStore. Client.waitForAttributeMatch rejects a hard-delete Attribute before contacting Dex.
Writes require a Dex Server with an enabled blob store and Server protocol version 3 or later. Otherwise, the write fails. The Client checks the Server protocol version once before its first hard-delete write. The Worker checks it at startup and fails any handler result that writes a hard-delete Attribute to an older Server. Step and RPC handlers receive the value inline. The SDK never stores it in the local blob cache.
Limitations:
startFlow or SubFlow start for a Flow ID that is already running still overwrites
the running Flow's stored value. A null initial value deletes it.A new hard-delete definition; this definition remains unchanged.
const apiKey = new Attribute("api-key", stringCodec).hardDeleteOnNull();
class CallVendorStep implements Step<string> {
public readonly inputCodec = stringCodec;
public getStepType(): string {
return "CallVendorStep";
}
public async execute(context: Context, vendorUrl: string): Promise<StepDecision> {
const response = await fetch(vendorUrl, {
headers: { authorization: `Bearer ${apiKey.get(context)}` },
});
apiKey.delete(context);
return gracefulComplete(response.status);
}
}
class VendorCallFlow implements Flow<string> {
private readonly callVendor = new CallVendorStep();
public getFlowType(): string {
return "VendorCallFlow";
}
public getSteps() {
return StepList.startStep(this.callVendor);
}
public getPersistenceSchema(): PersistenceSchema {
return { attributes: [apiKey] };
}
}
const flow = new VendorCallFlow();
const client = new Client(new Registry([flow]), cache);
await client.startFlow(flow, "vendor-call-42", "https://vendor.example/report", {
attributes: [InitialAttribute.of(apiKey, process.env.VENDOR_API_KEY ?? "")],
});
Creates a lock request for this Attribute.
A lock for this singleton Attribute.
Returns an immutable Attribute definition whose writes are projected to the Flow's Attribute Store.
Projection is asynchronous and latest-state only. Deletion writes SQL NULL, projection failures do
not roll back Flow Attribute writes, and the Flow must select a configured Attribute Store name.
A new synced definition; this definition remains unchanged.
When this definition uses Attribute.hardDeleteOnNull.
Defines a typed, durable singleton value owned by a Flow.
Example