import type { ResourceCodec } from '../codec.js'; import type { ClientContext } from './request.js'; import type { IZcap, ResourceMetadataCustom, ResourceMetadataCustomInput } from '../types.js'; /** * Reads a metadata document and decodes its user-writable `custom` value. * Returns `null` when the target is missing or not visible (404 conflation * caveat), and carries the metadata's `etag` when the backend versions it. * * @param context {ClientContext} * @param options {object} * @param options.metaPath {string} the `/meta` sub-resource path * @param options.codec {Promise} the resolving codec, awaited * concurrently with the read * @param options.subject {string} the metadata's owner as it reads in the * malformed-response error message * @param [options.id] {string} the resource id the metadata belongs to, for * an encrypting codec's envelope-binding check. Omitted at Collection level. * @param [options.capability] {IZcap} * @returns {Promise<(Metadata & { etag?: string }) | null>} */ export declare function readMeta(context: ClientContext, { metaPath, codec: codecPromise, subject, id, capability }: { metaPath: string; codec: Promise; subject: string; id?: string; capability?: IZcap; }): Promise<(Metadata & { etag?: string; }) | null>; /** * Replaces a metadata document's user-writable `custom`, encoding it through * the codec first (which seals it into an opaque envelope on an encrypted * collection). * * @param context {ClientContext} * @param options {object} * @param options.metaPath {string} the `/meta` sub-resource path * @param options.codec {Promise} the resolving codec * @param options.custom {ResourceMetadataCustomInput} the user-writable * properties, as a full replacement * @param options.sendEpoch {boolean} whether the codec's key epoch travels as * a top-level member of this PUT body. True at Collection level, where the * stamp describes the `custom` envelope itself; false at Resource level, * where a Resource's epoch instead stamps its content write via the * `Key-Epoch` header, so an epoch surfaced here is deliberately dropped. * @param [options.id] {string} the resource id to bind the envelope to. * Omitted at Collection level. * @param [options.ifMatch] {string} update only if the `/meta` ETag matches * @param [options.ifNoneMatch] {boolean} write only if no metadata is set * @param [options.capability] {IZcap} * @returns {Promise<{ etag?: string }>} the metadata's new ETag */ export declare function writeMeta(context: ClientContext, { metaPath, codec: codecPromise, custom, sendEpoch, id, ifMatch, ifNoneMatch, capability }: { metaPath: string; codec: Promise; custom: ResourceMetadataCustomInput; sendEpoch: boolean; id?: string; ifMatch?: string; ifNoneMatch?: boolean; capability?: IZcap; }): Promise<{ etag?: string; }>; /** * The shared read-then-CAS body of the handles' `setName` / `setTags`: reads * the current metadata, merges `patch` over its `custom`, and writes it back * pinned to the read's `etag` (when the backend supports `conditional-writes`), * so a concurrent metadata write surfaces as `PreconditionFailedError` instead * of being silently erased by the full-replacement write. * * @param handle {object} the Collection or Resource handle to patch * @param patch {ResourceMetadataCustom} the properties to merge over the * current `custom` * @returns {Promise} */ export declare function patchCustom(handle: { meta(): Promise<{ custom?: ResourceMetadataCustom; etag?: string; } | null>; setMeta(meta: { custom?: ResourceMetadataCustom; }, options: { ifMatch?: string; }): Promise<{ etag?: string; }>; }, patch: ResourceMetadataCustom): Promise; //# sourceMappingURL=meta.d.ts.map