Skip to content

feat(ai-sdk)!: decouple image/audio .store() from @rudderjs/storage (#37)#43

Merged
suleimansh merged 1 commit into
mainfrom
decouple/storage-seam
Jun 26, 2026
Merged

feat(ai-sdk)!: decouple image/audio .store() from @rudderjs/storage (#37)#43
suleimansh merged 1 commit into
mainfrom
decouple/storage-seam

Conversation

@suleimansh

Copy link
Copy Markdown
Member

Closes #37. Second child of the @rudderjs decoupling epic #35.

What

  • New StorageAdapter contract (exported) - a one-method interface put(path, bytes) in src/storage-adapter.ts.
  • ImageGenerator.store() / AudioGenerator.store() no longer lazy-import @rudderjs/storage. They take a required caller-supplied storage: .store(path, storage). Image still does its own url -> bytes fetch; audio passes its Buffer. Missing-adapter throws a clear error.
  • Exported StorageAdapter from the entry; updated the JSDoc examples.

Breaking (0.x -> minor)

.store(path) is now .store(path, storage). No in-repo callers used the old form. A Rudder app wraps @rudderjs/storage in a ~3-line adapter:

const storage: StorageAdapter = { put: (path, bytes) => Storage.put(path, bytes) }

Verification

Added .store() tests (image base64 path, audio bytes, missing-adapter throw). Typecheck clean, 982 tests pass. No @rudderjs/storage references remain in src. Minor changeset included.

)

Second child of the @rudderjs decoupling epic (#35).

- New exported neutral StorageAdapter contract (put(path, bytes)) in
  src/storage-adapter.ts.
- ImageGenerator.store() and AudioGenerator.store() no longer lazy-import
  @rudderjs/storage. They take a REQUIRED caller-supplied storage arg
  (.store(path, storage)); construction-less guard throws a clear error if
  omitted. Image still fetches a url->bytes itself; audio passes its Buffer.
- Exported StorageAdapter from the entry; updated the JSDoc examples.

Breaking (0.x): .store(path) -> .store(path, storage). No in-repo callers
used the old form. A Rudder app wraps @rudderjs/storage in a ~3-line adapter.

Added store() tests (image base64, audio bytes, missing-adapter throw).
Typecheck clean, 982 tests pass.
@suleimansh suleimansh added the enhancement New feature or request label Jun 26, 2026
@suleimansh suleimansh self-assigned this Jun 26, 2026
@suleimansh suleimansh merged commit 3cb13db into main Jun 26, 2026
1 check passed
@suleimansh suleimansh deleted the decouple/storage-seam branch June 26, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ai-sdk decouple: storage seam — neutral StorageAdapter for image/audio .store()

1 participant