@giveitsmaller/sdk 0.4.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_audit.js +67 -0
- package/dist/builder.d.ts +406 -0
- package/dist/builder.js +706 -0
- package/dist/client.d.ts +96 -2
- package/dist/client.js +968 -33
- package/dist/credentials.d.ts +61 -0
- package/dist/credentials.js +200 -0
- package/dist/ergonomic/preset_resolver.d.ts +75 -0
- package/dist/ergonomic/preset_resolver.js +568 -0
- package/dist/ergonomic/presets/_translate.d.ts +11 -0
- package/dist/ergonomic/presets/_translate.js +35 -0
- package/dist/ergonomic/presets/audio_compress.d.ts +16 -0
- package/dist/ergonomic/presets/audio_compress.js +45 -0
- package/dist/ergonomic/presets/document_epub_compress.d.ts +14 -0
- package/dist/ergonomic/presets/document_epub_compress.js +34 -0
- package/dist/ergonomic/presets/document_odf_compress.d.ts +14 -0
- package/dist/ergonomic/presets/document_odf_compress.js +34 -0
- package/dist/ergonomic/presets/document_office_compress.d.ts +16 -0
- package/dist/ergonomic/presets/document_office_compress.js +40 -0
- package/dist/ergonomic/presets/document_pdf_compress.d.ts +14 -0
- package/dist/ergonomic/presets/document_pdf_compress.js +35 -0
- package/dist/ergonomic/presets/image_compress.d.ts +43 -0
- package/dist/ergonomic/presets/image_compress.js +95 -0
- package/dist/ergonomic/presets/index.d.ts +77 -0
- package/dist/ergonomic/presets/index.js +216 -0
- package/dist/ergonomic/presets/video_compress.d.ts +30 -0
- package/dist/ergonomic/presets/video_compress.js +83 -0
- package/dist/errors.d.ts +251 -1
- package/dist/errors.js +268 -0
- package/dist/generated/sdk_spec/enums.d.ts +195 -0
- package/dist/generated/sdk_spec/enums.js +127 -0
- package/dist/generated/sdk_spec/errors.d.ts +16 -0
- package/dist/generated/sdk_spec/errors.js +473 -0
- package/dist/generated/sdk_spec/index.d.ts +4 -0
- package/dist/generated/sdk_spec/index.js +7 -0
- package/dist/generated/sdk_spec/presets.d.ts +6 -0
- package/dist/generated/sdk_spec/presets.js +157 -0
- package/dist/generated/sdk_spec/version.d.ts +3 -0
- package/dist/generated/sdk_spec/version.js +6 -0
- package/dist/gisl.d.ts +112 -0
- package/dist/gisl.js +266 -0
- package/dist/index.d.ts +17 -7
- package/dist/index.js +33 -3
- package/dist/merge.d.ts +142 -0
- package/dist/merge.js +411 -0
- package/dist/sse.d.ts +20 -1
- package/dist/sse.js +62 -3
- package/dist/types.d.ts +144 -14
- package/dist/types.js +18 -0
- package/package.json +2 -2
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// T4a — AudioCompressPresetOptions leaf DTO.
|
|
2
|
+
//
|
|
3
|
+
// Field set per ticket VhIj4S7T: audio = 4 fields
|
|
4
|
+
// (bitrate, channels, sampleRate, normalize).
|
|
5
|
+
// Trim is deliberately excluded — content selection lives on the per-call
|
|
6
|
+
// operation argument, not the preset cell.
|
|
7
|
+
import { shippedDefaultsFor as f3ShippedDefaultsFor } from '../../generated/sdk_spec/presets.js';
|
|
8
|
+
import { translateEnum } from './_translate.js';
|
|
9
|
+
export class AudioCompressPresetOptions {
|
|
10
|
+
bitrate;
|
|
11
|
+
channels;
|
|
12
|
+
sampleRate;
|
|
13
|
+
normalize;
|
|
14
|
+
constructor(input) {
|
|
15
|
+
if (input.bitrate !== undefined)
|
|
16
|
+
this.bitrate = input.bitrate;
|
|
17
|
+
if (input.channels !== undefined)
|
|
18
|
+
this.channels = input.channels;
|
|
19
|
+
if (input.sampleRate !== undefined)
|
|
20
|
+
this.sampleRate = input.sampleRate;
|
|
21
|
+
if (input.normalize !== undefined)
|
|
22
|
+
this.normalize = input.normalize;
|
|
23
|
+
Object.freeze(this);
|
|
24
|
+
}
|
|
25
|
+
static from(input) {
|
|
26
|
+
return new AudioCompressPresetOptions(input);
|
|
27
|
+
}
|
|
28
|
+
static shippedDefaultsFor(level) {
|
|
29
|
+
const cell = f3ShippedDefaultsFor('audio_compress', level);
|
|
30
|
+
const input = {};
|
|
31
|
+
const mut = input;
|
|
32
|
+
// bitrate / sampleRate values in PRESETS are member-name strings like
|
|
33
|
+
// "_96" / "_44100"; translateEnum resolves them to the numeric wire
|
|
34
|
+
// value (`AudioBitrate._96 === 96`).
|
|
35
|
+
if ('bitrate' in cell)
|
|
36
|
+
mut.bitrate = translateEnum('AudioBitrate', cell.bitrate);
|
|
37
|
+
if ('channels' in cell)
|
|
38
|
+
mut.channels = cell.channels;
|
|
39
|
+
if ('sampleRate' in cell)
|
|
40
|
+
mut.sampleRate = translateEnum('AudioSampleRate', cell.sampleRate);
|
|
41
|
+
if ('normalize' in cell)
|
|
42
|
+
mut.normalize = cell.normalize;
|
|
43
|
+
return new AudioCompressPresetOptions(input);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OptimizeFor } from '../../generated/sdk_spec/enums.js';
|
|
2
|
+
export interface DocumentEpubCompressPresetOptionsInput {
|
|
3
|
+
readonly imageQuality?: number;
|
|
4
|
+
readonly fontSubsetting?: boolean;
|
|
5
|
+
readonly stripUnusedCss?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class DocumentEpubCompressPresetOptions {
|
|
8
|
+
readonly imageQuality?: number;
|
|
9
|
+
readonly fontSubsetting?: boolean;
|
|
10
|
+
readonly stripUnusedCss?: boolean;
|
|
11
|
+
private constructor();
|
|
12
|
+
static from(input: DocumentEpubCompressPresetOptionsInput): DocumentEpubCompressPresetOptions;
|
|
13
|
+
static shippedDefaultsFor(level: OptimizeFor): DocumentEpubCompressPresetOptions;
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// T4a — DocumentEpubCompressPresetOptions leaf DTO.
|
|
2
|
+
//
|
|
3
|
+
// Field set per ticket VhIj4S7T: EPUB = 3 fields
|
|
4
|
+
// (imageQuality, fontSubsetting, stripUnusedCss). Primitives only.
|
|
5
|
+
import { shippedDefaultsFor as f3ShippedDefaultsFor } from '../../generated/sdk_spec/presets.js';
|
|
6
|
+
export class DocumentEpubCompressPresetOptions {
|
|
7
|
+
imageQuality;
|
|
8
|
+
fontSubsetting;
|
|
9
|
+
stripUnusedCss;
|
|
10
|
+
constructor(input) {
|
|
11
|
+
if (input.imageQuality !== undefined)
|
|
12
|
+
this.imageQuality = input.imageQuality;
|
|
13
|
+
if (input.fontSubsetting !== undefined)
|
|
14
|
+
this.fontSubsetting = input.fontSubsetting;
|
|
15
|
+
if (input.stripUnusedCss !== undefined)
|
|
16
|
+
this.stripUnusedCss = input.stripUnusedCss;
|
|
17
|
+
Object.freeze(this);
|
|
18
|
+
}
|
|
19
|
+
static from(input) {
|
|
20
|
+
return new DocumentEpubCompressPresetOptions(input);
|
|
21
|
+
}
|
|
22
|
+
static shippedDefaultsFor(level) {
|
|
23
|
+
const cell = f3ShippedDefaultsFor('document_epub_compress', level);
|
|
24
|
+
const input = {};
|
|
25
|
+
const mut = input;
|
|
26
|
+
if ('imageQuality' in cell)
|
|
27
|
+
mut.imageQuality = cell.imageQuality;
|
|
28
|
+
if ('fontSubsetting' in cell)
|
|
29
|
+
mut.fontSubsetting = cell.fontSubsetting;
|
|
30
|
+
if ('stripUnusedCss' in cell)
|
|
31
|
+
mut.stripUnusedCss = cell.stripUnusedCss;
|
|
32
|
+
return new DocumentEpubCompressPresetOptions(input);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OptimizeFor } from '../../generated/sdk_spec/enums.js';
|
|
2
|
+
export interface DocumentOdfCompressPresetOptionsInput {
|
|
3
|
+
readonly imageQuality?: number;
|
|
4
|
+
readonly stripMetadata?: boolean;
|
|
5
|
+
readonly stripUnusedStyles?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class DocumentOdfCompressPresetOptions {
|
|
8
|
+
readonly imageQuality?: number;
|
|
9
|
+
readonly stripMetadata?: boolean;
|
|
10
|
+
readonly stripUnusedStyles?: boolean;
|
|
11
|
+
private constructor();
|
|
12
|
+
static from(input: DocumentOdfCompressPresetOptionsInput): DocumentOdfCompressPresetOptions;
|
|
13
|
+
static shippedDefaultsFor(level: OptimizeFor): DocumentOdfCompressPresetOptions;
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// T4a — DocumentOdfCompressPresetOptions leaf DTO.
|
|
2
|
+
//
|
|
3
|
+
// Field set per ticket VhIj4S7T: ODF = 3 fields
|
|
4
|
+
// (imageQuality, stripMetadata, stripUnusedStyles). Primitives only.
|
|
5
|
+
import { shippedDefaultsFor as f3ShippedDefaultsFor } from '../../generated/sdk_spec/presets.js';
|
|
6
|
+
export class DocumentOdfCompressPresetOptions {
|
|
7
|
+
imageQuality;
|
|
8
|
+
stripMetadata;
|
|
9
|
+
stripUnusedStyles;
|
|
10
|
+
constructor(input) {
|
|
11
|
+
if (input.imageQuality !== undefined)
|
|
12
|
+
this.imageQuality = input.imageQuality;
|
|
13
|
+
if (input.stripMetadata !== undefined)
|
|
14
|
+
this.stripMetadata = input.stripMetadata;
|
|
15
|
+
if (input.stripUnusedStyles !== undefined)
|
|
16
|
+
this.stripUnusedStyles = input.stripUnusedStyles;
|
|
17
|
+
Object.freeze(this);
|
|
18
|
+
}
|
|
19
|
+
static from(input) {
|
|
20
|
+
return new DocumentOdfCompressPresetOptions(input);
|
|
21
|
+
}
|
|
22
|
+
static shippedDefaultsFor(level) {
|
|
23
|
+
const cell = f3ShippedDefaultsFor('document_odf_compress', level);
|
|
24
|
+
const input = {};
|
|
25
|
+
const mut = input;
|
|
26
|
+
if ('imageQuality' in cell)
|
|
27
|
+
mut.imageQuality = cell.imageQuality;
|
|
28
|
+
if ('stripMetadata' in cell)
|
|
29
|
+
mut.stripMetadata = cell.stripMetadata;
|
|
30
|
+
if ('stripUnusedStyles' in cell)
|
|
31
|
+
mut.stripUnusedStyles = cell.stripUnusedStyles;
|
|
32
|
+
return new DocumentOdfCompressPresetOptions(input);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OptimizeFor } from '../../generated/sdk_spec/enums.js';
|
|
2
|
+
export interface DocumentOfficeCompressPresetOptionsInput {
|
|
3
|
+
readonly imageQuality?: number;
|
|
4
|
+
readonly stripMacros?: boolean;
|
|
5
|
+
readonly stripHiddenData?: boolean;
|
|
6
|
+
readonly stripUnusedFonts?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class DocumentOfficeCompressPresetOptions {
|
|
9
|
+
readonly imageQuality?: number;
|
|
10
|
+
readonly stripMacros?: boolean;
|
|
11
|
+
readonly stripHiddenData?: boolean;
|
|
12
|
+
readonly stripUnusedFonts?: boolean;
|
|
13
|
+
private constructor();
|
|
14
|
+
static from(input: DocumentOfficeCompressPresetOptionsInput): DocumentOfficeCompressPresetOptions;
|
|
15
|
+
static shippedDefaultsFor(level: OptimizeFor): DocumentOfficeCompressPresetOptions;
|
|
16
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// T4a — DocumentOfficeCompressPresetOptions leaf DTO.
|
|
2
|
+
//
|
|
3
|
+
// Field set per ticket VhIj4S7T: office = 4 fields
|
|
4
|
+
// (imageQuality, stripMacros, stripHiddenData, stripUnusedFonts).
|
|
5
|
+
// All primitive values — no enum translation needed.
|
|
6
|
+
import { shippedDefaultsFor as f3ShippedDefaultsFor } from '../../generated/sdk_spec/presets.js';
|
|
7
|
+
export class DocumentOfficeCompressPresetOptions {
|
|
8
|
+
imageQuality;
|
|
9
|
+
stripMacros;
|
|
10
|
+
stripHiddenData;
|
|
11
|
+
stripUnusedFonts;
|
|
12
|
+
constructor(input) {
|
|
13
|
+
if (input.imageQuality !== undefined)
|
|
14
|
+
this.imageQuality = input.imageQuality;
|
|
15
|
+
if (input.stripMacros !== undefined)
|
|
16
|
+
this.stripMacros = input.stripMacros;
|
|
17
|
+
if (input.stripHiddenData !== undefined)
|
|
18
|
+
this.stripHiddenData = input.stripHiddenData;
|
|
19
|
+
if (input.stripUnusedFonts !== undefined)
|
|
20
|
+
this.stripUnusedFonts = input.stripUnusedFonts;
|
|
21
|
+
Object.freeze(this);
|
|
22
|
+
}
|
|
23
|
+
static from(input) {
|
|
24
|
+
return new DocumentOfficeCompressPresetOptions(input);
|
|
25
|
+
}
|
|
26
|
+
static shippedDefaultsFor(level) {
|
|
27
|
+
const cell = f3ShippedDefaultsFor('document_office_compress', level);
|
|
28
|
+
const input = {};
|
|
29
|
+
const mut = input;
|
|
30
|
+
if ('imageQuality' in cell)
|
|
31
|
+
mut.imageQuality = cell.imageQuality;
|
|
32
|
+
if ('stripMacros' in cell)
|
|
33
|
+
mut.stripMacros = cell.stripMacros;
|
|
34
|
+
if ('stripHiddenData' in cell)
|
|
35
|
+
mut.stripHiddenData = cell.stripHiddenData;
|
|
36
|
+
if ('stripUnusedFonts' in cell)
|
|
37
|
+
mut.stripUnusedFonts = cell.stripUnusedFonts;
|
|
38
|
+
return new DocumentOfficeCompressPresetOptions(input);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PdfProfile, PdfColorspace, OptimizeFor } from '../../generated/sdk_spec/enums.js';
|
|
2
|
+
export interface DocumentPdfCompressPresetOptionsInput {
|
|
3
|
+
readonly profile?: PdfProfile;
|
|
4
|
+
readonly colorspace?: PdfColorspace;
|
|
5
|
+
readonly flattenForms?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class DocumentPdfCompressPresetOptions {
|
|
8
|
+
readonly profile?: PdfProfile;
|
|
9
|
+
readonly colorspace?: PdfColorspace;
|
|
10
|
+
readonly flattenForms?: boolean;
|
|
11
|
+
private constructor();
|
|
12
|
+
static from(input: DocumentPdfCompressPresetOptionsInput): DocumentPdfCompressPresetOptions;
|
|
13
|
+
static shippedDefaultsFor(level: OptimizeFor): DocumentPdfCompressPresetOptions;
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// T4a — DocumentPdfCompressPresetOptions leaf DTO.
|
|
2
|
+
//
|
|
3
|
+
// Field set per ticket VhIj4S7T: PDF = 3 fields (profile, colorspace, flattenForms).
|
|
4
|
+
// Deliberately excluded: `pages` (per-call content selection).
|
|
5
|
+
import { shippedDefaultsFor as f3ShippedDefaultsFor } from '../../generated/sdk_spec/presets.js';
|
|
6
|
+
import { translateEnum } from './_translate.js';
|
|
7
|
+
export class DocumentPdfCompressPresetOptions {
|
|
8
|
+
profile;
|
|
9
|
+
colorspace;
|
|
10
|
+
flattenForms;
|
|
11
|
+
constructor(input) {
|
|
12
|
+
if (input.profile !== undefined)
|
|
13
|
+
this.profile = input.profile;
|
|
14
|
+
if (input.colorspace !== undefined)
|
|
15
|
+
this.colorspace = input.colorspace;
|
|
16
|
+
if (input.flattenForms !== undefined)
|
|
17
|
+
this.flattenForms = input.flattenForms;
|
|
18
|
+
Object.freeze(this);
|
|
19
|
+
}
|
|
20
|
+
static from(input) {
|
|
21
|
+
return new DocumentPdfCompressPresetOptions(input);
|
|
22
|
+
}
|
|
23
|
+
static shippedDefaultsFor(level) {
|
|
24
|
+
const cell = f3ShippedDefaultsFor('document_pdf_compress', level);
|
|
25
|
+
const input = {};
|
|
26
|
+
const mut = input;
|
|
27
|
+
if ('profile' in cell)
|
|
28
|
+
mut.profile = translateEnum('PdfProfile', cell.profile);
|
|
29
|
+
if ('colorspace' in cell)
|
|
30
|
+
mut.colorspace = translateEnum('PdfColorspace', cell.colorspace);
|
|
31
|
+
if ('flattenForms' in cell)
|
|
32
|
+
mut.flattenForms = cell.flattenForms;
|
|
33
|
+
return new DocumentPdfCompressPresetOptions(input);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ImageMode, ImageFit, ImageMetadataPolicy, IccProfilePolicy, ImageFormat, OptimizeFor } from '../../generated/sdk_spec/enums.js';
|
|
2
|
+
export interface ImageCompressPresetOptionsInput {
|
|
3
|
+
readonly mode?: ImageMode;
|
|
4
|
+
readonly quality?: number;
|
|
5
|
+
readonly width?: number;
|
|
6
|
+
readonly height?: number;
|
|
7
|
+
readonly fit?: ImageFit;
|
|
8
|
+
readonly metadata?: ImageMetadataPolicy;
|
|
9
|
+
readonly iccProfile?: IccProfilePolicy;
|
|
10
|
+
readonly autoOrient?: boolean;
|
|
11
|
+
readonly progressive?: boolean;
|
|
12
|
+
readonly outputFormat?: ImageFormat;
|
|
13
|
+
}
|
|
14
|
+
export declare class ImageCompressPresetOptions {
|
|
15
|
+
readonly mode?: ImageMode;
|
|
16
|
+
readonly quality?: number;
|
|
17
|
+
readonly width?: number;
|
|
18
|
+
readonly height?: number;
|
|
19
|
+
readonly fit?: ImageFit;
|
|
20
|
+
readonly metadata?: ImageMetadataPolicy;
|
|
21
|
+
readonly iccProfile?: IccProfilePolicy;
|
|
22
|
+
readonly autoOrient?: boolean;
|
|
23
|
+
readonly progressive?: boolean;
|
|
24
|
+
readonly outputFormat?: ImageFormat;
|
|
25
|
+
private constructor();
|
|
26
|
+
/**
|
|
27
|
+
* Construct a leaf DTO from a sparse caller-supplied delta. Fields the
|
|
28
|
+
* caller omits stay undefined on the instance — they are NOT filled
|
|
29
|
+
* from shipped defaults here (the resolver in T4b merges layers).
|
|
30
|
+
*/
|
|
31
|
+
static from(input: ImageCompressPresetOptionsInput): ImageCompressPresetOptions;
|
|
32
|
+
/**
|
|
33
|
+
* Return the SDK shipped defaults for the (image, compress) cell at
|
|
34
|
+
* the given level. Reads the F3 PRESETS matrix and translates member
|
|
35
|
+
* names to wire backing values.
|
|
36
|
+
*
|
|
37
|
+
* Note for OptimizeFor.Quality: the F3 PRESETS cell deliberately
|
|
38
|
+
* omits `quality` because the contract has `depends_on: { mode: lossy }`
|
|
39
|
+
* on the quality field — under `mode: Lossless` the API ignores
|
|
40
|
+
* `quality`, so shipping a default would mislead callers.
|
|
41
|
+
*/
|
|
42
|
+
static shippedDefaultsFor(level: OptimizeFor): ImageCompressPresetOptions;
|
|
43
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// T4a — ImageCompressPresetOptions leaf DTO.
|
|
2
|
+
//
|
|
3
|
+
// Sparse delta over the wire `CompressImageOptions` surface. Every field
|
|
4
|
+
// is optional + readonly; an unset field means "fall through to the next
|
|
5
|
+
// layer" (shipped defaults / user delta / per-call override). Mapped via
|
|
6
|
+
// the ergonomic enum types from `../../generated/sdk_spec/enums.ts`, whose
|
|
7
|
+
// values ARE the wire backing values — so the leaf DTO is wire-compatible
|
|
8
|
+
// once the resolver (T4b) snake_cases the property names.
|
|
9
|
+
//
|
|
10
|
+
// Field set per ticket VhIj4S7T (codex r3 lock): image = 10 fields
|
|
11
|
+
// (mode, quality, width, height, fit, metadata, iccProfile, autoOrient,
|
|
12
|
+
// progressive, outputFormat).
|
|
13
|
+
// Trim / per-call knobs are deliberately excluded — they belong on the
|
|
14
|
+
// per-call argument shape, not the preset cell.
|
|
15
|
+
import { shippedDefaultsFor as f3ShippedDefaultsFor } from '../../generated/sdk_spec/presets.js';
|
|
16
|
+
import { translateEnum } from './_translate.js';
|
|
17
|
+
export class ImageCompressPresetOptions {
|
|
18
|
+
mode;
|
|
19
|
+
quality;
|
|
20
|
+
width;
|
|
21
|
+
height;
|
|
22
|
+
fit;
|
|
23
|
+
metadata;
|
|
24
|
+
iccProfile;
|
|
25
|
+
autoOrient;
|
|
26
|
+
progressive;
|
|
27
|
+
outputFormat;
|
|
28
|
+
constructor(input) {
|
|
29
|
+
if (input.mode !== undefined)
|
|
30
|
+
this.mode = input.mode;
|
|
31
|
+
if (input.quality !== undefined)
|
|
32
|
+
this.quality = input.quality;
|
|
33
|
+
if (input.width !== undefined)
|
|
34
|
+
this.width = input.width;
|
|
35
|
+
if (input.height !== undefined)
|
|
36
|
+
this.height = input.height;
|
|
37
|
+
if (input.fit !== undefined)
|
|
38
|
+
this.fit = input.fit;
|
|
39
|
+
if (input.metadata !== undefined)
|
|
40
|
+
this.metadata = input.metadata;
|
|
41
|
+
if (input.iccProfile !== undefined)
|
|
42
|
+
this.iccProfile = input.iccProfile;
|
|
43
|
+
if (input.autoOrient !== undefined)
|
|
44
|
+
this.autoOrient = input.autoOrient;
|
|
45
|
+
if (input.progressive !== undefined)
|
|
46
|
+
this.progressive = input.progressive;
|
|
47
|
+
if (input.outputFormat !== undefined)
|
|
48
|
+
this.outputFormat = input.outputFormat;
|
|
49
|
+
Object.freeze(this);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Construct a leaf DTO from a sparse caller-supplied delta. Fields the
|
|
53
|
+
* caller omits stay undefined on the instance — they are NOT filled
|
|
54
|
+
* from shipped defaults here (the resolver in T4b merges layers).
|
|
55
|
+
*/
|
|
56
|
+
static from(input) {
|
|
57
|
+
return new ImageCompressPresetOptions(input);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Return the SDK shipped defaults for the (image, compress) cell at
|
|
61
|
+
* the given level. Reads the F3 PRESETS matrix and translates member
|
|
62
|
+
* names to wire backing values.
|
|
63
|
+
*
|
|
64
|
+
* Note for OptimizeFor.Quality: the F3 PRESETS cell deliberately
|
|
65
|
+
* omits `quality` because the contract has `depends_on: { mode: lossy }`
|
|
66
|
+
* on the quality field — under `mode: Lossless` the API ignores
|
|
67
|
+
* `quality`, so shipping a default would mislead callers.
|
|
68
|
+
*/
|
|
69
|
+
static shippedDefaultsFor(level) {
|
|
70
|
+
const cell = f3ShippedDefaultsFor('image_compress', level);
|
|
71
|
+
const input = {};
|
|
72
|
+
const mut = input;
|
|
73
|
+
if ('mode' in cell)
|
|
74
|
+
mut.mode = translateEnum('ImageMode', cell.mode);
|
|
75
|
+
if ('quality' in cell)
|
|
76
|
+
mut.quality = cell.quality;
|
|
77
|
+
if ('width' in cell)
|
|
78
|
+
mut.width = cell.width;
|
|
79
|
+
if ('height' in cell)
|
|
80
|
+
mut.height = cell.height;
|
|
81
|
+
if ('fit' in cell)
|
|
82
|
+
mut.fit = translateEnum('ImageFit', cell.fit);
|
|
83
|
+
if ('metadata' in cell)
|
|
84
|
+
mut.metadata = translateEnum('ImageMetadataPolicy', cell.metadata);
|
|
85
|
+
if ('iccProfile' in cell)
|
|
86
|
+
mut.iccProfile = translateEnum('IccProfilePolicy', cell.iccProfile);
|
|
87
|
+
if ('autoOrient' in cell)
|
|
88
|
+
mut.autoOrient = cell.autoOrient;
|
|
89
|
+
if ('progressive' in cell)
|
|
90
|
+
mut.progressive = cell.progressive;
|
|
91
|
+
if ('outputFormat' in cell)
|
|
92
|
+
mut.outputFormat = translateEnum('ImageFormat', cell.outputFormat);
|
|
93
|
+
return new ImageCompressPresetOptions(input);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { OptimizeFor } from '../../generated/sdk_spec/enums.js';
|
|
2
|
+
import { ImageCompressPresetOptions, type ImageCompressPresetOptionsInput } from './image_compress.js';
|
|
3
|
+
import { AudioCompressPresetOptions, type AudioCompressPresetOptionsInput } from './audio_compress.js';
|
|
4
|
+
import { VideoCompressPresetOptions, type VideoCompressPresetOptionsInput } from './video_compress.js';
|
|
5
|
+
import { DocumentPdfCompressPresetOptions, type DocumentPdfCompressPresetOptionsInput } from './document_pdf_compress.js';
|
|
6
|
+
import { DocumentOfficeCompressPresetOptions, type DocumentOfficeCompressPresetOptionsInput } from './document_office_compress.js';
|
|
7
|
+
import { DocumentOdfCompressPresetOptions, type DocumentOdfCompressPresetOptionsInput } from './document_odf_compress.js';
|
|
8
|
+
import { DocumentEpubCompressPresetOptions, type DocumentEpubCompressPresetOptionsInput } from './document_epub_compress.js';
|
|
9
|
+
export { ImageCompressPresetOptions, type ImageCompressPresetOptionsInput, } from './image_compress.js';
|
|
10
|
+
export { AudioCompressPresetOptions, type AudioCompressPresetOptionsInput, } from './audio_compress.js';
|
|
11
|
+
export { VideoCompressPresetOptions, type VideoCompressPresetOptionsInput, } from './video_compress.js';
|
|
12
|
+
export { DocumentPdfCompressPresetOptions, type DocumentPdfCompressPresetOptionsInput, } from './document_pdf_compress.js';
|
|
13
|
+
export { DocumentOfficeCompressPresetOptions, type DocumentOfficeCompressPresetOptionsInput, } from './document_office_compress.js';
|
|
14
|
+
export { DocumentOdfCompressPresetOptions, type DocumentOdfCompressPresetOptionsInput, } from './document_odf_compress.js';
|
|
15
|
+
export { DocumentEpubCompressPresetOptions, type DocumentEpubCompressPresetOptionsInput, } from './document_epub_compress.js';
|
|
16
|
+
export { OptimizeFor, ImageMode, ImageFit, ImageMetadataPolicy, IccProfilePolicy, ImageFormat, VideoCodec, VideoPreset, VideoFit, AudioBitrate, AudioCodec, AudioSampleRate, PdfProfile, PdfColorspace, } from '../../generated/sdk_spec/enums.js';
|
|
17
|
+
/** Supported media×op pairs for preset cells in T4a. Compress-only. */
|
|
18
|
+
export type PresetMedia = 'image' | 'audio' | 'video' | 'document_pdf' | 'document_office' | 'document_odf' | 'document_epub';
|
|
19
|
+
export type PresetOp = 'compress';
|
|
20
|
+
/**
|
|
21
|
+
* Union of leaf-DTO types the resolver will see from `cellFor()`.
|
|
22
|
+
* Discriminated by which `media` the caller passes — the type system
|
|
23
|
+
* narrows the return automatically via the overload set below.
|
|
24
|
+
*/
|
|
25
|
+
export type AnyPresetOptions = ImageCompressPresetOptions | AudioCompressPresetOptions | VideoCompressPresetOptions | DocumentPdfCompressPresetOptions | DocumentOfficeCompressPresetOptions | DocumentOdfCompressPresetOptions | DocumentEpubCompressPresetOptions;
|
|
26
|
+
export declare class PresetDefaults {
|
|
27
|
+
private readonly cells;
|
|
28
|
+
private constructor();
|
|
29
|
+
/** Empty builder — entry point for `presetDefaults()`. @internal */
|
|
30
|
+
static _empty(): PresetDefaults;
|
|
31
|
+
/**
|
|
32
|
+
* Deep-merge two {@link PresetDefaults} into a new instance (T4c —
|
|
33
|
+
* `ULAlOP6j`). Used by `withPresetDefaults` to stack scoped derives:
|
|
34
|
+
* `client.withPresetDefaults(a).withPresetDefaults(b)` produces a
|
|
35
|
+
* scoped layer equivalent to `merge(a, b)` — `b`'s per-cell fields
|
|
36
|
+
* override `a`'s where defined; `a`'s fields fill gaps.
|
|
37
|
+
*
|
|
38
|
+
* Per-cell semantics (codex r2 #5 — scalar-leaf merge):
|
|
39
|
+
* - If a `(cellKey, level)` entry is present in EITHER only, take it
|
|
40
|
+
* verbatim.
|
|
41
|
+
* - If present in both, merge the per-cell `*Input` shapes via
|
|
42
|
+
* `Object.assign({}, parentInput, childInput)` and re-construct
|
|
43
|
+
* the leaf DTO. Every cell-DTO field is a scalar (primitive,
|
|
44
|
+
* enum-string, or `string | number` for `targetSize`) — shallow
|
|
45
|
+
* merge gives the correct field-wise override.
|
|
46
|
+
*
|
|
47
|
+
* Parent and child instances are unaffected.
|
|
48
|
+
*/
|
|
49
|
+
static merge(parent: PresetDefaults, child: PresetDefaults): PresetDefaults;
|
|
50
|
+
/** Register a (level, delta) on the image-compress cell. Immutable. */
|
|
51
|
+
imageCompress(level: OptimizeFor, input?: ImageCompressPresetOptionsInput): PresetDefaults;
|
|
52
|
+
/** Register a (level, delta) on the audio-compress cell. Immutable. */
|
|
53
|
+
audioCompress(level: OptimizeFor, input?: AudioCompressPresetOptionsInput): PresetDefaults;
|
|
54
|
+
/** Register a (level, delta) on the video-compress cell. Immutable. */
|
|
55
|
+
videoCompress(level: OptimizeFor, input?: VideoCompressPresetOptionsInput): PresetDefaults;
|
|
56
|
+
/** Register a (level, delta) on the document-pdf-compress cell. Immutable. */
|
|
57
|
+
pdfCompress(level: OptimizeFor, input?: DocumentPdfCompressPresetOptionsInput): PresetDefaults;
|
|
58
|
+
/** Register a (level, delta) on the document-office-compress cell. Immutable. */
|
|
59
|
+
officeCompress(level: OptimizeFor, input?: DocumentOfficeCompressPresetOptionsInput): PresetDefaults;
|
|
60
|
+
/** Register a (level, delta) on the document-odf-compress cell. Immutable. */
|
|
61
|
+
odfCompress(level: OptimizeFor, input?: DocumentOdfCompressPresetOptionsInput): PresetDefaults;
|
|
62
|
+
/** Register a (level, delta) on the document-epub-compress cell. Immutable. */
|
|
63
|
+
epubCompress(level: OptimizeFor, input?: DocumentEpubCompressPresetOptionsInput): PresetDefaults;
|
|
64
|
+
/** @internal */ cellFor(media: 'image', op: 'compress', level: OptimizeFor): ImageCompressPresetOptions | undefined;
|
|
65
|
+
/** @internal */ cellFor(media: 'audio', op: 'compress', level: OptimizeFor): AudioCompressPresetOptions | undefined;
|
|
66
|
+
/** @internal */ cellFor(media: 'video', op: 'compress', level: OptimizeFor): VideoCompressPresetOptions | undefined;
|
|
67
|
+
/** @internal */ cellFor(media: 'document_pdf', op: 'compress', level: OptimizeFor): DocumentPdfCompressPresetOptions | undefined;
|
|
68
|
+
/** @internal */ cellFor(media: 'document_office', op: 'compress', level: OptimizeFor): DocumentOfficeCompressPresetOptions | undefined;
|
|
69
|
+
/** @internal */ cellFor(media: 'document_odf', op: 'compress', level: OptimizeFor): DocumentOdfCompressPresetOptions | undefined;
|
|
70
|
+
/** @internal */ cellFor(media: 'document_epub', op: 'compress', level: OptimizeFor): DocumentEpubCompressPresetOptions | undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Construct an empty {@link PresetDefaults} builder. Chain per-cell
|
|
74
|
+
* methods to register layered defaults; the resolver in T4b consumes
|
|
75
|
+
* the result via `cellFor(...)`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function presetDefaults(): PresetDefaults;
|