Value encoded for every map instance.
Creates an AttributeMap definition for a PersistenceSchema.
Non-empty logical name without /, unique within the Flow.
Value codec shared by every instance.
Optionalindex: AttributeIndexOptional shared visibility search index.
ReadonlycodecValue codec shared by every instance.
Optional ReadonlyindexOptional shared visibility search index.
ReadonlynameNon-empty logical name without /, unique within the Flow.
Stages deletion of one map instance.
Current Step or RPC Context.
The map instance. Slash is prohibited because it is a reserved character.
Returns decoded existing instance keys in ascending order.
Current Step or RPC Context.
Keys visible after decision-local writes and deletions.
Returns the number of existing instances, including buffered writes.
Current Step or RPC Context.
The number of keys visible after decision-local writes and deletions.
Returns an immutable AttributeMap definition for short-lived secrets that Dex can permanently delete.
Use this option for per-instance values such as API keys or access tokens that must not remain
in Flow history. Dex stores each instance value only in the Dex blob store, never in Flow history.
Deleting an instance or setting it to null or undefined permanently deletes its 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 AttributeMap cannot have an index and cannot use AttributeMap.syncToAttributeStore. Client.waitForAttributeMatch rejects a hard-delete AttributeMap 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 request of any method and requires version 4. The Worker checks it at startup and fails any handler result that writes a hard-delete AttributeMap instance to an older Server. Step and RPC handlers receive instance values inline. The SDK never stores them 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.
type VendorToken = { readonly token: string };
const vendorTokens = new AttributeMap("vendor-tokens", jsonCodec<VendorToken>())
.hardDeleteOnNull();
class RevokeTokenStep implements Step<string> {
public readonly inputCodec = stringCodec;
public getStepType(): string {
return "RevokeTokenStep";
}
public getStepOptions(): StepOptions {
return { executeLoadAttributeMapInstances: [vendorTokens.load("billing")] };
}
public async execute(context: Context, revokeUrl: string): Promise<StepDecision> {
const { token } = vendorTokens.get(context, "billing");
await fetch(revokeUrl, { method: "POST", body: token });
vendorTokens.delete(context, "billing");
return gracefulComplete("revoked");
}
}
class TokenRevocationFlow implements Flow<string> {
private readonly revokeToken = new RevokeTokenStep();
public getFlowType(): string {
return "TokenRevocationFlow";
}
public getSteps() {
return StepList.startStep(this.revokeToken);
}
public getPersistenceSchema(): PersistenceSchema {
return { attributes: [vendorTokens] };
}
}
const flow = new TokenRevocationFlow();
const client = new Client(new Registry([flow]), cache);
await client.startFlow(flow, "revoke-42", "https://vendor.example/revoke", {
attributes: [InitialAttribute.mapValue(vendorTokens, "billing", { token: "token-value" })],
});
Selects one instance of this AttributeMap for Client.getAttributes.
Use the result as one read in a getAttributes call. The selection keeps this AttributeMap's
value type, so the matching result element has type T | undefined. To load an instance into a
Step, RPC, or timeout-handler snapshot, use AttributeMap.load.
Non-empty logical map key. Slash is prohibited because it is a reserved character. The SDK escapes the key for the protocol.
A new selection of this AttributeMap and instance. It does not contact Dex.
Selects one logical instance for a handler snapshot.
Non-empty logical map key. The SDK escapes it for the protocol.
An exact instance load for RPC, Step, or timeout-handler options.
Creates a lock request scoped to one map instance.
The map instance. Slash is prohibited because it is a reserved character.
A lock for the requested instance.
Returns an immutable AttributeMap definition whose writes are projected to the Flow's Attribute Store.
Projection is asynchronous and latest-state only. Each map instance uses its physical Attribute name.
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 AttributeMap.hardDeleteOnNull.
Defines a typed family of durable values keyed by instance. Slash is prohibited in instance keys because it is a reserved character.