@cloudflare/actors
Version:
An easier way to build with Cloudflare Durable Objects
23 lines • 1.03 kB
TypeScript
export declare const PERSISTED_PROPERTIES: unique symbol;
export declare const PERSISTED_VALUES: unique symbol;
export declare const IS_PROXIED: unique symbol;
export type Constructor<T = any> = {
new (...args: any[]): T;
[PERSISTED_PROPERTIES]?: Set<string>;
};
/**
* Decorator that marks a property to be persisted in Durable Object storage.
* When the property value changes, it will be automatically stored in the '_actor_persist' table.
* Supports deep tracking of nested object properties.
*/
export declare function Persist<T, V>(target: undefined, context: ClassFieldDecoratorContext<T, V>): void;
/**
* Helper function to initialize persisted properties from storage.
* This is called during Actor construction.
*/
export declare function initializePersistedProperties(instance: any): Promise<void>;
/**
* Helper function to persist a property value to storage.
*/
export declare function persistProperty(instance: any, propertyKey: string, value: any): Promise<void>;
//# sourceMappingURL=persist.d.ts.map