Skip to content

Class: DocumentChain ​

Defined in: fluent/chains.ts:231

A chainable document conversion path for POST /convert/document/.

Extends ​

  • Chain<ConversionState>

Accessors ​

operations ​

Get Signature ​

ts
get operations(): CdnOperation[];

Defined in: fluent/chain-base.ts:164

The operations accumulated so far (defensive copy).

Returns ​

CdnOperation[]

Inherited from ​

Chain.operations


path ​

Get Signature ​

ts
get path(): string;

Defined in: fluent/chains.ts:250

The domain-less REST conversion path.

Returns ​

string

Methods ​

dpi() ​

ts
dpi(value): this;

Defined in: fluent/chains.ts:241

Appends dpi; mirrors the creator in the matching conversion entry.

Parameters ​

ParameterType
value72 | 96 | 150 | 200 | 250 | 300 | 600

Returns ​

this


format() ​

ts
format(target): this;

Defined in: fluent/chains.ts:233

Appends format; mirrors the creator in the matching conversion entry.

Parameters ​

ParameterType
target| "html" | "svg" | "webp" | "png" | "avif" | "pdf" | "doc" | "docx" | "xls" | "xlsx" | "odt" | "ods" | "rtf" | "txt" | "pptx" | "jpg" | "gif" | "ico" | "bmp" | "tiff" | "pcx" | "ps" | "tga" | "wbmp" | "thumbnail"

Returns ​

this


getAllOps() ​

ts
getAllOps(ref): CdnOperation[];

Defined in: fluent/chain-base.ts:129

Every matching operation, in chain order. Mirrors CdnUrl.getAll.

Parameters ​

ParameterType
refOperationRef

Returns ​

CdnOperation[]

Example ​

ts
chain.getAllOps('overlay') // → [{ name: 'overlay', … }, …]

Inherited from ​

Chain.getAllOps


getOp() ​

ts
getOp(ref): CdnOperation | null;

Defined in: fluent/chain-base.ts:117

First matching operation, or null. Mirrors CdnUrl.get.

Parameters ​

ParameterType
refOperationRef

Returns ​

CdnOperation | null

Example ​

ts
myCdn.file(uuid).quality('smart').getOp('quality')
// → { name: 'quality', params: ['smart'] }

Inherited from ​

Chain.getOp


hasOp() ​

ts
hasOp(ref): boolean;

Defined in: fluent/chain-base.ts:104

Whether a matching operation is present. Mirrors CdnUrl.has; named with the Op suffix so it can never collide with a transformation method.

Parameters ​

ParameterType
refOperationRef

Returns ​

boolean

Example ​

ts
myCdn.file(uuid).quality('smart').hasOp(quality) // → true

Inherited from ​

Chain.hasOp


op() ​

ts
op(name, ...params): this;

Defined in: fluent/chain-base.ts:58

Appends an arbitrary operation without validation (escape hatch).

Parameters ​

ParameterType
namestring
...paramsstring[]

Returns ​

this

Inherited from ​

Chain.op


page() ​

ts
page(number): this;

Defined in: fluent/chains.ts:237

Appends page; mirrors the creator in the matching conversion entry.

Parameters ​

ParameterType
numbernumber

Returns ​

this


quality() ​

ts
quality(value): this;

Defined in: fluent/chains.ts:245

Appends quality; mirrors the creator in the matching conversion entry.

Parameters ​

ParameterType
value10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100

Returns ​

this


replaceAllOps() ​

ts
replaceAllOps(operation): this;

Defined in: fluent/chain-base.ts:157

Collapses every matching operation into one, kept at the position of the first match; appends when nothing matches. Mirrors CdnUrl.replaceAll.

Parameters ​

ParameterType
operationCdnOperation

Returns ​

this

Example ​

ts
chain.replaceAllOps({ name: 'overlay', params: [uuid] }).operations

Inherited from ​

Chain.replaceAllOps


replaceOp() ​

ts
replaceOp(operation): this;

Defined in: fluent/chain-base.ts:142

Replaces the first matching operation in place, or appends it. Mirrors CdnUrl.replace.

Parameters ​

ParameterType
operationCdnOperation

Returns ​

this

Example ​

ts
myCdn.file(uuid).resize({ width: 300 }).replaceOp(resize({ width: 500 })).href

Inherited from ​

Chain.replaceOp


toString() ​

ts
toString(): string;

Defined in: fluent/chains.ts:255

Alias of the terminal getter for string coercion.

Returns ​

string


updateOperations() ​

ts
updateOperations(update): this;

Defined in: fluent/chain-base.ts:89

The primitive the other operation mutators are sugar over: rewrites the whole chain through a callback, preserving the chain subtype. Mirrors CdnUrl.updateOperations, and is the only way to edit by position — replacing the nth stackable operation, inserting at an index, or reordering. It is also the sole edit path for conversion chains (video/document/gif2video), which cannot be re-parsed from output.

The callback receives a defensive copy; whatever it returns becomes the new chain.

Parameters ​

ParameterType
update(current) => readonly CdnOperation[]

Returns ​

this

Example ​

ts
cdn.video(uuid).size({ width: 720 }).thumbs(5)
  .updateOperations((ops) =>
    ops.map((op) => (op.name === 'size' ? size({ width: 480 }) : op))
  ).path // → /uuid/video/-/size/480x/-/thumbs~5/

Inherited from ​

Chain.updateOperations


withoutOp() ​

ts
withoutOp(ref): this;

Defined in: fluent/chain-base.ts:66

Removes every occurrence of an operation. Accepts the operation name, an operation object, or the creator itself: chain.withoutOp(resize).

Parameters ​

ParameterType
refOperationRef

Returns ​

this

Inherited from ​

Chain.withoutOp