@giveitsmaller/sdk 0.18.0 → 0.20.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/README.md +1 -1
- package/dist/_audit.js +12 -0
- package/dist/builder.d.ts +1 -0
- package/dist/client.d.ts +8 -1
- package/dist/client.js +27 -32
- package/dist/ergonomic/image_output_routes.d.ts +6 -5
- package/dist/ergonomic/image_output_routes.js +29 -21
- package/dist/ergonomic/option_types.d.ts +85 -11
- package/dist/ergonomic/option_types.js +11 -6
- package/dist/ergonomic/option_validation.d.ts +21 -3
- package/dist/ergonomic/option_validation.js +36 -3
- package/dist/ergonomic/preset_resolver.d.ts +1 -1
- package/dist/ergonomic/preset_resolver.js +6 -7
- package/dist/ergonomic/presets/document_epub_compress.d.ts +0 -2
- package/dist/ergonomic/presets/document_epub_compress.js +2 -7
- package/dist/ergonomic/presets/document_odf_compress.d.ts +0 -2
- package/dist/ergonomic/presets/document_odf_compress.js +2 -7
- package/dist/ergonomic/presets/document_office_compress.d.ts +0 -2
- package/dist/ergonomic/presets/document_office_compress.js +2 -7
- package/dist/errors.d.ts +57 -1
- package/dist/errors.js +82 -1
- package/dist/file-first.d.ts +195 -8
- package/dist/file-first.js +462 -124
- package/dist/generated/sdk_spec/enums.d.ts +4 -2
- package/dist/generated/sdk_spec/enums.js +11 -5
- package/dist/generated/sdk_spec/presets.js +3 -12
- package/dist/generated/sdk_spec/version.d.ts +3 -3
- package/dist/generated/sdk_spec/version.js +3 -3
- package/dist/gisl.d.ts +72 -3
- package/dist/gisl.js +72 -2
- package/dist/index.core.d.ts +8 -6
- package/dist/index.core.js +9 -1
- package/dist/merge.d.ts +12 -0
- package/dist/merge.js +12 -0
- package/dist/retry-metadata.d.ts +37 -0
- package/dist/retry-metadata.js +86 -0
- package/dist/sse.d.ts +2 -1
- package/dist/sse.js +26 -6
- package/dist/types.d.ts +43 -1
- package/package.json +2 -2
|
@@ -10,8 +10,9 @@ export declare const ImageFormat: {
|
|
|
10
10
|
};
|
|
11
11
|
export type ImageFormat = typeof ImageFormat[keyof typeof ImageFormat];
|
|
12
12
|
export declare const ImageMetadataPolicy: {
|
|
13
|
-
readonly
|
|
13
|
+
readonly Strip: "strip";
|
|
14
14
|
readonly Keep: "keep";
|
|
15
|
+
readonly All: "all";
|
|
15
16
|
};
|
|
16
17
|
export type ImageMetadataPolicy = typeof ImageMetadataPolicy[keyof typeof ImageMetadataPolicy];
|
|
17
18
|
export declare const VideoCodec: {
|
|
@@ -88,8 +89,9 @@ export declare const ERGONOMIC_ENUMS: {
|
|
|
88
89
|
readonly Webp: "webp";
|
|
89
90
|
};
|
|
90
91
|
readonly ImageMetadataPolicy: {
|
|
91
|
-
readonly
|
|
92
|
+
readonly Strip: "strip";
|
|
92
93
|
readonly Keep: "keep";
|
|
94
|
+
readonly All: "all";
|
|
93
95
|
};
|
|
94
96
|
readonly VideoCodec: {
|
|
95
97
|
readonly H264: "h264";
|
|
@@ -13,15 +13,21 @@ export const ImageFormat = {
|
|
|
13
13
|
Webp: "webp",
|
|
14
14
|
};
|
|
15
15
|
// Image metadata handling (compress.image, optimiser/same_format route):
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
16
|
+
// Strip = remove all EXIF/IPTC/XMP (default, smallest file) — the canonical
|
|
17
|
+
// strip token (renamed from `all` 2026-06-23; `all` reading as
|
|
18
|
+
// "strip all" was counterintuitive).
|
|
19
|
+
// Keep = preserve EXIF/ICC/XMP — worker-proven on the libcaesium formats
|
|
20
|
+
// (JPEG/PNG/WebP/GIF/TIFF; lambdas PR #260, un-parked 2026-06-23).
|
|
21
|
+
// All = DEPRECATED alias of Strip (still accepted on the wire, emits
|
|
22
|
+
// Deprecation/Sunset; the API lowers `strip`→`all` at the worker
|
|
23
|
+
// boundary). Migrate to Strip.
|
|
19
24
|
// Keep is NOT available for AVIF (ravif) / SVG (SVGO) — those re-encode from
|
|
20
25
|
// pixels and cannot preserve metadata, so the worker rejects it there (the
|
|
21
|
-
// `metadata` enum is narrowed to [all] on those groups).
|
|
26
|
+
// `metadata` enum is narrowed to [strip, all] on those groups).
|
|
22
27
|
export const ImageMetadataPolicy = {
|
|
23
|
-
|
|
28
|
+
Strip: "strip",
|
|
24
29
|
Keep: "keep",
|
|
30
|
+
All: "all",
|
|
25
31
|
};
|
|
26
32
|
// Video codec. H264 = widest compatibility; H265/Av1 = better compression but slower.
|
|
27
33
|
export const VideoCodec = {
|
|
@@ -5,17 +5,17 @@ export const PRESETS = Object.freeze({
|
|
|
5
5
|
"image_compress": Object.freeze({
|
|
6
6
|
Size: Object.freeze({
|
|
7
7
|
"quality": 65,
|
|
8
|
-
"metadata": "
|
|
8
|
+
"metadata": "Strip",
|
|
9
9
|
"outputFormat": "Original",
|
|
10
10
|
}),
|
|
11
11
|
Balanced: Object.freeze({
|
|
12
12
|
"quality": 80,
|
|
13
|
-
"metadata": "
|
|
13
|
+
"metadata": "Strip",
|
|
14
14
|
"outputFormat": "Original",
|
|
15
15
|
}),
|
|
16
16
|
Quality: Object.freeze({
|
|
17
17
|
"quality": 92,
|
|
18
|
-
"metadata": "
|
|
18
|
+
"metadata": "Strip",
|
|
19
19
|
"outputFormat": "Original",
|
|
20
20
|
}),
|
|
21
21
|
}),
|
|
@@ -66,19 +66,16 @@ export const PRESETS = Object.freeze({
|
|
|
66
66
|
}),
|
|
67
67
|
"document_office_compress": Object.freeze({
|
|
68
68
|
Size: Object.freeze({
|
|
69
|
-
"imageQuality": 60,
|
|
70
69
|
"stripMacros": true,
|
|
71
70
|
"stripHiddenData": true,
|
|
72
71
|
"stripUnusedFonts": true,
|
|
73
72
|
}),
|
|
74
73
|
Balanced: Object.freeze({
|
|
75
|
-
"imageQuality": 80,
|
|
76
74
|
"stripMacros": true,
|
|
77
75
|
"stripHiddenData": false,
|
|
78
76
|
"stripUnusedFonts": false,
|
|
79
77
|
}),
|
|
80
78
|
Quality: Object.freeze({
|
|
81
|
-
"imageQuality": 92,
|
|
82
79
|
"stripMacros": false,
|
|
83
80
|
"stripHiddenData": false,
|
|
84
81
|
"stripUnusedFonts": false,
|
|
@@ -86,34 +83,28 @@ export const PRESETS = Object.freeze({
|
|
|
86
83
|
}),
|
|
87
84
|
"document_odf_compress": Object.freeze({
|
|
88
85
|
Size: Object.freeze({
|
|
89
|
-
"imageQuality": 60,
|
|
90
86
|
"stripMetadata": true,
|
|
91
87
|
"stripUnusedStyles": true,
|
|
92
88
|
}),
|
|
93
89
|
Balanced: Object.freeze({
|
|
94
|
-
"imageQuality": 80,
|
|
95
90
|
"stripMetadata": true,
|
|
96
91
|
"stripUnusedStyles": false,
|
|
97
92
|
}),
|
|
98
93
|
Quality: Object.freeze({
|
|
99
|
-
"imageQuality": 92,
|
|
100
94
|
"stripMetadata": false,
|
|
101
95
|
"stripUnusedStyles": false,
|
|
102
96
|
}),
|
|
103
97
|
}),
|
|
104
98
|
"document_epub_compress": Object.freeze({
|
|
105
99
|
Size: Object.freeze({
|
|
106
|
-
"imageQuality": 60,
|
|
107
100
|
"fontSubsetting": true,
|
|
108
101
|
"stripUnusedCss": true,
|
|
109
102
|
}),
|
|
110
103
|
Balanced: Object.freeze({
|
|
111
|
-
"imageQuality": 80,
|
|
112
104
|
"fontSubsetting": true,
|
|
113
105
|
"stripUnusedCss": false,
|
|
114
106
|
}),
|
|
115
107
|
Quality: Object.freeze({
|
|
116
|
-
"imageQuality": 92,
|
|
117
108
|
"fontSubsetting": false,
|
|
118
109
|
"stripUnusedCss": false,
|
|
119
110
|
}),
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const SDK_SPEC_VERSION: "2.
|
|
2
|
-
export declare const PRESET_VERSION: "1.
|
|
3
|
-
export declare const PRESET_CONFIG_HASH: "sha256:
|
|
1
|
+
export declare const SDK_SPEC_VERSION: "2.2.0";
|
|
2
|
+
export declare const PRESET_VERSION: "1.6";
|
|
3
|
+
export declare const PRESET_CONFIG_HASH: "sha256:0fe215aede1da13430380384c58226d074c3b8344c091efc53e097c2930a34f7";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// CODE GENERATED — DO NOT EDIT.
|
|
2
2
|
// Source: compression_contracts/sdk-spec/ (see sdk-spec/README.md).
|
|
3
3
|
// Regenerate with: scripts/generate.py.
|
|
4
|
-
export const SDK_SPEC_VERSION = "2.
|
|
5
|
-
export const PRESET_VERSION = "1.
|
|
6
|
-
export const PRESET_CONFIG_HASH = "sha256:
|
|
4
|
+
export const SDK_SPEC_VERSION = "2.2.0";
|
|
5
|
+
export const PRESET_VERSION = "1.6";
|
|
6
|
+
export const PRESET_CONFIG_HASH = "sha256:0fe215aede1da13430380384c58226d074c3b8344c091efc53e097c2930a34f7";
|
package/dist/gisl.d.ts
CHANGED
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
import { GislClient } from './client.js';
|
|
20
20
|
import { GislConfigError, GislFeatureRequiresAuthError, GislMissingCredentialsError } from './errors.js';
|
|
21
21
|
import { type ResolveCredentialsOptions, type ResolveEndpointOptions } from './credentials.js';
|
|
22
|
-
import type { CreditsUsageOptions, GislClientConfig } from './types.js';
|
|
23
|
-
import type { AccountLimits, CreditsBalanceResponse, CreditsUsageResponse } from '@giveitsmaller/contracts/openapi';
|
|
22
|
+
import type { CreditsUsageOptions, GislClientConfig, CapabilitiesSnapshot } from './types.js';
|
|
23
|
+
import type { AccountLimits, CreditsBalanceResponse, CreditsUsageResponse, OperationCapability, OperationType } from '@giveitsmaller/contracts/openapi';
|
|
24
24
|
import { OperationBuilder } from './builder.js';
|
|
25
25
|
import { MergeBuilder, type Asset, type MergeOptions } from './merge.js';
|
|
26
26
|
import { PresetDefaults } from './ergonomic/presets/index.js';
|
|
27
|
-
import { Recipe, FilesRecipe, type FileInput } from './file-first.js';
|
|
27
|
+
import { Recipe, FilesRecipe, BatchRecipe, type FileInput } from './file-first.js';
|
|
28
28
|
import { Handle } from './handle.js';
|
|
29
29
|
/**
|
|
30
30
|
* Operations that may be invoked on a `gisl.anonymous()` client without
|
|
@@ -61,6 +61,21 @@ export interface GislCreateOptions extends ResolveCredentialsOptions, ResolveEnd
|
|
|
61
61
|
* legitimately have no apiKey at construction time.
|
|
62
62
|
*/
|
|
63
63
|
export declare function create(opts?: GislCreateOptions): Promise<ErgonomicClient>;
|
|
64
|
+
/**
|
|
65
|
+
* Operation types that need MORE THAN ONE input source, so they cannot be
|
|
66
|
+
* driven through the single-input {@link ErgonomicClient.operation} escape
|
|
67
|
+
* hatch — each has a dedicated multi-input builder (`merge(...)`,
|
|
68
|
+
* `files(...).archive(...)`, `file(a).watermark(b)`). Excluded from
|
|
69
|
+
* `operation()`'s op-type autocomplete.
|
|
70
|
+
*/
|
|
71
|
+
export type MultiInputOperationType = 'merge' | 'archive' | 'image_watermark' | 'video_watermark' | 'audio_overlay' | 'audio_to_video';
|
|
72
|
+
/**
|
|
73
|
+
* Op types reachable via {@link ErgonomicClient.operation}: every
|
|
74
|
+
* {@link OperationType} except the {@link MultiInputOperationType} ones, widened
|
|
75
|
+
* with `(string & {})` so a genuinely-unknown (not-yet-in-contract) op type is
|
|
76
|
+
* still accepted while known single-input ops keep autocomplete.
|
|
77
|
+
*/
|
|
78
|
+
export type SingleInputOperationType = Exclude<OperationType, MultiInputOperationType> | (string & {});
|
|
64
79
|
/**
|
|
65
80
|
* The ergonomic-client surface: `GislClient` (verbatim low-level API)
|
|
66
81
|
* plus three ergonomic op-builder factories. Intersection type — at
|
|
@@ -91,6 +106,20 @@ export type ErgonomicClient = GislClient & {
|
|
|
91
106
|
* returns a {@link Handle} whose `wait()`/`result()` partition per input.
|
|
92
107
|
*/
|
|
93
108
|
files(inputs: ReadonlyArray<string | Blob | FileInput>): FilesRecipe;
|
|
109
|
+
/**
|
|
110
|
+
* Keyed multi-recipe batch entry point (FF7). Run N DISTINCT single-input
|
|
111
|
+
* keyed {@link Recipe}s as ONE workflow — build each via
|
|
112
|
+
* `client.file(input, key).<op>(...)` with a UNIQUE key, then
|
|
113
|
+
* `client.batch([r1, r2, …]).run()`. The partitioned {@link RunResult}
|
|
114
|
+
* addresses each entry's outputs by its caller key (`res.byKey('hero')`); one
|
|
115
|
+
* failed entry lands in `failed` without sinking the rest.
|
|
116
|
+
*
|
|
117
|
+
* v1 accepts ONLY single-input {@link Recipe} entries — the multi-input
|
|
118
|
+
* builders ({@link FilesRecipe} via `files(...)`, `merge(...)`, `archive(...)`,
|
|
119
|
+
* `watermark(...)`) are rejected pre-upload with a typed {@link GislConfigError}.
|
|
120
|
+
* `.run()`-only; `.submit()` / reattach are a follow-up.
|
|
121
|
+
*/
|
|
122
|
+
batch(recipes: ReadonlyArray<Recipe>): BatchRecipe;
|
|
94
123
|
/**
|
|
95
124
|
* Reattach to a previously-created workflow (FF5a). Returns a client-bound
|
|
96
125
|
* {@link Handle} you can `.status()` / `.wait()` / `.result()`. The handle
|
|
@@ -102,6 +131,8 @@ export type ErgonomicClient = GislClient & {
|
|
|
102
131
|
compress(input: string | Blob, options?: Record<string, unknown>): OperationBuilder;
|
|
103
132
|
convert(input: string | Blob, options?: Record<string, unknown>): OperationBuilder;
|
|
104
133
|
thumbnail(input: string | Blob, options?: Record<string, unknown>): OperationBuilder;
|
|
134
|
+
/** Geometric transform (rotate/flip). Passthrough; the op is `planned` (server 422s until Lambdas ship). */
|
|
135
|
+
transform(input: string | Blob, options?: Record<string, unknown>): OperationBuilder;
|
|
105
136
|
/**
|
|
106
137
|
* Merge ordered-sequence factory (T3). Accepts a variadic list of assets
|
|
107
138
|
* (strings/Blobs/`handle()`/`asset()`) optionally terminated by a
|
|
@@ -135,6 +166,44 @@ export type ErgonomicClient = GislClient & {
|
|
|
135
166
|
creditsUsage(options?: CreditsUsageOptions): Promise<CreditsUsageResponse>;
|
|
136
167
|
/** Effective account limits / tier-resolved caps (sugar for `getAccountLimits()`). */
|
|
137
168
|
limits(): Promise<AccountLimits>;
|
|
169
|
+
/**
|
|
170
|
+
* Operation-capability read helper (qUhxfDA5). A typed projection over
|
|
171
|
+
* `getSchema()` that surfaces the tier-scoped operation-capability matrix,
|
|
172
|
+
* the output-property table, and the image-encode capability matrix —
|
|
173
|
+
* without dropping to the low-level `getSchema()` and its not-modified union.
|
|
174
|
+
*
|
|
175
|
+
* Called with no argument it returns the full {@link CapabilitiesSnapshot};
|
|
176
|
+
* called with an operation type it returns just that op's
|
|
177
|
+
* {@link OperationCapability}, or `undefined` when the op is absent from the
|
|
178
|
+
* server's capability matrix.
|
|
179
|
+
*
|
|
180
|
+
* Degraded fallback: if the client is configured to force conditional
|
|
181
|
+
* revalidation (a static `If-None-Match` in `config.headers`) the schema
|
|
182
|
+
* fetch may 304 with no body — in that case the snapshot is empty / the
|
|
183
|
+
* per-op lookup is `undefined`.
|
|
184
|
+
*/
|
|
185
|
+
capabilities(): Promise<CapabilitiesSnapshot>;
|
|
186
|
+
capabilities(opType: OperationType | (string & {})): Promise<OperationCapability | undefined>;
|
|
187
|
+
/**
|
|
188
|
+
* Generic operation escape hatch (qUhxfDA5). Build + run a SINGLE-input,
|
|
189
|
+
* SINGLE-operation job for an op type with no first-class verb (e.g.
|
|
190
|
+
* `text_watermark`, `split`, or a not-yet-in-contract op). `options` reach the
|
|
191
|
+
* wire unchanged — there is NO pre-upload validation (the server validates) and
|
|
192
|
+
* NO preset resolution unless `opType` is `compress`. Prefer the typed verbs
|
|
193
|
+
* (`compress` / `convert` / `thumbnail`) when they exist — they add local
|
|
194
|
+
* validation.
|
|
195
|
+
*
|
|
196
|
+
* Multi-input operations (`merge`, `archive`, overlay watermarks — see
|
|
197
|
+
* {@link MultiInputOperationType}) are REJECTED at compile time: passing one
|
|
198
|
+
* of those literals is a type error (its dedicated builder is `merge(...)`,
|
|
199
|
+
* `files(...).archive(...)`, or `file(a).watermark(b)`). A genuinely-unknown
|
|
200
|
+
* (not-yet-in-contract) op string is still accepted.
|
|
201
|
+
*
|
|
202
|
+
* The generic parameter enforces the exclusion: a known single-input op or an
|
|
203
|
+
* unknown string maps to itself, while a {@link MultiInputOperationType}
|
|
204
|
+
* literal maps to `never` (so it cannot be passed).
|
|
205
|
+
*/
|
|
206
|
+
operation<Op extends SingleInputOperationType>(opType: Op extends MultiInputOperationType ? never : Op, input: string | Blob, options?: Record<string, unknown>): OperationBuilder;
|
|
138
207
|
};
|
|
139
208
|
/**
|
|
140
209
|
* The `gisl` namespace — primary ergonomic-layer entry point.
|
package/dist/gisl.js
CHANGED
|
@@ -20,9 +20,10 @@ import { GislClient } from './client.js';
|
|
|
20
20
|
import { GislConfigError, GislFeatureRequiresAuthError, GislMissingCredentialsError, } from './errors.js';
|
|
21
21
|
import { resolveApiKey, resolveEndpoint, } from './credentials.js';
|
|
22
22
|
import { OperationBuilder } from './builder.js';
|
|
23
|
+
import { validateVerbOptions, validateSingleOpConvertOptions, assertThumbnailDimensions, } from './ergonomic/option_validation.js';
|
|
23
24
|
import { MergeBuilder, asset } from './merge.js';
|
|
24
25
|
import { PresetDefaults } from './ergonomic/presets/index.js';
|
|
25
|
-
import { Recipe, FilesRecipe, fileInput } from './file-first.js';
|
|
26
|
+
import { Recipe, FilesRecipe, BatchRecipe, fileInput } from './file-first.js';
|
|
26
27
|
import { Handle } from './handle.js';
|
|
27
28
|
// ---------------------------------------------------------------------------
|
|
28
29
|
// Anonymous-capable operation allowlist (internal)
|
|
@@ -112,14 +113,42 @@ function wrapErgonomic(client, presetDefaults, scopedPresetDefaults) {
|
|
|
112
113
|
return new FilesRecipe(resolved, [], presetDefaults, scopedPresetDefaults, target);
|
|
113
114
|
};
|
|
114
115
|
}
|
|
116
|
+
if (prop === 'batch') {
|
|
117
|
+
// Keyed multi-recipe batch entry point (FF7). Run N DISTINCT single-input
|
|
118
|
+
// keyed recipes as ONE workflow; run() partitions the RunResult per entry
|
|
119
|
+
// by the caller key given at `file(input, key)` time. Client-only ctor —
|
|
120
|
+
// each entry already captured its own preset defaults at `client.file(...)`
|
|
121
|
+
// time, so batch never re-plumbs presetDefaults/scopedPresetDefaults.
|
|
122
|
+
return (recipes) => new BatchRecipe(recipes, target);
|
|
123
|
+
}
|
|
115
124
|
if (prop === 'workflow') {
|
|
116
125
|
// Reattach to a previously-created workflow (FF5a). Returns a
|
|
117
126
|
// client-bound Handle with no webhookSecret and no recipe key —
|
|
118
127
|
// its RunResult is therefore keyless (succeeded[].key === null).
|
|
119
128
|
return (id) => new Handle(id, undefined, target);
|
|
120
129
|
}
|
|
121
|
-
if (prop === 'compress' || prop === 'convert' || prop === 'thumbnail') {
|
|
130
|
+
if (prop === 'compress' || prop === 'convert' || prop === 'thumbnail' || prop === 'transform') {
|
|
122
131
|
return (input, options = {}) => {
|
|
132
|
+
// ExVcchMz — validate the option bag pre-upload for the exported
|
|
133
|
+
// single-op builder so a bad bag (unknown key / missing thumbnail dims /
|
|
134
|
+
// missing convert target) fails locally instead of as a server 422.
|
|
135
|
+
// `compress` is EXCLUDED: it validates through the preset resolver
|
|
136
|
+
// (resolveCompressOptions / KNOWN_WIRE_FIELDS), not these guards.
|
|
137
|
+
// `convert` uses a SINGLE-OP-specific guard (NOT validateVerbOptions):
|
|
138
|
+
// the single-op builder has no positional format, so its target rides
|
|
139
|
+
// the bag as `output_format` — which the file-first convert guard would
|
|
140
|
+
// reject as positional-owned. `thumbnail` reuses the file-first guards
|
|
141
|
+
// (it has no positional-owned keys).
|
|
142
|
+
if (prop === 'convert')
|
|
143
|
+
validateSingleOpConvertOptions(options);
|
|
144
|
+
if (prop === 'thumbnail') {
|
|
145
|
+
validateVerbOptions('thumbnail', options);
|
|
146
|
+
assertThumbnailDimensions(options);
|
|
147
|
+
}
|
|
148
|
+
// `transform` is a passthrough (rotate/flip); no positional-owned keys
|
|
149
|
+
// and no required dims — just the generic key-validation.
|
|
150
|
+
if (prop === 'transform')
|
|
151
|
+
validateVerbOptions('transform', options);
|
|
123
152
|
// T4b — pass client-scope presetDefaults into the builder so
|
|
124
153
|
// .run()/.submit() consult the preset resolver. The Proxy's
|
|
125
154
|
// closure carries the same reference for every per-call
|
|
@@ -178,6 +207,47 @@ function wrapErgonomic(client, presetDefaults, scopedPresetDefaults) {
|
|
|
178
207
|
if (prop === 'limits') {
|
|
179
208
|
return () => target.getAccountLimits();
|
|
180
209
|
}
|
|
210
|
+
if (prop === 'capabilities') {
|
|
211
|
+
// qUhxfDA5 — READ/PROJECTION over getSchema() surfacing the three
|
|
212
|
+
// v2.124 capability fields (previously typed but with no ergonomic
|
|
213
|
+
// consumer). No arg → the full CapabilitiesSnapshot; an opType → that
|
|
214
|
+
// op's OperationCapability (or undefined when absent).
|
|
215
|
+
return async (opType) => {
|
|
216
|
+
const schema = await target.getSchema();
|
|
217
|
+
// capabilities() passes no conditional headers, so getSchema()
|
|
218
|
+
// normally returns the 200 hit with data. A 304 is only possible if
|
|
219
|
+
// the caller globally configured a conditional header (e.g. a static
|
|
220
|
+
// `If-None-Match` in `config.headers`) — an unusual, self-inflicted
|
|
221
|
+
// case. Rather than throw, degrade to an empty projection (documented
|
|
222
|
+
// on the method); a caller who forces revalidation gets no snapshot.
|
|
223
|
+
const data = schema.notModified ? undefined : schema.data;
|
|
224
|
+
const operations = data?.capabilities ?? {};
|
|
225
|
+
if (opType !== undefined) {
|
|
226
|
+
return operations[opType];
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
operations,
|
|
230
|
+
outputProperties: data?.outputProperties ?? {},
|
|
231
|
+
...(data?.imageEncodeCapabilities !== undefined
|
|
232
|
+
? { imageEncode: data.imageEncodeCapabilities }
|
|
233
|
+
: {}),
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
if (prop === 'operation') {
|
|
238
|
+
// qUhxfDA5 — generic escape-hatch sibling of the single-op verbs
|
|
239
|
+
// (compress/convert/thumbnail). Builds a SINGLE-input, SINGLE-operation
|
|
240
|
+
// job for an op type with no typed verb (e.g. `text_watermark`, `split`,
|
|
241
|
+
// or a not-yet-in-contract op). Options ride through to the wire
|
|
242
|
+
// unchanged (no preset resolution unless opType is 'compress'); NO
|
|
243
|
+
// pre-upload validation — the server validates.
|
|
244
|
+
//
|
|
245
|
+
// Multi-input operations (merge, archive, image/video/audio overlay
|
|
246
|
+
// watermarks) canNOT be expressed here — they need multiple sources and
|
|
247
|
+
// have dedicated builders (`merge(...)`, `files(...).archive(...)`,
|
|
248
|
+
// `file(a).watermark(b)`). They are excluded from the op-type param.
|
|
249
|
+
return (opType, input, options = {}) => new OperationBuilder(target, opType, input, options, presetDefaults, scopedPresetDefaults);
|
|
250
|
+
}
|
|
181
251
|
return Reflect.get(target, prop, receiver);
|
|
182
252
|
},
|
|
183
253
|
});
|
package/dist/index.core.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { GislClient, DEFAULT_MULTIPART_FIRST_CHUNK_SIZE } from './client.js';
|
|
2
2
|
export { parseSseStream } from './sse.js';
|
|
3
|
-
export type { CreditsUsageOptions, ListWorkflowsOptions, GetSchemaOptions, GetSchemaResult, PreflightClipError, PreflightClipsResult, ProbeWaitOptions, ProbeWaitResult, GislClientConfig, GislSseEvent, UploadOptions, WaitOptions, WorkflowCreatePayload, OperationDef, WorkflowSourcePayload, MultiInputSourcePayload, UploadSourcePayload, JobOutputSourcePayload, ExternalImportSourcePayload, ConnectionSourcePayload, JobInputV2Payload, JobDefinitionPayload, ExternalDestinationPayload, DeliveryPayload, DeliveryModePayload, DeliveryBundleFormatPayload, DeliverySelectionPayload, DeliverySelectionTypePayload, DeliveryOutputRefPayload, WorkflowProcessingPayload, ProcessingClassHintPayload, MultipartCheckpointState, _Sdk3HandCodedUploadedPart, _Sdk3HandCodedMultipartStatusResult, _Sdk3HandCodedPresignedPart, _Sdk3HandCodedPresignPartsResult, _Sdk3HandCodedKeepaliveResult, } from './types.js';
|
|
3
|
+
export type { CreditsUsageOptions, ListWorkflowsOptions, GetSchemaOptions, GetSchemaResult, CapabilitiesSnapshot, PreflightClipError, PreflightClipsResult, ProbeWaitOptions, ProbeWaitResult, GislClientConfig, GislSseEvent, GislSseParseFailure, UploadOptions, WaitOptions, WorkflowCreatePayload, OperationDef, WorkflowSourcePayload, MultiInputSourcePayload, UploadSourcePayload, JobOutputSourcePayload, ExternalImportSourcePayload, ConnectionSourcePayload, JobInputV2Payload, JobDefinitionPayload, ExternalDestinationPayload, DeliveryPayload, DeliveryModePayload, DeliveryBundleFormatPayload, DeliverySelectionPayload, DeliverySelectionTypePayload, DeliveryOutputRefPayload, WorkflowProcessingPayload, ProcessingClassHintPayload, MultipartCheckpointState, _Sdk3HandCodedUploadedPart, _Sdk3HandCodedMultipartStatusResult, _Sdk3HandCodedPresignedPart, _Sdk3HandCodedPresignPartsResult, _Sdk3HandCodedKeepaliveResult, } from './types.js';
|
|
4
4
|
export { uploadSource, jobOutputSource, externalImportSource, connectionSource, } from './types.js';
|
|
5
5
|
export type { GislConfigErrorMetadata } from './errors.js';
|
|
6
6
|
export { GislError, GislApiError, GislValidationError, GislBalanceExhaustedError, GislTierRestrictedError, GislFeatureTierRestrictedError, GislFeatureNotAvailableError, GislWorkflowExpiredError, GislProbePendingError, GislAuthError, GislUploadCapExceededError, GislMultipartPartError, GislMultipartPartCountError, GislMultipartSessionNotFoundError, GislMultipartSessionOwnershipError, GislMultipartSessionAuthRequiredError, GislTimeoutError, GislAbortError, GislNetworkError, GislConfigError, GislMissingCredentialsError, GislFeatureRequiresAuthError, GislUndeclaredAssetError, GislUnusedAssetError, GislPerInputOptionsNotSupportedError, GislChainCardinalityMismatchError, GislBundleAlreadyArchivedError, GislNoSuchKeyError, GislSinkError, GislItemFailedError, GislResultNotReadyError, } from './errors.js';
|
|
7
7
|
export type { GislApiErrorOptions, GislUploadCapKind } from './errors.js';
|
|
8
|
+
export type { ErrorCategory } from './generated/sdk_spec/errors.js';
|
|
8
9
|
export { RunResult } from './file-first.js';
|
|
9
10
|
export type { OutputFile, ItemResult, ItemFailure, Manifest, Downloader, } from './file-first.js';
|
|
10
11
|
export { Recipe, fileInput } from './file-first.js';
|
|
@@ -15,9 +16,10 @@ export { ArchivedRecipe } from './file-first.js';
|
|
|
15
16
|
export type { ArchiveRecipeOptions } from './file-first.js';
|
|
16
17
|
export { WatermarkedRecipe } from './file-first.js';
|
|
17
18
|
export type { WatermarkWireOp } from './file-first.js';
|
|
19
|
+
export { BatchRecipe } from './file-first.js';
|
|
18
20
|
export { Handle, StatusSnapshot } from './handle.js';
|
|
19
21
|
export { gisl, create } from './gisl.js';
|
|
20
|
-
export type { GislCreateOptions, Environment, ErgonomicClient } from './gisl.js';
|
|
22
|
+
export type { GislCreateOptions, Environment, ErgonomicClient, SingleInputOperationType, MultiInputOperationType, } from './gisl.js';
|
|
21
23
|
export { presetDefaults, PresetDefaults, type PresetMedia, type PresetOp, type AnyPresetOptions, ImageCompressPresetOptions, type ImageCompressPresetOptionsInput, AudioCompressPresetOptions, type AudioCompressPresetOptionsInput, VideoCompressPresetOptions, type VideoCompressPresetOptionsInput, DocumentPdfCompressPresetOptions, type DocumentPdfCompressPresetOptionsInput, DocumentOfficeCompressPresetOptions, type DocumentOfficeCompressPresetOptionsInput, DocumentOdfCompressPresetOptions, type DocumentOdfCompressPresetOptionsInput, DocumentEpubCompressPresetOptions, type DocumentEpubCompressPresetOptionsInput, OptimizeFor, ImageMetadataPolicy, ImageFormat, VideoCodec, VideoPreset, VideoFit, AudioBitrate, AudioCodec, AudioSampleRate, PdfProfile, PdfColorspace, } from './ergonomic/presets/index.js';
|
|
22
24
|
export { OperationBuilder, MapEachBuilder } from './builder.js';
|
|
23
25
|
export { MergeBuilder, asset, handle, clip } from './merge.js';
|
|
@@ -25,14 +27,14 @@ export type { Asset, ClipEntry, ClipOptions, MergeMediaKind, MergeOptions, Seque
|
|
|
25
27
|
export type { Artifact, ArtifactRef, JobBreakdown, OperationBreakdown, ProcessingProgressEvent, ProgressEvent, ResolvedOptions, ResolvedOptionsSources, Result, RunOptions, SubmitOptions, UploadProgressEvent, } from './builder.js';
|
|
26
28
|
export { PRESET_VERSION, resolveCompressOptions } from './ergonomic/preset_resolver.js';
|
|
27
29
|
export type { ResolveCompressOptionsInput, ResolveCompressOptionsOutput, } from './ergonomic/preset_resolver.js';
|
|
28
|
-
export type { AccountLimits, AccountLimitsLimits, AccountLimitEntry, AudioWatermarkDecodeRequest, AudioWatermarkDecodeResponse, ContactRequest, CreditsBalanceResponse, CreditsUsageResponse, CreditTransaction, ExternalImportCreatedResponse, ExternalImportRequest, LoginUserRequest, LoginUser200ResponseData, LoginUser200ResponseDataUser, WorkflowCancelResponse, WorkflowResumeResponse, WorkflowPausedDetail, WorkflowPausedDetailLinks, UploadResponse, UploadConstraintsApplied, UploadProbeResponse, UploadProbeMediaMetadata, MultipartInitiateRequestMetadataHint, WorkflowCreateResponse, WorkflowStatusResponse, WorkflowListResponse, WorkflowSummary, WorkflowDownloadResponse, MetadataResponse, MetadataResponseDimensions, MetadataResponseExif, MetadataResponseExifGps, OperationsSchemaResponse, OperationSchemaDefinition, MimeGroupSchema, OptionSchema, PerValueAvailabilityEntry, PerRoleCardinalityEntry, RetryResponse, JobDownload, OperationDownload, DownloadBundle, WebhookPayload, WebhookOperationContext, JobResponse, OperationResponse, OperationResult, OperationResultMetrics, ExternalDestination, Delivery, DeliveryPlan, DeliveryPlanOutput, WorkflowProcessing, ProcessingPlan, ProcessingPlanJob, WorkflowEdge, WorkflowWarning, JobInputV2, WorkflowSource, UploadSource, JobOutputSource, ConnectionSource, ExternalImportToken, BalanceExhaustedResponse, BalanceExhaustedResponseAllOfLinks, TierRestrictionResponse, FeatureTierRestrictedResponse, FeatureNotAvailableResponse, FeatureViolation, WorkflowExpiredResponse, ProbePendingResponse, AuthErrorResponse, } from '@giveitsmaller/contracts/openapi';
|
|
30
|
+
export type { AccountLimits, AccountLimitsLimits, AccountLimitEntry, AudioWatermarkDecodeRequest, AudioWatermarkDecodeResponse, ContactRequest, CreditsBalanceResponse, CreditsUsageResponse, CreditTransaction, ExternalImportCreatedResponse, ExternalImportRequest, LoginUserRequest, LoginUser200ResponseData, LoginUser200ResponseDataUser, WorkflowCancelResponse, WorkflowResumeResponse, WorkflowPausedDetail, WorkflowPausedDetailLinks, UploadResponse, UploadConstraintsApplied, UploadProbeResponse, UploadProbeMediaMetadata, MultipartInitiateRequestMetadataHint, WorkflowCreateResponse, WorkflowStatusResponse, WorkflowListResponse, WorkflowSummary, WorkflowDownloadResponse, MetadataResponse, MetadataResponseDimensions, MetadataResponseExif, MetadataResponseExifGps, OperationsSchemaResponse, OperationCapability, OutputProperties, ImageEncodeCapabilities, OperationSchemaDefinition, MimeGroupSchema, OptionSchema, PerValueAvailabilityEntry, PerRoleCardinalityEntry, RetryResponse, JobDownload, OperationDownload, DownloadBundle, WebhookPayload, WebhookOperationContext, JobResponse, OperationResponse, OperationResult, OperationResultMetrics, ExternalDestination, Delivery, DeliveryPlan, DeliveryPlanOutput, WorkflowProcessing, ProcessingPlan, ProcessingPlanJob, WorkflowEdge, WorkflowWarning, JobInputV2, WorkflowSource, UploadSource, JobOutputSource, ConnectionSource, ExternalImportToken, BalanceExhaustedResponse, BalanceExhaustedResponseAllOfLinks, TierRestrictionResponse, FeatureTierRestrictedResponse, FeatureNotAvailableResponse, FeatureViolation, WorkflowExpiredResponse, ProbePendingResponse, AuthErrorResponse, } from '@giveitsmaller/contracts/openapi';
|
|
29
31
|
export { AudioWatermarkDecodeRequestMethodHintEnum, AudioWatermarkDecodeResponseMethodEnum, OperationInputModel, ExternalImportRequestProviderHintEnum, ContactSubject, CreditTransactionSourceBucket, UploadProbeStatus, UploadProbeProcessingClass, WorkflowCancelBillingEffect, WorkflowPauseRequiredAction, WorkflowStatus, WarningType, WorkflowWarningSeverity, OperationType, SseEventType, CallbackEventType, OperationStatus, JobStatus, JobInputV2RoleEnum, AuthErrorType, TierRestrictionKind, BalanceExhaustedResponseRequiredActionEnum, ProcessingClassReason, DeliveryPlanReason, UserTier, ProcessingClass, } from '@giveitsmaller/contracts/openapi';
|
|
30
32
|
export type { SseOperationProgressData, SseOperationCompletedData, SseOperationFailedData, SseJobCompletedData, SseJobFailedData, SseWorkflowTerminalData, } from '@giveitsmaller/contracts/openapi';
|
|
31
33
|
export type { MultiOutputCompletion, PageIndexed, PositionIndexed, Unindexed, } from '@giveitsmaller/contracts/asyncapi';
|
|
32
34
|
import type { MultiOutputCompletion as _MultiOutputCompletion } from '@giveitsmaller/contracts/asyncapi';
|
|
33
35
|
export type OperationResultOutputEntry = _MultiOutputCompletion['outputs'][number];
|
|
34
|
-
export type { CompressImageOptions, CompressImageJpegOptions, CompressImagePngOptions, CompressImageAvifOptions, CompressVideoOptions, CompressAudioOptions, CompressDocumentPdfOptions, CompressDocumentOfficeOptions, CompressDocumentOdfOptions, CompressDocumentEpubOptions, ThumbnailImageOptions, ThumbnailVideoOptions, ThumbnailDocumentOptions, ConvertImageOptions, ConvertVideoOptions, ConvertAudioOptions, ConvertDocumentPdfOptions, MergeImageOptions, MergeVideoOptions, MergeVideoPerInputOptions, MergeAudioOptions, MergeAudioPerInputOptions, ArchiveOptions, ImageWatermarkImageOptions, ImageWatermarkImageGifOptions, TextWatermarkImageOptions, CustomLumaVideoOptions, AudioOverlayAudioOptions, AudioOverlayVideoOptions, AudioWatermarkAudioOptions, AudioWatermarkVideoOptions, AudioToVideoAudioOptions, VideoWatermarkVideoOptions, VideoTextWatermarkVideoOptions, SplitImageGifOptions, SplitDocumentPdfOptions, SplitAudioOptions, SplitVideoOptions, } from '@giveitsmaller/contracts/operations';
|
|
36
|
+
export type { CompressImageOptions, CompressImageJpegOptions, CompressImagePngOptions, CompressImageAvifOptions, CompressVideoOptions, CompressAudioOptions, CompressDocumentPdfOptions, CompressDocumentOfficeOptions, CompressDocumentOdfOptions, CompressDocumentEpubOptions, ThumbnailImageOptions, ThumbnailVideoOptions, ThumbnailDocumentOptions, TransformImageOptions, TransformImageGifOptions, TransformVideoOptions, TransformDocumentPdfOptions, ConvertImageOptions, ConvertVideoOptions, ConvertAudioOptions, ConvertDocumentPdfOptions, MergeImageOptions, MergeVideoOptions, MergeVideoPerInputOptions, MergeAudioOptions, MergeAudioPerInputOptions, ArchiveOptions, ImageWatermarkImageOptions, ImageWatermarkImageGifOptions, TextWatermarkImageOptions, CustomLumaVideoOptions, AudioOverlayAudioOptions, AudioOverlayVideoOptions, AudioWatermarkAudioOptions, AudioWatermarkVideoOptions, AudioToVideoAudioOptions, VideoWatermarkVideoOptions, VideoTextWatermarkVideoOptions, SplitImageGifOptions, SplitDocumentPdfOptions, SplitAudioOptions, SplitVideoOptions, } from '@giveitsmaller/contracts/operations';
|
|
35
37
|
export { ImageWatermarkImageAnchor, ImageWatermarkImageGifAnchor, TextWatermarkImageAnchor, TextWatermarkImageFontFamily, TextWatermarkImageWatermarkMode, AudioOverlayAudioMode, AudioOverlayVideoMode, AudioOverlayVideoNoAudioTrackBehaviour, AudioWatermarkAudioMethod, AudioWatermarkAudioRobustness, AudioWatermarkAudioDensity, AudioWatermarkVideoMethod, AudioWatermarkVideoRobustness, AudioWatermarkVideoDensity, AudioToVideoAudioOutputResolution, AudioToVideoAudioImageFit, AudioToVideoAudioOutputFormat, VideoWatermarkVideoAnchor, VideoTextWatermarkVideoFontFamily, VideoTextWatermarkVideoWatermarkMode, VideoTextWatermarkVideoAnchor, SplitImageGifOutputFormat, SplitDocumentPdfMode, SplitAudioMode, SplitAudioPrecision, SplitVideoMode, SplitVideoPrecision, } from '@giveitsmaller/contracts/operations';
|
|
36
|
-
export { archiveMetadata, audioOverlayMetadata, audioWatermarkMetadata, compressMetadata, convertMetadata, customLumaMetadata, imageWatermarkMetadata, mergeMetadata, textWatermarkMetadata, thumbnailMetadata, audioToVideoMetadata, videoWatermarkMetadata, videoTextWatermarkMetadata, splitMetadata, } from '@giveitsmaller/contracts/operations';
|
|
37
|
-
export type { ConvertOptions, ThumbnailOptions, TextWatermarkOptions, WatermarkOptions, WatermarkAnchor, } from './ergonomic/option_types.js';
|
|
38
|
+
export { archiveMetadata, audioOverlayMetadata, audioWatermarkMetadata, compressMetadata, convertMetadata, customLumaMetadata, imageWatermarkMetadata, mergeMetadata, textWatermarkMetadata, thumbnailMetadata, audioToVideoMetadata, videoWatermarkMetadata, videoTextWatermarkMetadata, splitMetadata, transformMetadata, } from '@giveitsmaller/contracts/operations';
|
|
39
|
+
export type { ConvertOptions, ThumbnailOptions, TransformOptions, TextWatermarkOptions, WatermarkOptions, WatermarkOverlay, WatermarkAnchor, } from './ergonomic/option_types.js';
|
|
38
40
|
export type { OperationMetadata, AvailabilityValue, AvailabilityEntry, FeatureEntry, MimeGroupMetadata, OptionMetadata, ProcessingClassConstraints, } from '@giveitsmaller/contracts/operations';
|
package/dist/index.core.js
CHANGED
|
@@ -55,6 +55,11 @@ export { ArchivedRecipe } from './file-first.js';
|
|
|
55
55
|
// post-watermark ops on, then run()/submit(). Routes image_watermark / video_watermark
|
|
56
56
|
// by base media; gates planned/unsupported bases locally pre-upload.
|
|
57
57
|
export { WatermarkedRecipe } from './file-first.js';
|
|
58
|
+
// File-first keyed multi-recipe batch (FF7 / MFaCjL8d) — `client.batch([r1, r2, …])`
|
|
59
|
+
// runs N DISTINCT single-input keyed recipes as ONE workflow; run() partitions the
|
|
60
|
+
// RunResult by each entry's caller key. v1 = single-input keyed, run()-only; the
|
|
61
|
+
// multi-input builders are rejected pre-upload.
|
|
62
|
+
export { BatchRecipe } from './file-first.js';
|
|
58
63
|
// `HttpDownloader` (Node streaming downloader) is re-exported from the Node-only
|
|
59
64
|
// entry `index.ts`, NOT here — it statically imports node:fs/node:stream.
|
|
60
65
|
// `projectDownloadsToRunResult` is intentionally NOT re-exported here — it is an
|
|
@@ -109,4 +114,7 @@ AudioToVideoAudioOutputResolution, AudioToVideoAudioImageFit, AudioToVideoAudioO
|
|
|
109
114
|
// surfaces as `GislFeatureNotAvailableError`).
|
|
110
115
|
export { archiveMetadata, audioOverlayMetadata, audioWatermarkMetadata, compressMetadata, convertMetadata, customLumaMetadata, imageWatermarkMetadata, mergeMetadata, textWatermarkMetadata, thumbnailMetadata,
|
|
111
116
|
// New planned operation metadata sidecars — contracts v2.15 (AJCLLGaG).
|
|
112
|
-
audioToVideoMetadata, videoWatermarkMetadata, videoTextWatermarkMetadata, splitMetadata,
|
|
117
|
+
audioToVideoMetadata, videoWatermarkMetadata, videoTextWatermarkMetadata, splitMetadata,
|
|
118
|
+
// transform is `availability: planned` — consumers can inspect this sidecar to
|
|
119
|
+
// gate UI before submitting (the API otherwise returns feature_not_available/422). T4.
|
|
120
|
+
transformMetadata, } from '@giveitsmaller/contracts/operations';
|
package/dist/merge.d.ts
CHANGED
|
@@ -90,13 +90,25 @@ export interface MergeOptions {
|
|
|
90
90
|
readonly crossfadeDuration?: number;
|
|
91
91
|
readonly gapDuration?: number;
|
|
92
92
|
readonly normalizeAudio?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Video re-encode policy (`auto` | `always` | `never`). Passed through
|
|
95
|
+
* verbatim — `codec`/`crf`/`preset`/`targetResolution`/`targetSize` are only
|
|
96
|
+
* honoured by the worker when re-encoding (`auto`/`always`); the server owns
|
|
97
|
+
* that dependency validation (the SDK is a passthrough allowlist, same as the
|
|
98
|
+
* pre-existing codec/crf/preset fields). Video merge only.
|
|
99
|
+
*/
|
|
100
|
+
readonly reEncodeMode?: string;
|
|
93
101
|
readonly codec?: string;
|
|
94
102
|
readonly crf?: number;
|
|
95
103
|
readonly preset?: string;
|
|
104
|
+
/** Video output dimensions `WxH` (e.g. `"1920x1080"`); omit to inherit from inputs. Video merge only. */
|
|
105
|
+
readonly targetResolution?: string;
|
|
96
106
|
readonly targetSize?: string | number;
|
|
97
107
|
readonly transitionDuration?: number;
|
|
98
108
|
readonly fps?: number;
|
|
99
109
|
readonly durationPerImage?: number;
|
|
110
|
+
/** Milliseconds between frames for an animated-GIF image merge (`output_type: gif`). Image merge only. */
|
|
111
|
+
readonly delay?: number;
|
|
100
112
|
readonly loopCount?: number;
|
|
101
113
|
readonly output?: string;
|
|
102
114
|
readonly videoFormat?: string;
|
package/dist/merge.js
CHANGED
|
@@ -406,12 +406,16 @@ export class MergeBuilder {
|
|
|
406
406
|
out.gapDuration = o.gapDuration;
|
|
407
407
|
// Video only.
|
|
408
408
|
if (mediaKind === 'video') {
|
|
409
|
+
if (o.reEncodeMode !== undefined)
|
|
410
|
+
out.reEncodeMode = o.reEncodeMode;
|
|
409
411
|
if (o.codec !== undefined)
|
|
410
412
|
out.codec = o.codec;
|
|
411
413
|
if (o.crf !== undefined)
|
|
412
414
|
out.crf = o.crf;
|
|
413
415
|
if (o.preset !== undefined)
|
|
414
416
|
out.preset = o.preset;
|
|
417
|
+
if (o.targetResolution !== undefined)
|
|
418
|
+
out.targetResolution = o.targetResolution;
|
|
415
419
|
if (o.targetSize !== undefined)
|
|
416
420
|
out.targetSize = o.targetSize;
|
|
417
421
|
}
|
|
@@ -423,6 +427,8 @@ export class MergeBuilder {
|
|
|
423
427
|
out.fps = o.fps;
|
|
424
428
|
if (o.durationPerImage !== undefined)
|
|
425
429
|
out.durationPerImage = o.durationPerImage;
|
|
430
|
+
if (o.delay !== undefined)
|
|
431
|
+
out.delay = o.delay;
|
|
426
432
|
if (o.loopCount !== undefined)
|
|
427
433
|
out.loopCount = o.loopCount;
|
|
428
434
|
if (o.videoFormat !== undefined)
|
|
@@ -519,12 +525,16 @@ export function wireMergeOptions(opts, mediaKind) {
|
|
|
519
525
|
out.gap_duration = opts.gapDuration;
|
|
520
526
|
// Video only.
|
|
521
527
|
if (mediaKind === 'video') {
|
|
528
|
+
if (opts.reEncodeMode !== undefined)
|
|
529
|
+
out.re_encode_mode = opts.reEncodeMode;
|
|
522
530
|
if (opts.codec !== undefined)
|
|
523
531
|
out.codec = opts.codec;
|
|
524
532
|
if (opts.crf !== undefined)
|
|
525
533
|
out.crf = opts.crf;
|
|
526
534
|
if (opts.preset !== undefined)
|
|
527
535
|
out.preset = opts.preset;
|
|
536
|
+
if (opts.targetResolution !== undefined)
|
|
537
|
+
out.target_resolution = opts.targetResolution;
|
|
528
538
|
if (opts.targetSize !== undefined) {
|
|
529
539
|
out.target_size_bytes = typeof opts.targetSize === 'number'
|
|
530
540
|
? opts.targetSize
|
|
@@ -540,6 +550,8 @@ export function wireMergeOptions(opts, mediaKind) {
|
|
|
540
550
|
out.fps = opts.fps;
|
|
541
551
|
if (opts.durationPerImage !== undefined)
|
|
542
552
|
out.duration_per_image = opts.durationPerImage;
|
|
553
|
+
if (opts.delay !== undefined)
|
|
554
|
+
out.delay = opts.delay;
|
|
543
555
|
if (opts.loopCount !== undefined)
|
|
544
556
|
out.loop_count = opts.loopCount;
|
|
545
557
|
if (opts.videoFormat !== undefined)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A rate-limit snapshot derived from the `x-ratelimit-*` response headers.
|
|
3
|
+
* `resetSeconds` is the server's seconds-to-reset value (`X-RateLimit-Reset`),
|
|
4
|
+
* NOT an absolute epoch — read {@link GislApiError.rateLimit} to obtain one.
|
|
5
|
+
*/
|
|
6
|
+
export interface RateLimitSnapshot {
|
|
7
|
+
readonly limit: number;
|
|
8
|
+
readonly remaining: number;
|
|
9
|
+
readonly resetSeconds: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Whether an HTTP status is retryable per the API-error taxonomy: request
|
|
13
|
+
* timeout (408), rate-limit (429), or any 5xx (500–599). BOUNDED at 599 — a
|
|
14
|
+
* non-standard 6xx-and-up status is NOT classified retryable.
|
|
15
|
+
*
|
|
16
|
+
* Now value-identical to the S3-PUT retry predicate (`isRetryableStatus`) in
|
|
17
|
+
* `client.ts` (both are `408 || 429 || 500-599` after qz7MjNTy), but kept
|
|
18
|
+
* DELIBERATELY SEPARATE: they guard different retry paths (S3-PUT chunk uploads
|
|
19
|
+
* vs the API-error taxonomy) and may diverge again, so they must NOT be merged.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isApiRetryableStatus(status: number): boolean;
|
|
22
|
+
export declare function parseRetryAfterMs(headerValue: string | undefined): number | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The server-suggested back-off delay in WHOLE seconds, parsed from the
|
|
25
|
+
* `Retry-After` response header. Derived from {@link parseRetryAfterMs}
|
|
26
|
+
* (`Math.floor(ms / 1000)`) so the semantics mirror the retry-loop parser:
|
|
27
|
+
* absent / malformed / zero / past all collapse to `undefined`, as does a
|
|
28
|
+
* sub-second future HTTP-date (floors to zero → treated as absent).
|
|
29
|
+
*/
|
|
30
|
+
export declare function retryAfterSecondsFromHeaders(headers: Record<string, string> | undefined): number | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* A rate-limit snapshot parsed from the `x-ratelimit-*` response headers.
|
|
33
|
+
* Present ONLY when `x-ratelimit-limit`, `x-ratelimit-remaining`, and
|
|
34
|
+
* `x-ratelimit-reset` all parse as non-negative integers; otherwise
|
|
35
|
+
* `undefined` (a partial set is not a usable snapshot).
|
|
36
|
+
*/
|
|
37
|
+
export declare function rateLimitFromHeaders(headers: Record<string, string> | undefined): RateLimitSnapshot | undefined;
|