@giveitsmaller/sdk 0.6.0 → 0.8.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.
Files changed (52) hide show
  1. package/dist/_audit.js +71 -0
  2. package/dist/builder.d.ts +406 -0
  3. package/dist/builder.js +706 -0
  4. package/dist/client.d.ts +10 -0
  5. package/dist/client.js +42 -6
  6. package/dist/credentials.d.ts +61 -0
  7. package/dist/credentials.js +200 -0
  8. package/dist/ergonomic/preset_resolver.d.ts +75 -0
  9. package/dist/ergonomic/preset_resolver.js +568 -0
  10. package/dist/ergonomic/presets/_translate.d.ts +11 -0
  11. package/dist/ergonomic/presets/_translate.js +35 -0
  12. package/dist/ergonomic/presets/audio_compress.d.ts +16 -0
  13. package/dist/ergonomic/presets/audio_compress.js +45 -0
  14. package/dist/ergonomic/presets/document_epub_compress.d.ts +14 -0
  15. package/dist/ergonomic/presets/document_epub_compress.js +34 -0
  16. package/dist/ergonomic/presets/document_odf_compress.d.ts +14 -0
  17. package/dist/ergonomic/presets/document_odf_compress.js +34 -0
  18. package/dist/ergonomic/presets/document_office_compress.d.ts +16 -0
  19. package/dist/ergonomic/presets/document_office_compress.js +40 -0
  20. package/dist/ergonomic/presets/document_pdf_compress.d.ts +14 -0
  21. package/dist/ergonomic/presets/document_pdf_compress.js +35 -0
  22. package/dist/ergonomic/presets/image_compress.d.ts +43 -0
  23. package/dist/ergonomic/presets/image_compress.js +95 -0
  24. package/dist/ergonomic/presets/index.d.ts +77 -0
  25. package/dist/ergonomic/presets/index.js +216 -0
  26. package/dist/ergonomic/presets/video_compress.d.ts +30 -0
  27. package/dist/ergonomic/presets/video_compress.js +83 -0
  28. package/dist/errors.d.ts +196 -1
  29. package/dist/errors.js +216 -0
  30. package/dist/file-first.d.ts +284 -0
  31. package/dist/file-first.js +445 -0
  32. package/dist/generated/sdk_spec/enums.d.ts +195 -0
  33. package/dist/generated/sdk_spec/enums.js +127 -0
  34. package/dist/generated/sdk_spec/errors.d.ts +16 -0
  35. package/dist/generated/sdk_spec/errors.js +523 -0
  36. package/dist/generated/sdk_spec/index.d.ts +4 -0
  37. package/dist/generated/sdk_spec/index.js +7 -0
  38. package/dist/generated/sdk_spec/presets.d.ts +6 -0
  39. package/dist/generated/sdk_spec/presets.js +157 -0
  40. package/dist/generated/sdk_spec/version.d.ts +3 -0
  41. package/dist/generated/sdk_spec/version.js +6 -0
  42. package/dist/gisl.d.ts +122 -0
  43. package/dist/gisl.js +283 -0
  44. package/dist/http-downloader.d.ts +9 -0
  45. package/dist/http-downloader.js +55 -0
  46. package/dist/index.d.ts +20 -5
  47. package/dist/index.js +45 -4
  48. package/dist/merge.d.ts +142 -0
  49. package/dist/merge.js +411 -0
  50. package/dist/types.d.ts +12 -14
  51. package/dist/types.js +18 -0
  52. package/package.json +3 -3
@@ -0,0 +1,127 @@
1
+ // CODE GENERATED — DO NOT EDIT.
2
+ // Source: compression_contracts/sdk-spec/ (see sdk-spec/README.md).
3
+ // Regenerate with: scripts/generate.py.
4
+ // Top-level preset selector. Resolved client-side to concrete wire fields per presets.yaml.
5
+ export const OptimizeFor = {
6
+ Size: "Size",
7
+ Balanced: "Balanced",
8
+ Quality: "Quality",
9
+ };
10
+ // Image compression algorithm. lossy = smaller file; lossless = no quality loss; auto = format-best.
11
+ export const ImageMode = {
12
+ Lossy: "lossy",
13
+ Lossless: "lossless",
14
+ Auto: "auto",
15
+ };
16
+ // Image output format selection. Original keeps input; Auto picks best per browser support; Smallest tries all and returns smallest.
17
+ export const ImageFormat = {
18
+ Original: "original",
19
+ Auto: "auto",
20
+ Smallest: "smallest",
21
+ Jpeg: "jpeg",
22
+ Png: "png",
23
+ Webp: "webp",
24
+ Avif: "avif",
25
+ };
26
+ // Image resize mode. Only applies when width or height is set (depends_on width/height in compress.yaml).
27
+ export const ImageFit = {
28
+ Max: "max",
29
+ Crop: "crop",
30
+ Scale: "scale",
31
+ };
32
+ // Image metadata handling. Counter-intuitive wire naming:
33
+ // All = strip everything (smallest file)
34
+ // None = keep all EXIF/IPTC/XMP
35
+ // Copyright = keep only copyright/author fields
36
+ // Sensitive = keep EXIF but strip GPS/location (GDPR-friendly)
37
+ export const ImageMetadataPolicy = {
38
+ All: "all",
39
+ None: "none",
40
+ Copyright: "copyright",
41
+ Sensitive: "sensitive",
42
+ };
43
+ // ICC color profile handling.
44
+ export const IccProfilePolicy = {
45
+ Preserve: "preserve",
46
+ Strip: "strip",
47
+ Srgb: "srgb",
48
+ };
49
+ // Video codec. H264 = widest compatibility; H265/Av1 = better compression but slower.
50
+ export const VideoCodec = {
51
+ H264: "h264",
52
+ H265: "h265",
53
+ Vp9: "vp9",
54
+ Av1: "av1",
55
+ };
56
+ // Encoding speed vs compression ratio trade-off (FFmpeg-style x264/x265 preset names).
57
+ export const VideoPreset = {
58
+ Ultrafast: "ultrafast",
59
+ Superfast: "superfast",
60
+ Veryfast: "veryfast",
61
+ Faster: "faster",
62
+ Fast: "fast",
63
+ Medium: "medium",
64
+ Slow: "slow",
65
+ Slower: "slower",
66
+ Veryslow: "veryslow",
67
+ };
68
+ // Video resize mode. Only applies when width or height is set. Pad is video-only (image fit lacks pad).
69
+ export const VideoFit = {
70
+ Max: "max",
71
+ Crop: "crop",
72
+ Scale: "scale",
73
+ Pad: "pad",
74
+ };
75
+ // Audio output bitrate in kbps. Shared between compress (audio + video.audioBitrate) cells.
76
+ export const AudioBitrate = {
77
+ _64: 64,
78
+ _96: 96,
79
+ _128: 128,
80
+ _192: 192,
81
+ _256: 256,
82
+ _320: 320,
83
+ };
84
+ // Audio codec. Aac = widest compatibility; Opus = best quality/size; Copy = passthrough (no re-encode).
85
+ export const AudioCodec = {
86
+ Aac: "aac",
87
+ Opus: "opus",
88
+ Vorbis: "vorbis",
89
+ Copy: "copy",
90
+ };
91
+ // Audio sample rate in Hz.
92
+ export const AudioSampleRate = {
93
+ _22050: 22050,
94
+ _44100: 44100,
95
+ _48000: 48000,
96
+ };
97
+ // PDF optimization profile. Web = aggressive; Print = preserve quality; Archive = PDF/A; Max = smallest.
98
+ export const PdfProfile = {
99
+ Web: "web",
100
+ Print: "print",
101
+ Archive: "archive",
102
+ Max: "max",
103
+ };
104
+ // PDF output color space.
105
+ export const PdfColorspace = {
106
+ Unchanged: "unchanged",
107
+ Rgb: "rgb",
108
+ Cmyk: "cmyk",
109
+ Grayscale: "grayscale",
110
+ };
111
+ /** Catalog of every ergonomic enum (canonicalName → wire). */
112
+ export const ERGONOMIC_ENUMS = {
113
+ OptimizeFor,
114
+ ImageMode,
115
+ ImageFormat,
116
+ ImageFit,
117
+ ImageMetadataPolicy,
118
+ IccProfilePolicy,
119
+ VideoCodec,
120
+ VideoPreset,
121
+ VideoFit,
122
+ AudioBitrate,
123
+ AudioCodec,
124
+ AudioSampleRate,
125
+ PdfProfile,
126
+ PdfColorspace,
127
+ };
@@ -0,0 +1,16 @@
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" | "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" | "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";
2
+ export type ErrorCategory = 'api' | 'config' | 'network' | 'auth' | 'validation' | 'chain';
3
+ export type ErrorStatus = 'wired' | 'planned';
4
+ export interface ErrorEntry {
5
+ readonly code: ErrorCode;
6
+ readonly category: ErrorCategory;
7
+ readonly source: string;
8
+ readonly status: ErrorStatus;
9
+ readonly httpStatus: number | null;
10
+ readonly retryable: boolean;
11
+ readonly sdkClass: string;
12
+ readonly description: string;
13
+ readonly metadataSchema: Readonly<Record<string, string>>;
14
+ }
15
+ export declare const ERROR_CODES: Readonly<Record<ErrorCode, ErrorEntry>>;
16
+ export declare const ERROR_CATEGORIES: Readonly<Record<ErrorCategory, readonly ErrorCode[]>>;
@@ -0,0 +1,523 @@
1
+ // CODE GENERATED — DO NOT EDIT.
2
+ // Source: compression_contracts/sdk-spec/ (see sdk-spec/README.md).
3
+ // Regenerate with: scripts/generate.py.
4
+ export const ERROR_CODES = Object.freeze({
5
+ "missing_credentials": Object.freeze({
6
+ code: "missing_credentials",
7
+ category: "config",
8
+ source: "SDK_local",
9
+ status: "wired",
10
+ httpStatus: null,
11
+ retryable: false,
12
+ sdkClass: "GislMissingCredentialsError",
13
+ description: "gisl.create() failed the credential chain (explicit → GISL_API_KEY env → ~/.gisl/credentials profile → fail-early).",
14
+ metadataSchema: Object.freeze({
15
+ "sourcesTried": "array",
16
+ }),
17
+ }),
18
+ "feature_requires_auth": Object.freeze({
19
+ code: "feature_requires_auth",
20
+ category: "config",
21
+ source: "SDK_local",
22
+ status: "wired",
23
+ httpStatus: null,
24
+ retryable: false,
25
+ sdkClass: "GislFeatureRequiresAuthError",
26
+ description: "SDK rejected an anonymous-mode call to a feature that requires authentication. Pre-flight gate; never reaches the API.",
27
+ metadataSchema: Object.freeze({
28
+ "feature": "string",
29
+ }),
30
+ }),
31
+ "undeclared_asset": Object.freeze({
32
+ code: "undeclared_asset",
33
+ category: "chain",
34
+ source: "SDK_local",
35
+ status: "wired",
36
+ httpStatus: null,
37
+ retryable: false,
38
+ sdkClass: "GislUndeclaredAssetError",
39
+ description: "Merge / archive / mapEach referenced an asset handle that was not declared upstream in the chain.",
40
+ metadataSchema: Object.freeze({
41
+ "ref": "string",
42
+ }),
43
+ }),
44
+ "unused_asset": Object.freeze({
45
+ code: "unused_asset",
46
+ category: "chain",
47
+ source: "SDK_local",
48
+ status: "wired",
49
+ httpStatus: null,
50
+ retryable: false,
51
+ sdkClass: "GislUnusedAssetError",
52
+ description: "A declared asset was never referenced in the chain (caller likely forgot to use it; escape via allowUnusedAssets).",
53
+ metadataSchema: Object.freeze({
54
+ "ref": "string",
55
+ }),
56
+ }),
57
+ "per_input_options_not_supported": Object.freeze({
58
+ code: "per_input_options_not_supported",
59
+ category: "chain",
60
+ source: "SDK_local",
61
+ status: "wired",
62
+ httpStatus: null,
63
+ retryable: false,
64
+ sdkClass: "GislPerInputOptionsNotSupportedError",
65
+ description: "per_input_options provided on a multi-input op role that doesn't accept it (e.g. role-less branch).",
66
+ metadataSchema: Object.freeze({
67
+ "op": "string",
68
+ "role": "string",
69
+ }),
70
+ }),
71
+ "chain_cardinality_mismatch": Object.freeze({
72
+ code: "chain_cardinality_mismatch",
73
+ category: "chain",
74
+ source: "SDK_local",
75
+ status: "wired",
76
+ httpStatus: null,
77
+ retryable: false,
78
+ sdkClass: "GislChainCardinalityMismatchError",
79
+ description: "Chain step expects a single artifact but the upstream step produces N (e.g.\n.compress() chained after convert(pdf, pages: \"1-20\")). Recovery: branch\nto a single artifact OR use .mapEach() to fan out.\n",
80
+ metadataSchema: Object.freeze({
81
+ "upstreamArtifactCount": "integer",
82
+ "operation": "string",
83
+ }),
84
+ }),
85
+ "multipart_part_invalid": Object.freeze({
86
+ code: "multipart_part_invalid",
87
+ category: "validation",
88
+ source: "SDK_local",
89
+ status: "wired",
90
+ httpStatus: null,
91
+ retryable: false,
92
+ sdkClass: "GislMultipartPartError",
93
+ description: "SDK rejected a part configuration before upload (e.g. out-of-range part number, duplicate, missing).",
94
+ metadataSchema: Object.freeze({
95
+ "partNumber": "integer",
96
+ "reason": "string",
97
+ }),
98
+ }),
99
+ "multipart_part_count_exceeded": Object.freeze({
100
+ code: "multipart_part_count_exceeded",
101
+ category: "validation",
102
+ source: "SDK_local",
103
+ status: "wired",
104
+ httpStatus: null,
105
+ retryable: false,
106
+ sdkClass: "GislMultipartPartCountError",
107
+ description: "Multipart presign batch / total parts exceeds S3 ceilings (10 000 total, 100 per presign request).",
108
+ metadataSchema: Object.freeze({
109
+ "partCount": "integer",
110
+ "ceiling": "integer",
111
+ }),
112
+ }),
113
+ "timeout": Object.freeze({
114
+ code: "timeout",
115
+ category: "network",
116
+ source: "SDK_local",
117
+ status: "wired",
118
+ httpStatus: null,
119
+ retryable: true,
120
+ sdkClass: "GislTimeoutError",
121
+ description: "SDK-set deadline exceeded (run({maxWait}), waitForCompletion, multipart attempt timeout).",
122
+ metadataSchema: Object.freeze({
123
+ "timeoutMs": "integer",
124
+ "phase": "string",
125
+ }),
126
+ }),
127
+ "aborted": Object.freeze({
128
+ code: "aborted",
129
+ category: "network",
130
+ source: "SDK_local",
131
+ status: "wired",
132
+ httpStatus: null,
133
+ retryable: false,
134
+ sdkClass: "GislAbortError",
135
+ description: "Caller-supplied AbortSignal triggered cancellation.",
136
+ metadataSchema: Object.freeze({
137
+ "reason": "string",
138
+ }),
139
+ }),
140
+ "validation_failed": Object.freeze({
141
+ code: "validation_failed",
142
+ category: "validation",
143
+ source: "ErrorEnvelope.error",
144
+ status: "wired",
145
+ httpStatus: 422,
146
+ retryable: false,
147
+ sdkClass: "GislValidationError",
148
+ description: "422 — request validation failure; emitted on the wire as `VALIDATION_FAILED` (e.g. invalid limit/offset on GET /api/v2/credits/usage). Carries `details[]`.",
149
+ metadataSchema: Object.freeze({
150
+ "details": "array",
151
+ }),
152
+ }),
153
+ "cyclic_workflow_edges": Object.freeze({
154
+ code: "cyclic_workflow_edges",
155
+ category: "validation",
156
+ source: "ErrorEnvelope.error",
157
+ status: "wired",
158
+ httpStatus: 422,
159
+ retryable: false,
160
+ sdkClass: "GislValidationError",
161
+ description: "422 — cycle/self-edge in the explicit `workflow_edges` DAG. Wire `CYCLIC_WORKFLOW_EDGES` (g8PPkbNu); ValidationErrorEnvelope shape, `details[0].field`=`workflow_edges`.",
162
+ metadataSchema: Object.freeze({
163
+ "details": "array",
164
+ }),
165
+ }),
166
+ "workflow_edge_references_unknown_job": Object.freeze({
167
+ code: "workflow_edge_references_unknown_job",
168
+ category: "validation",
169
+ source: "ErrorEnvelope.error",
170
+ status: "wired",
171
+ httpStatus: 400,
172
+ retryable: false,
173
+ sdkClass: "GislValidationError",
174
+ description: "400 — a `workflow_edges` entry, job-level `source`, or `inputs[].source` references a job not in the request. Wire `WORKFLOW_EDGE_REFERENCES_UNKNOWN_JOB` (g8PPkbNu).",
175
+ metadataSchema: Object.freeze({}),
176
+ }),
177
+ "reserved_job_id_pattern": Object.freeze({
178
+ code: "reserved_job_id_pattern",
179
+ category: "validation",
180
+ source: "ErrorEnvelope.error",
181
+ status: "wired",
182
+ httpStatus: 400,
183
+ retryable: false,
184
+ sdkClass: "GislValidationError",
185
+ description: "400 — user job `id` matches the reserved `^job_\\d+$` pattern as the SOLE failure. Wire `RESERVED_JOB_ID_PATTERN` (g8PPkbNu); mixed violations keep generic `BAD_REQUEST`.",
186
+ metadataSchema: Object.freeze({}),
187
+ }),
188
+ "cyclic_job_output_source_graph": Object.freeze({
189
+ code: "cyclic_job_output_source_graph",
190
+ category: "validation",
191
+ source: "ErrorEnvelope.error",
192
+ status: "wired",
193
+ httpStatus: 400,
194
+ retryable: false,
195
+ sdkClass: "GislValidationError",
196
+ description: "400 — an implicit cycle in the `job_output` source graph, caught during effective-input-MIME resolution on POST /api/workflows. Wire `CYCLIC_JOB_OUTPUT_SOURCE_GRAPH` (g8PPkbNu).",
197
+ metadataSchema: Object.freeze({}),
198
+ }),
199
+ "auth_failed": Object.freeze({
200
+ code: "auth_failed",
201
+ category: "auth",
202
+ source: "ErrorEnvelope.error",
203
+ status: "wired",
204
+ httpStatus: 401,
205
+ retryable: false,
206
+ sdkClass: "GislAuthError",
207
+ description: "401 — invalid / expired / missing API key.",
208
+ metadataSchema: Object.freeze({
209
+ "authErrorType": "string",
210
+ }),
211
+ }),
212
+ "feature_tier_restricted": Object.freeze({
213
+ code: "feature_tier_restricted",
214
+ category: "api",
215
+ source: "error_type",
216
+ status: "wired",
217
+ httpStatus: 403,
218
+ retryable: false,
219
+ sdkClass: "GislFeatureTierRestrictedError",
220
+ description: "403 — feature requires a higher subscription tier than the caller's.",
221
+ metadataSchema: Object.freeze({
222
+ "feature": "string",
223
+ "requiredTier": "string",
224
+ "currentTier": "string",
225
+ }),
226
+ }),
227
+ "tier_restriction": Object.freeze({
228
+ code: "tier_restriction",
229
+ category: "api",
230
+ source: "error_type",
231
+ status: "wired",
232
+ httpStatus: 403,
233
+ retryable: false,
234
+ sdkClass: "GislTierRestrictedError",
235
+ description: "403 — general tier restriction (not feature-specific). Wire emits `error_type: \"tier_restriction\"`; the SDK class name keeps the `TierRestricted` adjective form per packages/typescript/src/errors.ts.",
236
+ metadataSchema: Object.freeze({
237
+ "requiredTier": "string",
238
+ "currentTier": "string",
239
+ }),
240
+ }),
241
+ "multipart_session_ownership": Object.freeze({
242
+ code: "multipart_session_ownership",
243
+ category: "auth",
244
+ source: "ErrorEnvelope.error",
245
+ status: "wired",
246
+ httpStatus: 403,
247
+ retryable: false,
248
+ sdkClass: "GislMultipartSessionOwnershipError",
249
+ description: "403 on multipart resume — session exists but belongs to a different caller.",
250
+ metadataSchema: Object.freeze({
251
+ "uploadId": "string",
252
+ }),
253
+ }),
254
+ "multipart_session_auth_required": Object.freeze({
255
+ code: "multipart_session_auth_required",
256
+ category: "auth",
257
+ source: "ErrorEnvelope.error",
258
+ status: "wired",
259
+ httpStatus: 403,
260
+ retryable: false,
261
+ sdkClass: "GislMultipartSessionAuthRequiredError",
262
+ description: "403 on multipart resume — session was initiated anonymously; resume requires auth (future-flip per upstream 8LABloaz).",
263
+ metadataSchema: Object.freeze({
264
+ "uploadId": "string",
265
+ }),
266
+ }),
267
+ "multipart_session_not_found": Object.freeze({
268
+ code: "multipart_session_not_found",
269
+ category: "api",
270
+ source: "ErrorEnvelope.error",
271
+ status: "wired",
272
+ httpStatus: 404,
273
+ retryable: false,
274
+ sdkClass: "GislMultipartSessionNotFoundError",
275
+ description: "404 on multipart resume — upload_id unknown or expired past 48h TTL.",
276
+ metadataSchema: Object.freeze({
277
+ "uploadId": "string",
278
+ }),
279
+ }),
280
+ "workflow_expired": Object.freeze({
281
+ code: "workflow_expired",
282
+ category: "api",
283
+ source: "error_type",
284
+ status: "wired",
285
+ httpStatus: 410,
286
+ retryable: false,
287
+ sdkClass: "GislWorkflowExpiredError",
288
+ description: "410 — workflow result TTL expired; outputs no longer downloadable.",
289
+ metadataSchema: Object.freeze({
290
+ "workflowId": "string",
291
+ }),
292
+ }),
293
+ "balance_exhausted": Object.freeze({
294
+ code: "balance_exhausted",
295
+ category: "api",
296
+ source: "error_type",
297
+ status: "wired",
298
+ httpStatus: 402,
299
+ retryable: false,
300
+ sdkClass: "GislBalanceExhaustedError",
301
+ description: "402 — workflow create rejected because cost estimate exceeds available credits (monthly + purchased + overdraft).",
302
+ metadataSchema: Object.freeze({
303
+ "requiredCredits": "integer",
304
+ "availableCredits": "integer",
305
+ "links": "object",
306
+ }),
307
+ }),
308
+ "feature_not_available": Object.freeze({
309
+ code: "feature_not_available",
310
+ category: "api",
311
+ source: "error_type",
312
+ status: "wired",
313
+ httpStatus: 422,
314
+ retryable: false,
315
+ sdkClass: "GislFeatureNotAvailableError",
316
+ description: "422 — operation type is planned but not yet implemented server-side (e.g. custom_luma before Lambda support ships).",
317
+ metadataSchema: Object.freeze({
318
+ "feature": "string",
319
+ }),
320
+ }),
321
+ "upload_size_exceeds_tier": Object.freeze({
322
+ code: "upload_size_exceeds_tier",
323
+ category: "api",
324
+ source: "error_type",
325
+ status: "wired",
326
+ httpStatus: 422,
327
+ retryable: false,
328
+ sdkClass: "GislUploadCapExceededError",
329
+ description: "422 — uploaded file size exceeds the per-tier cap. Wire `error_type: \"upload_size_exceeds_tier\"`. SDK class GislUploadCapExceededError covers this + upload_duration_exceeds_tier (sibling code below).",
330
+ metadataSchema: Object.freeze({
331
+ "size": "integer",
332
+ "ceiling": "integer",
333
+ }),
334
+ }),
335
+ "upload_duration_exceeds_tier": Object.freeze({
336
+ code: "upload_duration_exceeds_tier",
337
+ category: "api",
338
+ source: "error_type",
339
+ status: "wired",
340
+ httpStatus: 422,
341
+ retryable: false,
342
+ sdkClass: "GislUploadCapExceededError",
343
+ description: "422 — uploaded media duration exceeds the per-tier cap. Wire `error_type: \"upload_duration_exceeds_tier\"`. Shares SDK class GislUploadCapExceededError with upload_size_exceeds_tier; consumers branch on the metadata.",
344
+ metadataSchema: Object.freeze({
345
+ "duration": "integer",
346
+ "ceiling": "integer",
347
+ }),
348
+ }),
349
+ "probe_pending": Object.freeze({
350
+ code: "probe_pending",
351
+ category: "api",
352
+ source: "error_type",
353
+ status: "wired",
354
+ httpStatus: 422,
355
+ retryable: true,
356
+ sdkClass: "GislApiError",
357
+ description: "422 on workflow create — upload probing not yet complete; retry after the upload finishes probing. Wire `error_type: \"probe_pending\"`.",
358
+ metadataSchema: Object.freeze({
359
+ "jobRef": "string",
360
+ }),
361
+ }),
362
+ "requires_reencode": Object.freeze({
363
+ code: "requires_reencode",
364
+ category: "api",
365
+ source: "ErrorEnvelope.error",
366
+ status: "wired",
367
+ httpStatus: 422,
368
+ retryable: false,
369
+ sdkClass: "GislApiError",
370
+ description: "422 on merge — inputs are byte-stream-incompatible (different codec / resolution / etc.); merge requires re-encode rather than concat.",
371
+ metadataSchema: Object.freeze({
372
+ "reason": "string",
373
+ }),
374
+ }),
375
+ "invalid_options": Object.freeze({
376
+ code: "invalid_options",
377
+ category: "validation",
378
+ source: "ErrorEnvelope.error",
379
+ status: "wired",
380
+ httpStatus: 422,
381
+ retryable: false,
382
+ sdkClass: "GislValidationError",
383
+ description: "422 — operation option failed server-side validation (range, depends_on, mutex). Often surfaces preflight rejections (e.g. split.cut_points len exceeds 200-output cap).",
384
+ metadataSchema: Object.freeze({
385
+ "field": "string",
386
+ "reason": "string",
387
+ }),
388
+ }),
389
+ "invalid_combination": Object.freeze({
390
+ code: "invalid_combination",
391
+ category: "validation",
392
+ source: "SDK_local",
393
+ status: "wired",
394
+ httpStatus: null,
395
+ retryable: false,
396
+ sdkClass: "GislValidationError",
397
+ description: "Two or more options that are mutually exclusive per contract `depends_on` / mutex were both provided.",
398
+ metadataSchema: Object.freeze({
399
+ "fields": "array",
400
+ }),
401
+ }),
402
+ "missing_dependency": Object.freeze({
403
+ code: "missing_dependency",
404
+ category: "validation",
405
+ source: "SDK_local",
406
+ status: "wired",
407
+ httpStatus: null,
408
+ retryable: false,
409
+ sdkClass: "GislValidationError",
410
+ description: "An option was set but its contract `depends_on` predicate was not satisfied (e.g. quality set but mode is not lossy).",
411
+ metadataSchema: Object.freeze({
412
+ "field": "string",
413
+ "requires": "array",
414
+ }),
415
+ }),
416
+ "unsupported_value": Object.freeze({
417
+ code: "unsupported_value",
418
+ category: "validation",
419
+ source: "SDK_local",
420
+ status: "wired",
421
+ httpStatus: null,
422
+ retryable: false,
423
+ sdkClass: "GislValidationError",
424
+ description: "A value was outside the allowed enum / range for an option.",
425
+ metadataSchema: Object.freeze({
426
+ "field": "string",
427
+ "value": "string",
428
+ "allowed": "array",
429
+ }),
430
+ }),
431
+ "type_mismatch": Object.freeze({
432
+ code: "type_mismatch",
433
+ category: "validation",
434
+ source: "SDK_local",
435
+ status: "wired",
436
+ httpStatus: null,
437
+ retryable: false,
438
+ sdkClass: "GislValidationError",
439
+ description: "A value's type didn't match the schema (e.g. string where integer expected).",
440
+ metadataSchema: Object.freeze({
441
+ "field": "string",
442
+ "expected": "string",
443
+ "actual": "string",
444
+ }),
445
+ }),
446
+ "upload_failed": Object.freeze({
447
+ code: "upload_failed",
448
+ category: "network",
449
+ source: "SDK_local",
450
+ status: "wired",
451
+ httpStatus: null,
452
+ retryable: true,
453
+ sdkClass: "GislError",
454
+ description: "Single-shot or multipart upload failed after retry exhaustion. Distinct from auth/balance/cap errors (those are typed above).",
455
+ metadataSchema: Object.freeze({
456
+ "reason": "string",
457
+ "attempt": "integer",
458
+ }),
459
+ }),
460
+ "workflow_failed": Object.freeze({
461
+ code: "workflow_failed",
462
+ category: "api",
463
+ source: "OperationResponse.error_code",
464
+ status: "wired",
465
+ httpStatus: null,
466
+ retryable: false,
467
+ sdkClass: "GislApiError",
468
+ description: "Workflow reached terminal failure status. Per-job error codes live on jobErrors[].errorCode.",
469
+ metadataSchema: Object.freeze({
470
+ "workflowId": "string",
471
+ "jobErrors": "array",
472
+ }),
473
+ }),
474
+ });
475
+ export const ERROR_CATEGORIES = Object.freeze({
476
+ api: Object.freeze([
477
+ "feature_tier_restricted",
478
+ "tier_restriction",
479
+ "multipart_session_not_found",
480
+ "workflow_expired",
481
+ "balance_exhausted",
482
+ "feature_not_available",
483
+ "upload_size_exceeds_tier",
484
+ "upload_duration_exceeds_tier",
485
+ "probe_pending",
486
+ "requires_reencode",
487
+ "workflow_failed",
488
+ ]),
489
+ config: Object.freeze([
490
+ "missing_credentials",
491
+ "feature_requires_auth",
492
+ ]),
493
+ network: Object.freeze([
494
+ "timeout",
495
+ "aborted",
496
+ "upload_failed",
497
+ ]),
498
+ auth: Object.freeze([
499
+ "auth_failed",
500
+ "multipart_session_ownership",
501
+ "multipart_session_auth_required",
502
+ ]),
503
+ validation: Object.freeze([
504
+ "multipart_part_invalid",
505
+ "multipart_part_count_exceeded",
506
+ "validation_failed",
507
+ "cyclic_workflow_edges",
508
+ "workflow_edge_references_unknown_job",
509
+ "reserved_job_id_pattern",
510
+ "cyclic_job_output_source_graph",
511
+ "invalid_options",
512
+ "invalid_combination",
513
+ "missing_dependency",
514
+ "unsupported_value",
515
+ "type_mismatch",
516
+ ]),
517
+ chain: Object.freeze([
518
+ "undeclared_asset",
519
+ "unused_asset",
520
+ "per_input_options_not_supported",
521
+ "chain_cardinality_mismatch",
522
+ ]),
523
+ });
@@ -0,0 +1,4 @@
1
+ export * from './presets.js';
2
+ export * from './enums.js';
3
+ export * from './errors.js';
4
+ export * from './version.js';
@@ -0,0 +1,7 @@
1
+ // CODE GENERATED — DO NOT EDIT.
2
+ // Source: compression_contracts/sdk-spec/ (see sdk-spec/README.md).
3
+ // Regenerate with: scripts/generate.py.
4
+ export * from './presets.js';
5
+ export * from './enums.js';
6
+ export * from './errors.js';
7
+ export * from './version.js';
@@ -0,0 +1,6 @@
1
+ export type PresetLevel = 'Size' | 'Balanced' | 'Quality';
2
+ export type PresetCell = Readonly<Record<string, string | number | boolean>>;
3
+ export type PresetMatrix = Readonly<Record<string, Readonly<Record<PresetLevel, PresetCell>>>>;
4
+ export declare const PRESETS: PresetMatrix;
5
+ /** Lookup the shipped preset cell for (mediaOp, level). Throws on unknown keys. */
6
+ export declare function shippedDefaultsFor(mediaOp: string, level: PresetLevel): PresetCell;