@giveitsmaller/sdk 0.20.0 → 0.22.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 (40) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +55 -14
  3. package/dist/_audit.js +2 -4
  4. package/dist/builder.d.ts +4 -4
  5. package/dist/builder.js +47 -22
  6. package/dist/client.d.ts +9 -6
  7. package/dist/client.js +90 -31
  8. package/dist/ergonomic/image_output_routes.d.ts +97 -0
  9. package/dist/ergonomic/image_output_routes.js +227 -25
  10. package/dist/ergonomic/option_types.d.ts +11 -2
  11. package/dist/ergonomic/preset_resolver.d.ts +24 -2
  12. package/dist/ergonomic/preset_resolver.js +100 -10
  13. package/dist/ergonomic/presets/image_compress.js +16 -4
  14. package/dist/ergonomic/presets/index.d.ts +9 -8
  15. package/dist/ergonomic/presets/index.js +1 -9
  16. package/dist/ergonomic/presets/video_compress.d.ts +14 -0
  17. package/dist/errors.d.ts +101 -2
  18. package/dist/errors.js +108 -1
  19. package/dist/file-first.d.ts +81 -13
  20. package/dist/file-first.js +329 -69
  21. package/dist/generated/sdk_spec/enums.d.ts +0 -26
  22. package/dist/generated/sdk_spec/enums.js +0 -16
  23. package/dist/generated/sdk_spec/errors.d.ts +1 -1
  24. package/dist/generated/sdk_spec/errors.js +159 -1
  25. package/dist/generated/sdk_spec/presets.js +0 -14
  26. package/dist/generated/sdk_spec/version.d.ts +2 -2
  27. package/dist/generated/sdk_spec/version.js +2 -2
  28. package/dist/gisl.d.ts +21 -2
  29. package/dist/handle.d.ts +6 -1
  30. package/dist/handle.js +42 -13
  31. package/dist/index.core.d.ts +4 -4
  32. package/dist/index.core.js +6 -3
  33. package/dist/merge.d.ts +23 -0
  34. package/dist/merge.js +2 -2
  35. package/dist/sse.js +49 -1
  36. package/dist/types.d.ts +11 -3
  37. package/dist/types.js +1 -0
  38. package/package.json +3 -3
  39. package/dist/ergonomic/presets/document_pdf_compress.d.ts +0 -12
  40. package/dist/ergonomic/presets/document_pdf_compress.js +0 -33
@@ -256,10 +256,43 @@ export declare function projectMultiJobToRunResult(workflowId: string, finalStat
256
256
  * @internal Exported for the file-first `Handle`; not part of the public API.
257
257
  */
258
258
  export declare function isFanoutStatus(finalStatus: WorkflowStatusResponse): boolean;
259
+ /**
260
+ * Job id/ref for the DOWNSTREAM job that carries post-`sole_op` steps. A
261
+ * `sole_op` op (image_watermark / video_watermark / merge — ADR-0025) MUST be
262
+ * the only op in its job, so when a caller chains `compress()` / `convert()` /
263
+ * `thumbnail()` / `transform()` after `watermark()` / `merge()`, those steps
264
+ * lower into this separate job that consumes the sole_op output via
265
+ * `job_output` (the server derives the DAG from the `from` reference — no
266
+ * explicit `workflow_edges` needed). When present it is the TERMINAL deliverable,
267
+ * so `run()` / the {@link Handle} project THIS job's output, and the status-shape
268
+ * detectors accept it alongside the sole_op + `src_{i}` refs. PIiUit28.
269
+ */
270
+ export declare const _POST_STEP_JOB_REF = "post";
271
+ /**
272
+ * Job id/ref for the UPSTREAM job carrying any steps that PRECEDE a single-input
273
+ * `sole_op` op (e.g. `.compress().textWatermark()`): the pre-steps run in this
274
+ * job, the `sole_op` job then consumes its output via `job_output`. Distinct
275
+ * from the multi-input `src_{i}` fan-in refs. IQc01rj0.
276
+ */
277
+ export declare const _PRE_STEP_JOB_REF = "pre";
278
+ /**
279
+ * Wire op types the API marks `sole_op` (ADR-0025) — the op MUST be the ONLY op
280
+ * in its job. Mirrors `operation-capabilities.json` `operations.<op>.sole_op`,
281
+ * inlined as a browser-safe const (the raw-JSON sidecar subpath is Node-only)
282
+ * and PINNED to that projection by `sole-op-conformance.test.ts` — a contract
283
+ * regen that flips an op's `sole_op` fails there. The single-input
284
+ * {@link Recipe.toWorkflowPayload} reads THIS set to split a chain at every
285
+ * sole_op boundary into a `job_output`-linked job chain (so
286
+ * `.textWatermark('x').compress()` lowers to a valid DAG, not a contract-invalid
287
+ * co-bundled job). Mirrored by PHP `Recipe::SOLE_OP_TYPES`. IQc01rj0.
288
+ * @internal
289
+ */
290
+ export declare const SOLE_OP_TYPES: ReadonlySet<string>;
259
291
  /**
260
292
  * True when a terminal status describes a fluent `files([...]).merge(...)`
261
293
  * combine — at least one job ref `merge` and every OTHER job ref is `src_{i}`
262
- * (the ids the {@link MergedRecipe} lowering assigns). The data-driven seam that
294
+ * or the downstream `post` job (the ids the {@link MergedRecipe} lowering
295
+ * assigns; `post` carries any post-combine steps). The data-driven seam that
263
296
  * lets {@link Handle.wait}/{@link Handle.result} project ONLY the merged output
264
297
  * — filtering the `src_*` passthrough plumbing — even after a
265
298
  * `client.workflow(id)` reattach (no construction-time marker), matching
@@ -282,9 +315,10 @@ export declare function isMergeStatus(finalStatus: WorkflowStatusResponse): bool
282
315
  export declare function isArchiveStatus(finalStatus: WorkflowStatusResponse): boolean;
283
316
  /**
284
317
  * True when a terminal status describes a fluent `file(...).watermark(overlay)`
285
- * — at least one job ref `watermark` and every OTHER job ref is `src_{i}` (the
286
- * ids the {@link WatermarkedRecipe} lowering assigns: `src_0` base, `src_1`
287
- * overlay). Lets {@link Handle.wait}/{@link Handle.result} AND
318
+ * — at least one job ref `watermark` and every OTHER job ref is `src_{i}` or
319
+ * the downstream `post` job (the ids the {@link WatermarkedRecipe} lowering
320
+ * assigns: `src_0` base, `src_1` overlay, `post` any post-watermark steps).
321
+ * Lets {@link Handle.wait}/{@link Handle.result} AND
288
322
  * {@link WatermarkedRecipe.run} project ONLY the watermark output — filtering
289
323
  * the `src_*` passthrough plumbing — even after a `client.workflow(id)` reattach.
290
324
  * Mutually exclusive with {@link isFanoutStatus} / {@link isMergeStatus} /
@@ -293,6 +327,28 @@ export declare function isArchiveStatus(finalStatus: WorkflowStatusResponse): bo
293
327
  * @internal Exported for the file-first `Handle`; not part of the public API.
294
328
  */
295
329
  export declare function isWatermarkStatus(finalStatus: WorkflowStatusResponse): boolean;
330
+ /**
331
+ * True when a terminal status describes a SINGLE-INPUT `sole_op` chain — e.g.
332
+ * `.textWatermark('x').compress()` lowered to a `text_watermark` job + a
333
+ * downstream `post` job (and an optional upstream `pre` job for steps before the
334
+ * sole_op). Every job ref is a `sole_op` wire type ({@link SOLE_OP_TYPES}) or the
335
+ * `pre`/`post` chain refs, with NO `src_{i}` fan-in ref (which distinguishes it
336
+ * from the multi-input merge/watermark/archive DAGs). Lets a submitted/reattached
337
+ * {@link Handle} project ONLY the terminal deliverable — filtering the
338
+ * intermediate sole_op artifact — without builder state. IQc01rj0.
339
+ *
340
+ * @internal Exported for the file-first `Handle`; not part of the public API.
341
+ */
342
+ export declare function isSoleOpChainStatus(finalStatus: WorkflowStatusResponse): boolean;
343
+ /**
344
+ * The terminal deliverable ref for a single-input `sole_op` chain status: the
345
+ * downstream `post` job when present, else the `sole_op` job itself (the ref in
346
+ * {@link SOLE_OP_TYPES}). Mirrors how the merge/watermark paths pick their
347
+ * terminal via {@link terminalOutputRef} in `handle.ts`. IQc01rj0.
348
+ *
349
+ * @internal
350
+ */
351
+ export declare function soleOpChainDeliverableRef(finalStatus: WorkflowStatusResponse): string;
296
352
  /**
297
353
  * The primary file a {@link Recipe} operates on — the "subject" of the
298
354
  * file-first surface. A discriminated union over the ways a caller names an
@@ -461,6 +517,15 @@ export declare class Recipe {
461
517
  * fixed id). Not part of the caller-facing fluent surface.
462
518
  */
463
519
  toWorkflowPayload(fileId: string, callbackUrl?: string): WorkflowCreatePayload;
520
+ /**
521
+ * Trigger the per-step lowering purely for its validation side effects
522
+ * (route honoring, planned / out-of-enum values, `media_unknown`), discarding
523
+ * the result. Called BEFORE uploading bytes so a route-invalid recipe fails
524
+ * fast instead of after the upload is spent — parity with PHP
525
+ * `assertOperationsLowerable`. Lowering reads only `steps` + the input token,
526
+ * not the upload id, so this is a faithful preflight (0azjb6Rg).
527
+ */
528
+ private assertOperationsLowerable;
464
529
  /** The result-addressing key passed to `file()`, or undefined. */
465
530
  key(): string | undefined;
466
531
  /** The number of operations chained so far (introspection / tests). */
@@ -771,9 +836,10 @@ export declare class FilesRecipe {
771
836
  *
772
837
  * **Lowering (one workflow):** each input is uploaded once and wrapped in its
773
838
  * own single-input `passthrough` source job (`src_N`); the `merge` job consumes
774
- * those via `job_output` inputs (array order = play order) and carries the merge
775
- * op FIRST in its `operations[]`, followed by any post-combine ops (compress /
776
- * convert / thumbnail) so they run on the merged output in the same job. The
839
+ * those via `job_output` inputs (array order = play order). `merge` is
840
+ * `sole_op` (ADR-0025), so it is the ONLY op in its job; any post-combine ops
841
+ * (compress / convert / thumbnail / transform) lower into a downstream `post`
842
+ * job that consumes the merged output via `job_output`. The
777
843
  * merge-level wire options reuse {@link wireMergeOptions} so a fluent merge
778
844
  * lowers identically to the operation-first `client.merge()`.
779
845
  *
@@ -798,9 +864,9 @@ export declare class MergedRecipe {
798
864
  transform(options?: TransformOptions): MergedRecipe;
799
865
  /**
800
866
  * Lower to the merge DAG: one `passthrough` source job per input + one
801
- * `merge` job whose `operations[]` is `[merge, ...post-combine ops]`. The
802
- * merge job's `inputs[]` consume the source jobs via `job_output` in input
803
- * (play) order.
867
+ * `merge` job whose `operations[]` is exactly `[merge]` (sole_op). The merge
868
+ * job's `inputs[]` consume the source jobs via `job_output` in input (play)
869
+ * order; any post-combine ops lower into a downstream `post` job.
804
870
  *
805
871
  * @internal Consumed by {@link run} (after uploading all inputs), {@link submit}
806
872
  * (with a webhook), and the cross-language parity harness (with fixed ids).
@@ -964,7 +1030,8 @@ export declare class ArchivedRecipe {
964
1030
  * `passthrough` source job (`src_0` base, `src_1` overlay; their own preceding
965
1031
  * steps lower into those jobs), and the `watermark` job consumes them via
966
1032
  * `job_output` inputs tagged `role: base` / `role: overlay`. Post-watermark
967
- * `compress`/`convert`/`thumbnail` chain onto the watermark output. Mirrors
1033
+ * `compress`/`convert`/`thumbnail`/`transform` steps lower into a downstream
1034
+ * `post` job on the watermark output (`image_watermark` is `sole_op`). Mirrors
968
1035
  * {@link MergedRecipe}. `textWatermark` is intentionally NOT a post-verb here.
969
1036
  */
970
1037
  export declare class WatermarkedRecipe {
@@ -988,8 +1055,9 @@ export declare class WatermarkedRecipe {
988
1055
  /**
989
1056
  * Lower to the watermark DAG: a `src_0` passthrough/base-steps job + a `src_1`
990
1057
  * passthrough/overlay-steps job + one `watermark` job whose `inputs[]` consume
991
- * them via `job_output` (role base/overlay) and whose `operations[]` is
992
- * `[image_watermark|video_watermark, ...post-watermark ops]`. `fileIds` is
1058
+ * them via `job_output` (role base/overlay). The watermark op is `sole_op`
1059
+ * (ADR-0025), so `operations[]` is exactly `[image_watermark|video_watermark]`;
1060
+ * any post-watermark ops lower into a downstream `post` job. `fileIds` is
993
1061
  * `[baseId, overlayId]` (upload order). Throws pre-lowering if the base media
994
1062
  * is undetectable/unsupported (the planned-op gate).
995
1063
  *