Skip to content

Generated Node SDK contract markers and devdock example#422

Draft
kvz wants to merge 17 commits into
mainfrom
sdk-gen-ts
Draft

Generated Node SDK contract markers and devdock example#422
kvz wants to merge 17 commits into
mainfrom
sdk-gen-ts

Conversation

@kvz

@kvz kvz commented Jun 2, 2026

Copy link
Copy Markdown
Member

Experimental Status

Experimental work: this PR is part of the API2 contract/generated SDK effort and is intentionally kept as a Draft while the generated surface is validated.

Why

API2 now generates TypeScript SDK endpoint and feature methods from contract data. This companion PR gives that generator real Node SDK marker regions to rewrite and compare, plus a checked-in example that proves the generated surface works as consumer code against devdock.

What changed

  • The checked-in TUS Assembly example now reads createTusAssembly input from generic scenario.preparations[] instead of the removed API2 compatibility field.
  • Added API2 generated feature markers for createTusAssembly() and waitForAssembly() in packages/node/src/Transloadit.ts.
  • Added API2 generated endpoint markers for the current generated low-level Transloadit methods in packages/node/src/Transloadit.ts.
  • Added a checked-in, hand-written devdock TUS Assembly example at packages/node/examples/api2-devdock-tus-assembly/main.ts.
  • Added a checked-in, hand-written devdock Template lifecycle example at packages/node/examples/api2-devdock-template-lifecycle/main.ts.
  • The generated blocks are owned by API2 contracts; fixes should land in API2 and be regenerated here.
  • The examples are deliberately not generated: they are idiomatic consumer proofs that use generated SDK methods and write small result JSON files for API2 QA to assert.

Companion PRs

Validation

  • From API2: api2/bin/cli.ts contracts sdks --no-motd --target transloadit --platform typescript --sdk-root ../node-sdk --rewrite-sdk --compare-existing
  • Node SDK: node --check packages/node/examples/api2-devdock-template-lifecycle/main.ts
  • Node SDK: yarn biome check packages/node/examples/api2-devdock-template-lifecycle/main.ts
  • From API2: core/bin/devdock.ts exec tstrun system/sdk_examples/typescript-transloadit-examples.test.ts -vv --max-time-per-test 480
  • Node SDK: yarn workspace @transloadit/node check

Transloadit Companion PRs

@kvz kvz changed the title Generated assembly feature markers Generated Node SDK contract markers and devdock example Jun 2, 2026
kvz and others added 13 commits June 2, 2026 05:37
The devdock Assembly lifecycle proof listed the first page of Assemblies
and could miss the created one on a busy server. The contract models an
assembly_id list filter (already used by the Go example), so expose it
on ListAssembliesParams and use it in the example.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
resumeTusUpload() is generated from the API2 resumeUpload TUS protocol
contract: it discovers the server offset with a HEAD request, PATCHes the
remaining bytes from that offset, asserts the final offset matches the
content length, and waits for the Assembly to finish. The new
api2-devdock-tus-resume-upload example interrupts an upload after the
first chunk like a dropped connection would, then resumes it through the
public SDK method.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The API acknowledges Assembly creation before the list storage row is
inserted (the SQL save is fire-and-forget at identification time), so an
immediate list can miss the just-created Assembly. Devdock logs show the
insert completing 126ms after the list query ran. Poll briefly so the
lifecycle proof asserts list contents deterministically instead of racing
the insert.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant