@giveitsmaller/sdk 0.20.0 → 0.21.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.
@@ -77,20 +77,6 @@ export const AudioSampleRate = {
77
77
  _44100: 44100,
78
78
  _48000: 48000,
79
79
  };
80
- // PDF Ghostscript preset. Screen = smallest; Ebook = mid; Printer = 300dpi; Prepress = print-production.
81
- export const PdfProfile = {
82
- Screen: "screen",
83
- Ebook: "ebook",
84
- Printer: "printer",
85
- Prepress: "prepress",
86
- };
87
- // PDF output color space.
88
- export const PdfColorspace = {
89
- Unchanged: "unchanged",
90
- Rgb: "rgb",
91
- Cmyk: "cmyk",
92
- Grayscale: "grayscale",
93
- };
94
80
  /** Catalog of every ergonomic enum (canonicalName → wire). */
95
81
  export const ERGONOMIC_ENUMS = {
96
82
  OptimizeFor,
@@ -102,6 +88,4 @@ export const ERGONOMIC_ENUMS = {
102
88
  AudioBitrate,
103
89
  AudioCodec,
104
90
  AudioSampleRate,
105
- PdfProfile,
106
- PdfColorspace,
107
91
  };
@@ -1,4 +1,4 @@
1
- export type ErrorCode = "missing_credentials" | "feature_requires_auth" | "undeclared_asset" | "unused_asset" | "per_input_options_not_supported" | "chain_cardinality_mismatch" | "multipart_part_invalid" | "multipart_part_count_exceeded" | "timeout" | "aborted" | "validation_failed" | "validation_error" | "cyclic_workflow_edges" | "workflow_edge_references_unknown_job" | "reserved_job_id_pattern" | "cyclic_job_output_source_graph" | "auth_failed" | "feature_tier_restricted" | "tier_restriction" | "multipart_session_ownership" | "multipart_session_auth_required" | "multipart_session_not_found" | "upload_not_found" | "workflow_expired" | "balance_exhausted" | "feature_not_available" | "upload_size_exceeds_tier" | "upload_duration_exceeds_tier" | "probe_pending" | "requires_reencode" | "invalid_options" | "invalid_combination" | "missing_dependency" | "unsupported_value" | "type_mismatch" | "upload_failed" | "workflow_failed";
1
+ export type ErrorCode = "missing_credentials" | "feature_requires_auth" | "undeclared_asset" | "unused_asset" | "per_input_options_not_supported" | "chain_cardinality_mismatch" | "multipart_part_invalid" | "multipart_part_count_exceeded" | "timeout" | "aborted" | "validation_failed" | "validation_error" | "cyclic_workflow_edges" | "workflow_edge_references_unknown_job" | "reserved_job_id_pattern" | "cyclic_job_output_source_graph" | "auth_failed" | "feature_tier_restricted" | "tier_restriction" | "multipart_session_ownership" | "multipart_session_auth_required" | "multipart_session_not_found" | "upload_not_found" | "workflow_expired" | "balance_exhausted" | "feature_not_available" | "upload_size_exceeds_tier" | "upload_duration_exceeds_tier" | "probe_pending" | "requires_reencode" | "invalid_options" | "invalid_combination" | "missing_dependency" | "unsupported_value" | "type_mismatch" | "image_dimensions_too_large" | "upload_failed" | "workflow_failed";
2
2
  export type ErrorCategory = 'api' | 'config' | 'network' | 'auth' | 'validation' | 'chain';
3
3
  export type ErrorStatus = 'wired' | 'planned';
4
4
  export interface ErrorEntry {
@@ -467,6 +467,17 @@ export const ERROR_CODES = Object.freeze({
467
467
  "actual": "string",
468
468
  }),
469
469
  }),
470
+ "image_dimensions_too_large": Object.freeze({
471
+ code: "image_dimensions_too_large",
472
+ category: "api",
473
+ source: "ErrorEnvelope.error",
474
+ status: "wired",
475
+ httpStatus: 413,
476
+ retryable: false,
477
+ sdkClass: "GislUploadCapExceededError",
478
+ description: "413 — POST /api/uploads rejected a decodable raster image whose pixel area (width × height) exceeds the configured ceiling (UPLOAD_MAX_IMAGE_PIXELS, default 16 MP), read from the file header before decode (I0Rqj4jo). Wire `IMAGE_DIMENSIONS_TOO_LARGE`; flat ErrorEnvelope (no details[]). A pixel-dimension member of the upload-cap family — GislUploadCapExceededError, alongside the size/duration caps — matching the SDKs' existing status-based 413 dispatch (NOT GislValidationError, which is the structured-422 class). Retry only after downscaling the input.",
479
+ metadataSchema: Object.freeze({}),
480
+ }),
470
481
  "upload_failed": Object.freeze({
471
482
  code: "upload_failed",
472
483
  category: "network",
@@ -509,6 +520,7 @@ export const ERROR_CATEGORIES = Object.freeze({
509
520
  "upload_duration_exceeds_tier",
510
521
  "probe_pending",
511
522
  "requires_reencode",
523
+ "image_dimensions_too_large",
512
524
  "workflow_failed",
513
525
  ]),
514
526
  config: Object.freeze([
@@ -50,20 +50,6 @@ export const PRESETS = Object.freeze({
50
50
  "preset": "Slow",
51
51
  }),
52
52
  }),
53
- "document_pdf_compress": Object.freeze({
54
- Size: Object.freeze({
55
- "profile": "Screen",
56
- "grayscale": true,
57
- }),
58
- Balanced: Object.freeze({
59
- "profile": "Ebook",
60
- "grayscale": false,
61
- }),
62
- Quality: Object.freeze({
63
- "profile": "Printer",
64
- "grayscale": false,
65
- }),
66
- }),
67
53
  "document_office_compress": Object.freeze({
68
54
  Size: Object.freeze({
69
55
  "stripMacros": true,
@@ -1,3 +1,3 @@
1
- export declare const SDK_SPEC_VERSION: "2.2.0";
1
+ export declare const SDK_SPEC_VERSION: "2.3.0";
2
2
  export declare const PRESET_VERSION: "1.6";
3
- export declare const PRESET_CONFIG_HASH: "sha256:0fe215aede1da13430380384c58226d074c3b8344c091efc53e097c2930a34f7";
3
+ export declare const PRESET_CONFIG_HASH: "sha256:354814f7906f85be6a6ca5ede6c0722c83cdc058fd658a9bb2b0996520466c6d";
@@ -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.2.0";
4
+ export const SDK_SPEC_VERSION = "2.3.0";
5
5
  export const PRESET_VERSION = "1.6";
6
- export const PRESET_CONFIG_HASH = "sha256:0fe215aede1da13430380384c58226d074c3b8344c091efc53e097c2930a34f7";
6
+ export const PRESET_CONFIG_HASH = "sha256:354814f7906f85be6a6ca5ede6c0722c83cdc058fd658a9bb2b0996520466c6d";
package/dist/gisl.d.ts CHANGED
@@ -22,6 +22,7 @@ import { type ResolveCredentialsOptions, type ResolveEndpointOptions } from './c
22
22
  import type { CreditsUsageOptions, GislClientConfig, CapabilitiesSnapshot } from './types.js';
23
23
  import type { AccountLimits, CreditsBalanceResponse, CreditsUsageResponse, OperationCapability, OperationType } from '@giveitsmaller/contracts/openapi';
24
24
  import { OperationBuilder } from './builder.js';
25
+ import type { ConvertOptions, ThumbnailOptions } from './ergonomic/option_types.js';
25
26
  import { MergeBuilder, type Asset, type MergeOptions } from './merge.js';
26
27
  import { PresetDefaults } from './ergonomic/presets/index.js';
27
28
  import { Recipe, FilesRecipe, BatchRecipe, type FileInput } from './file-first.js';
@@ -129,8 +130,26 @@ export type ErgonomicClient = GislClient & {
129
130
  */
130
131
  workflow(id: string): Handle;
131
132
  compress(input: string | Blob, options?: Record<string, unknown>): OperationBuilder;
132
- convert(input: string | Blob, options?: Record<string, unknown>): OperationBuilder;
133
- thumbnail(input: string | Blob, options?: Record<string, unknown>): OperationBuilder;
133
+ /**
134
+ * Single-op convert. The target format rides the bag as the required
135
+ * `output_format` (the single-op builder has no positional format — that is
136
+ * the file-first `Recipe.convert(format, …)` surface). Extra keys are the
137
+ * typed {@link ConvertOptions}. A missing `output_format` is a compile-time
138
+ * error (uFbM31dC); an unknown key is a compile-time error for an INLINE bag
139
+ * only — aliased bags bypass TS excess-property checks — so the runtime guard
140
+ * remains the backstop (also for untyped JS callers).
141
+ */
142
+ convert(input: string | Blob, options: ConvertOptions & {
143
+ output_format: string;
144
+ }): OperationBuilder;
145
+ /**
146
+ * Single-op thumbnail. {@link ThumbnailOptions} requires `width` + `height`;
147
+ * omitting either is a compile-time error (uFbM31dC). An unknown key is a
148
+ * compile-time error for an INLINE bag only — aliased bags bypass TS
149
+ * excess-property checks — so the runtime guard remains the backstop (also
150
+ * for untyped JS callers).
151
+ */
152
+ thumbnail(input: string | Blob, options: ThumbnailOptions): OperationBuilder;
134
153
  /** Geometric transform (rotate/flip). Passthrough; the op is `planned` (server 422s until Lambdas ship). */
135
154
  transform(input: string | Blob, options?: Record<string, unknown>): OperationBuilder;
136
155
  /**
package/dist/handle.d.ts CHANGED
@@ -97,7 +97,7 @@ export declare class Handle {
97
97
  * This is the ONLY blocking accessor on a `Handle`.
98
98
  *
99
99
  * @param maxWait Wall-clock deadline for the wait + downloads (string suffix
100
- * `'2h'`/`'30m'`/`'120s'` or a number of milliseconds). Defaults to 300s,
100
+ * `'2h'`/`'30m'`/`'120s'` or a number of milliseconds). Defaults to 600s,
101
101
  * matching `Recipe.run()` / the PHP `Handle::wait()` default.
102
102
  * @throws {GislConfigError} reason `no_client` when no client is bound.
103
103
  * @throws {GislTimeoutError} when `maxWait` elapses before terminal.
@@ -125,6 +125,11 @@ export declare class Handle {
125
125
  * empty `keyByRef`, so each input's key is recovered from its `file-{i}`
126
126
  * ref (`"0"`, `"1"`, …). A submitted/reattached fan-out carries no
127
127
  * caller-supplied keys — keyed fan-out is a separate concern.
128
+ * - A `merge` / `archive` / `watermark` shape ({@link isMergeStatus} /
129
+ * {@link isArchiveStatus} / {@link isWatermarkStatus}) → project ONLY the
130
+ * terminal deliverable, filtering the `src_*` passthrough plumbing. The
131
+ * terminal ref is the downstream `post` job when post-`sole_op` steps were
132
+ * chained ({@link terminalOutputRef}), else the sole_op job itself.
128
133
  * - Anything else (the single-file {@link Recipe} path) →
129
134
  * {@link projectDownloadsToRunResult} keyed by this handle's `#key`
130
135
  * (the recipe key from a file-first `submit()`, or `null` on reattach).
package/dist/handle.js CHANGED
@@ -34,7 +34,7 @@
34
34
  */
35
35
  import { GislConfigError, GislNetworkError, GislResultNotReadyError, GislTimeoutError, SseEndedWithoutTerminal, } from './errors.js';
36
36
  import { _consumeSseToTerminal, _pollToTerminal, _parseMaxWait, } from './builder.js';
37
- import { projectDownloadsToRunResult, projectMultiJobToRunResult, isFanoutStatus, isMergeStatus, isArchiveStatus, isWatermarkStatus, } from './file-first.js';
37
+ import { projectDownloadsToRunResult, projectMultiJobToRunResult, isFanoutStatus, isMergeStatus, isArchiveStatus, isWatermarkStatus, isSoleOpChainStatus, soleOpChainDeliverableRef, _POST_STEP_JOB_REF, } from './file-first.js';
38
38
  import { LazyHttpDownloader } from './lazy-downloader.js';
39
39
  /**
40
40
  * The terminal workflow states. A status response in any of these states
@@ -80,6 +80,16 @@ export class StatusSnapshot {
80
80
  return { workflowId: this.workflowId, state: this.state };
81
81
  }
82
82
  }
83
+ /**
84
+ * The terminal deliverable's job ref for a `sole_op` DAG: the downstream
85
+ * post-steps job ({@link _POST_STEP_JOB_REF}, present when the caller chained
86
+ * ops after `watermark()` / `merge()`) when it exists, else the `sole_op` job
87
+ * itself. Lets a submitted/reattached {@link Handle} project the final output —
88
+ * not the intermediate `sole_op` artifact — without builder state. PIiUit28.
89
+ */
90
+ function terminalOutputRef(jobDownloads, soleOpRef) {
91
+ return jobDownloads.some((d) => d.ref === _POST_STEP_JOB_REF) ? _POST_STEP_JOB_REF : soleOpRef;
92
+ }
83
93
  /**
84
94
  * Handle to a created workflow. Carries `workflowId` + an optional
85
95
  * `webhookSecret` (the data the operation-first/merge `submit()` returns)
@@ -139,12 +149,12 @@ export class Handle {
139
149
  * This is the ONLY blocking accessor on a `Handle`.
140
150
  *
141
151
  * @param maxWait Wall-clock deadline for the wait + downloads (string suffix
142
- * `'2h'`/`'30m'`/`'120s'` or a number of milliseconds). Defaults to 300s,
152
+ * `'2h'`/`'30m'`/`'120s'` or a number of milliseconds). Defaults to 600s,
143
153
  * matching `Recipe.run()` / the PHP `Handle::wait()` default.
144
154
  * @throws {GislConfigError} reason `no_client` when no client is bound.
145
155
  * @throws {GislTimeoutError} when `maxWait` elapses before terminal.
146
156
  */
147
- async wait(maxWait = 300_000, onProgress) {
157
+ async wait(maxWait = 600_000, onProgress) {
148
158
  const client = this.requireClient();
149
159
  const deadline = Date.now() + _parseMaxWait(maxWait);
150
160
  let finalStatus;
@@ -172,13 +182,13 @@ export class Handle {
172
182
  });
173
183
  }
174
184
  if (Date.now() >= deadline) {
175
- throw new GislTimeoutError(`Workflow ${this.workflowId} reached terminal status but maxWait elapsed before downloads could be fetched`);
185
+ throw new GislTimeoutError(`Workflow ${this.workflowId} reached terminal status but maxWait elapsed before downloads could be fetched`, this.workflowId);
176
186
  }
177
187
  const downloads = await client.getWorkflowDownloads(this.workflowId);
178
188
  // TDqmkWpX: re-check AFTER the downloads fetch so a slow getWorkflowDownloads
179
189
  // cannot return a success past the advertised maxWait.
180
190
  if (Date.now() >= deadline) {
181
- throw new GislTimeoutError(`Workflow ${this.workflowId} downloads fetch completed after maxWait elapsed`);
191
+ throw new GislTimeoutError(`Workflow ${this.workflowId} downloads fetch completed after maxWait elapsed`, this.workflowId);
182
192
  }
183
193
  return this.project(finalStatus, downloads.downloads);
184
194
  }
@@ -212,6 +222,11 @@ export class Handle {
212
222
  * empty `keyByRef`, so each input's key is recovered from its `file-{i}`
213
223
  * ref (`"0"`, `"1"`, …). A submitted/reattached fan-out carries no
214
224
  * caller-supplied keys — keyed fan-out is a separate concern.
225
+ * - A `merge` / `archive` / `watermark` shape ({@link isMergeStatus} /
226
+ * {@link isArchiveStatus} / {@link isWatermarkStatus}) → project ONLY the
227
+ * terminal deliverable, filtering the `src_*` passthrough plumbing. The
228
+ * terminal ref is the downstream `post` job when post-`sole_op` steps were
229
+ * chained ({@link terminalOutputRef}), else the sole_op job itself.
215
230
  * - Anything else (the single-file {@link Recipe} path) →
216
231
  * {@link projectDownloadsToRunResult} keyed by this handle's `#key`
217
232
  * (the recipe key from a file-first `submit()`, or `null` on reattach).
@@ -221,13 +236,16 @@ export class Handle {
221
236
  if (isFanoutStatus(finalStatus)) {
222
237
  return projectMultiJobToRunResult(this.workflowId, finalStatus, jobDownloads, new Map(), downloader);
223
238
  }
224
- // A fluent `files([...]).merge(...)` combine — project ONLY the merged
225
- // output, filtering the `src_*` passthrough plumbing (which re-exposes the
226
- // raw inputs). Matches MergedRecipe.run()'s `ref === 'merge'` filter so a
239
+ // A fluent `files([...]).merge(...)` combine — project ONLY the terminal
240
+ // deliverable, filtering the `src_*` passthrough plumbing (which re-exposes
241
+ // the raw inputs). Matches MergedRecipe.run()'s terminal-output filter so a
227
242
  // submitted/reattached merge handle never surfaces the input artifacts
228
243
  // alongside the combined output (codex c1).
229
244
  if (isMergeStatus(finalStatus)) {
230
- const mergeDownloads = jobDownloads.filter((d) => d.ref === 'merge');
245
+ // Post-merge steps (PIiUit28) lower into the downstream `_POST_STEP_JOB_REF`
246
+ // job, which is then the deliverable; otherwise the `merge` job is.
247
+ const mergeOutputRef = terminalOutputRef(jobDownloads, 'merge');
248
+ const mergeDownloads = jobDownloads.filter((d) => d.ref === mergeOutputRef);
231
249
  return projectDownloadsToRunResult(this.workflowId, finalStatus, mergeDownloads, null, downloader);
232
250
  }
233
251
  // A fluent `files([...]).archive(...)` bundle — project ONLY the archive
@@ -237,14 +255,25 @@ export class Handle {
237
255
  const archiveDownloads = jobDownloads.filter((d) => d.ref === 'archive');
238
256
  return projectDownloadsToRunResult(this.workflowId, finalStatus, archiveDownloads, null, downloader);
239
257
  }
240
- // A fluent `file(...).watermark(overlay)` — project ONLY the watermark
241
- // output, filtering the `src_*` (base/overlay) passthrough plumbing. Matches
242
- // WatermarkedRecipe.run()'s `ref === 'watermark'` filter so a
258
+ // A fluent `file(...).watermark(overlay)` — project ONLY the terminal
259
+ // deliverable, filtering the `src_*` (base/overlay) passthrough plumbing.
260
+ // Matches WatermarkedRecipe.run()'s terminal-output filter so a
243
261
  // submitted/reattached watermark handle never surfaces the raw inputs.
244
262
  if (isWatermarkStatus(finalStatus)) {
245
- const watermarkDownloads = jobDownloads.filter((d) => d.ref === 'watermark');
263
+ const watermarkOutputRef = terminalOutputRef(jobDownloads, 'watermark');
264
+ const watermarkDownloads = jobDownloads.filter((d) => d.ref === watermarkOutputRef);
246
265
  return projectDownloadsToRunResult(this.workflowId, finalStatus, watermarkDownloads, null, downloader);
247
266
  }
267
+ // A single-input `sole_op` chain — e.g. `.textWatermark('x').compress()`
268
+ // lowered to a `text_watermark` job + downstream `post` job (IQc01rj0).
269
+ // Project ONLY the terminal deliverable, filtering the intermediate sole_op
270
+ // artifact. The recipe key is preserved (unlike the multi-input branches):
271
+ // this is the single-file path with a terminal-ref filter.
272
+ if (isSoleOpChainStatus(finalStatus)) {
273
+ const soleOpRef = soleOpChainDeliverableRef(finalStatus);
274
+ const soleOpDownloads = jobDownloads.filter((d) => d.ref === soleOpRef);
275
+ return projectDownloadsToRunResult(this.workflowId, finalStatus, soleOpDownloads, this.#key, downloader);
276
+ }
248
277
  return projectDownloadsToRunResult(this.workflowId, finalStatus, jobDownloads, this.#key, downloader);
249
278
  }
250
279
  /**
@@ -3,7 +3,7 @@ export { parseSseStream } from './sse.js';
3
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
- 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';
6
+ export { GislError, GislApiError, GislValidationError, GislBalanceExhaustedError, GislLongFormConcurrencyError, 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
8
  export type { ErrorCategory } from './generated/sdk_spec/errors.js';
9
9
  export { RunResult } from './file-first.js';
@@ -20,20 +20,20 @@ export { BatchRecipe } from './file-first.js';
20
20
  export { Handle, StatusSnapshot } from './handle.js';
21
21
  export { gisl, create } from './gisl.js';
22
22
  export type { GislCreateOptions, Environment, ErgonomicClient, SingleInputOperationType, MultiInputOperationType, } from './gisl.js';
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';
23
+ export { presetDefaults, PresetDefaults, type PresetMedia, type PresetOp, type AnyPresetOptions, ImageCompressPresetOptions, type ImageCompressPresetOptionsInput, AudioCompressPresetOptions, type AudioCompressPresetOptionsInput, VideoCompressPresetOptions, type VideoCompressPresetOptionsInput, DocumentOfficeCompressPresetOptions, type DocumentOfficeCompressPresetOptionsInput, DocumentOdfCompressPresetOptions, type DocumentOdfCompressPresetOptionsInput, DocumentEpubCompressPresetOptions, type DocumentEpubCompressPresetOptionsInput, OptimizeFor, ImageMetadataPolicy, ImageFormat, VideoCodec, VideoPreset, VideoFit, AudioBitrate, AudioCodec, AudioSampleRate, } from './ergonomic/presets/index.js';
24
24
  export { OperationBuilder, MapEachBuilder } from './builder.js';
25
25
  export { MergeBuilder, asset, handle, clip } from './merge.js';
26
26
  export type { Asset, ClipEntry, ClipOptions, MergeMediaKind, MergeOptions, SequenceEntry, } from './merge.js';
27
27
  export type { Artifact, ArtifactRef, JobBreakdown, OperationBreakdown, ProcessingProgressEvent, ProgressEvent, ResolvedOptions, ResolvedOptionsSources, Result, RunOptions, SubmitOptions, UploadProgressEvent, } from './builder.js';
28
28
  export { PRESET_VERSION, resolveCompressOptions } from './ergonomic/preset_resolver.js';
29
29
  export type { ResolveCompressOptionsInput, ResolveCompressOptionsOutput, } from './ergonomic/preset_resolver.js';
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';
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, LongFormConcurrencyLimitResponse, LongFormConcurrencyLimitResponseAllOfLinks, TierRestrictionResponse, FeatureTierRestrictedResponse, FeatureNotAvailableResponse, FeatureViolation, WorkflowExpiredResponse, ProbePendingResponse, AuthErrorResponse, } from '@giveitsmaller/contracts/openapi';
31
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';
32
32
  export type { SseOperationProgressData, SseOperationCompletedData, SseOperationFailedData, SseJobCompletedData, SseJobFailedData, SseWorkflowTerminalData, } from '@giveitsmaller/contracts/openapi';
33
33
  export type { MultiOutputCompletion, PageIndexed, PositionIndexed, Unindexed, } from '@giveitsmaller/contracts/asyncapi';
34
34
  import type { MultiOutputCompletion as _MultiOutputCompletion } from '@giveitsmaller/contracts/asyncapi';
35
35
  export type OperationResultOutputEntry = _MultiOutputCompletion['outputs'][number];
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';
36
+ export type { CompressImageOptions, CompressImageJpegOptions, CompressImagePngOptions, CompressImageAvifOptions, CompressVideoOptions, CompressAudioOptions, 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';
37
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';
38
38
  export { archiveMetadata, audioOverlayMetadata, audioWatermarkMetadata, compressMetadata, convertMetadata, customLumaMetadata, imageWatermarkMetadata, mergeMetadata, textWatermarkMetadata, thumbnailMetadata, audioToVideoMetadata, videoWatermarkMetadata, videoTextWatermarkMetadata, splitMetadata, transformMetadata, } from '@giveitsmaller/contracts/operations';
39
39
  export type { ConvertOptions, ThumbnailOptions, TransformOptions, TextWatermarkOptions, WatermarkOptions, WatermarkOverlay, WatermarkAnchor, } from './ergonomic/option_types.js';
@@ -9,7 +9,7 @@ export { GislClient, DEFAULT_MULTIPART_FIRST_CHUNK_SIZE } from './client.js';
9
9
  export { parseSseStream } from './sse.js';
10
10
  export { uploadSource, jobOutputSource, externalImportSource, connectionSource, } from './types.js';
11
11
  // Errors
12
- export { GislError, GislApiError, GislValidationError, GislBalanceExhaustedError, GislTierRestrictedError, GislFeatureTierRestrictedError, GislFeatureNotAvailableError, GislWorkflowExpiredError, GislProbePendingError, GislAuthError, GislUploadCapExceededError, GislMultipartPartError, GislMultipartPartCountError,
12
+ export { GislError, GislApiError, GislValidationError, GislBalanceExhaustedError, GislLongFormConcurrencyError, GislTierRestrictedError, GislFeatureTierRestrictedError, GislFeatureNotAvailableError, GislWorkflowExpiredError, GislProbePendingError, GislAuthError, GislUploadCapExceededError, GislMultipartPartError, GislMultipartPartCountError,
13
13
  // SDK-3 (Wb6ebOMM) — typed errors for the 3 resume-support endpoints.
14
14
  GislMultipartSessionNotFoundError, GislMultipartSessionOwnershipError, GislMultipartSessionAuthRequiredError, GislTimeoutError, GislAbortError,
15
15
  // FF2b / tywwynmN — transport-level failure (mirrors PHP GislNetworkError);
@@ -77,7 +77,7 @@ export { gisl, create } from './gisl.js';
77
77
  // Ergonomic preset defaults (T4a / VhIj4S7T) — typed leaf DTOs + immutable
78
78
  // `PresetDefaults` builder + `presetDefaults()` factory + ergonomic enum
79
79
  // re-exports. Resolver wiring (T4b) consumes `PresetDefaults.cellFor()`.
80
- export { presetDefaults, PresetDefaults, ImageCompressPresetOptions, AudioCompressPresetOptions, VideoCompressPresetOptions, DocumentPdfCompressPresetOptions, DocumentOfficeCompressPresetOptions, DocumentOdfCompressPresetOptions, DocumentEpubCompressPresetOptions, OptimizeFor, ImageMetadataPolicy, ImageFormat, VideoCodec, VideoPreset, VideoFit, AudioBitrate, AudioCodec, AudioSampleRate, PdfProfile, PdfColorspace, } from './ergonomic/presets/index.js';
80
+ export { presetDefaults, PresetDefaults, ImageCompressPresetOptions, AudioCompressPresetOptions, VideoCompressPresetOptions, DocumentOfficeCompressPresetOptions, DocumentOdfCompressPresetOptions, DocumentEpubCompressPresetOptions, OptimizeFor, ImageMetadataPolicy, ImageFormat, VideoCodec, VideoPreset, VideoFit, AudioBitrate, AudioCodec, AudioSampleRate, } from './ergonomic/presets/index.js';
81
81
  // Operation-builder surface (T2 / xVDTIm8C) — `client.compress/convert/thumbnail`
82
82
  // returns an `OperationBuilder`; `.run()` projects to a flat `Result` /
83
83
  // `.submit({webhook})` returns a `Handle`. Progress events are the
package/dist/merge.js CHANGED
@@ -128,14 +128,14 @@ export class MergeBuilder {
128
128
  });
129
129
  // 5. Fetch downloads + project.
130
130
  if (Date.now() >= deadline) {
131
- throw new GislTimeoutError(`Merge workflow ${created.workflowId} reached terminal status but maxWait elapsed before downloads could be fetched`);
131
+ throw new GislTimeoutError(`Merge workflow ${created.workflowId} reached terminal status but maxWait elapsed before downloads could be fetched`, created.workflowId);
132
132
  }
133
133
  const downloads = await this.client.getWorkflowDownloads(created.workflowId);
134
134
  // TDqmkWpX: the maxWait deadline also covers the downloads fetch itself —
135
135
  // re-check AFTER the call so a slow getWorkflowDownloads cannot return a
136
136
  // success past the advertised whole-run deadline.
137
137
  if (Date.now() >= deadline) {
138
- throw new GislTimeoutError(`Merge workflow ${created.workflowId} downloads fetch completed after maxWait elapsed`);
138
+ throw new GislTimeoutError(`Merge workflow ${created.workflowId} downloads fetch completed after maxWait elapsed`, created.workflowId);
139
139
  }
140
140
  // p0SuJEeK — project ONLY the merge job's output. getWorkflowDownloads
141
141
  // returns a download group per terminal job, which now INCLUDES the
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { OperationType, OperationsSchemaResponse, OperationCapability, OutputProperties, ImageEncodeCapabilities, CallbackEventType, SseEventType, SseOperationProgressData, SseOperationCompletedData, SseOperationFailedData, SseJobCompletedData, SseJobFailedData, SseWorkflowTerminalData, MultipartInitiateRequestMetadataHint, UploadProbeResponse } from '@giveitsmaller/contracts/openapi';
2
- import type { JobInputV2RoleEnum } from '@giveitsmaller/contracts/openapi';
2
+ import type { JobInputV2RoleEnum, NotifyConfig } from '@giveitsmaller/contracts/openapi';
3
3
  export interface GislClientConfig {
4
4
  baseUrl: string;
5
5
  apiKey?: string;
@@ -188,6 +188,14 @@ export interface WorkflowCreatePayload {
188
188
  export?: ExternalDestinationPayload;
189
189
  delivery?: DeliveryPayload;
190
190
  processing?: WorkflowProcessingPayload;
191
+ /**
192
+ * Per-job completion notification (contracts v2.164.0, `notify.email`).
193
+ * Opaque passthrough wire shape — the ergonomic `notifyEmail` surface
194
+ * (SubmitOptions/RunOptions + builder convenience) is a separate follow-up
195
+ * (card y6jsQCpb); this field only acknowledges the wire key so a
196
+ * hand-built payload can carry it. Mirrors `export`/`delivery`/`processing`.
197
+ */
198
+ notify?: NotifyConfig;
191
199
  }
192
200
  /**
193
201
  * Single source of truth for WorkflowCreatePayload's top-level wire keys.
@@ -196,7 +204,7 @@ export interface WorkflowCreatePayload {
196
204
  * only via deep imports and should not be treated as public API.
197
205
  * @internal
198
206
  */
199
- export declare const WORKFLOW_CREATE_PAYLOAD_KEYS: readonly ["jobs", "source", "operations", "workflow_edges", "callback_url", "callback_events", "export", "delivery", "processing"];
207
+ export declare const WORKFLOW_CREATE_PAYLOAD_KEYS: readonly ["jobs", "source", "operations", "workflow_edges", "callback_url", "callback_events", "export", "delivery", "processing", "notify"];
200
208
  export interface GetSchemaOptions {
201
209
  /** Filter the schema to operations that accept this MIME type (e.g. `image/jpeg`). */
202
210
  mimeType?: string;
@@ -322,7 +330,7 @@ export interface ReadCapabilityOptions {
322
330
  export interface WaitOptions {
323
331
  /** Poll interval in milliseconds (default: 2000) */
324
332
  intervalMs?: number;
325
- /** Maximum wait time in milliseconds (default: 300000 = 5 min) */
333
+ /** Maximum wait time in milliseconds (default: 600000 = 10 min) */
326
334
  timeoutMs?: number;
327
335
  /** Called after each poll with current status */
328
336
  onPoll?: (status: string) => void;
package/dist/types.js CHANGED
@@ -50,4 +50,5 @@ export const WORKFLOW_CREATE_PAYLOAD_KEYS = Object.freeze([
50
50
  'export',
51
51
  'delivery',
52
52
  'processing',
53
+ 'notify',
53
54
  ]);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@giveitsmaller/sdk",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Node.js SDK for the GISL (Give It Smaller) file compression and processing API",
5
- "license": "MIT",
5
+ "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "exports": {
@@ -31,7 +31,7 @@
31
31
  "node": ">=18"
32
32
  },
33
33
  "dependencies": {
34
- "@giveitsmaller/contracts": "^0.53.0"
34
+ "@giveitsmaller/contracts": "^0.59.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^22",
@@ -1,12 +0,0 @@
1
- import { PdfProfile, OptimizeFor } from '../../generated/sdk_spec/enums.js';
2
- export interface DocumentPdfCompressPresetOptionsInput {
3
- readonly profile?: PdfProfile;
4
- readonly grayscale?: boolean;
5
- }
6
- export declare class DocumentPdfCompressPresetOptions {
7
- readonly profile?: PdfProfile;
8
- readonly grayscale?: boolean;
9
- private constructor();
10
- static from(input: DocumentPdfCompressPresetOptionsInput): DocumentPdfCompressPresetOptions;
11
- static shippedDefaultsFor(level: OptimizeFor): DocumentPdfCompressPresetOptions;
12
- }
@@ -1,33 +0,0 @@
1
- // T4a — DocumentPdfCompressPresetOptions leaf DTO.
2
- //
3
- // Field set (2): profile, grayscale — the worker-honored stable PDF controls
4
- // (contracts v2.96.0 Acrobat-PDF realignment Lw1LseYr). The earlier
5
- // {profile, colorspace, flattenForms} set was retired: colorspace + flatten_forms
6
- // are `planned` (not read by the worker) so presets never emit them, and
7
- // `image_dpi` + `pages` are per-call knobs, not preset cells.
8
- import { shippedDefaultsFor as f3ShippedDefaultsFor } from '../../generated/sdk_spec/presets.js';
9
- import { translateEnum } from './_translate.js';
10
- export class DocumentPdfCompressPresetOptions {
11
- profile;
12
- grayscale;
13
- constructor(input) {
14
- if (input.profile !== undefined)
15
- this.profile = input.profile;
16
- if (input.grayscale !== undefined)
17
- this.grayscale = input.grayscale;
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 ('grayscale' in cell)
30
- mut.grayscale = cell.grayscale;
31
- return new DocumentPdfCompressPresetOptions(input);
32
- }
33
- }