Skip to content

Create SDK without services by default in all cases#13906

Merged
rickyrombo merged 4 commits into
mainfrom
mjp-sdk-create
Mar 12, 2026
Merged

Create SDK without services by default in all cases#13906
rickyrombo merged 4 commits into
mainfrom
mjp-sdk-create

Conversation

@rickyrombo
Copy link
Copy Markdown
Contributor

@rickyrombo rickyrombo commented Mar 12, 2026

See changeset.

Motivation is to make the SDK types the same regardless of which config you pass in, and use the API endpoints by default.

To keep the existing "services" version of SDK, call createSdkWithServices explicitly. This is not recommended - writes and other services won't work without tedious and proper integration with the user's wallet.

Also:

  • Adds UploadsApi to services SDK
  • Updates storageService to storage in UploadsApi config

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 12, 2026

🦋 Changeset detected

Latest commit: 767fb20

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@audius/sdk Major
@audius/sdk-legacy Patch
@audius/sp-actions Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the @audius/sdk public constructor behavior so that sdk() always creates the “without legacy services” SDK (consistent API surface across configs), while exposing createSdkWithServices() as an explicit opt-in for legacy/service-backed functionality. It also updates internal consumers to call createSdkWithServices() where legacy services are still required and adds Uploads API wiring and improved OAuth logger plumbing.

Changes:

  • Make sdk an alias of the new createSdk (service-less by default), and export createSdk / createSdkWithServices from the SDK entrypoint.
  • Update internal call sites (web, mobile, commands, discovery-provider plugins, scripts) to use createSdkWithServices() where they still need legacy services.
  • Add/align UploadsApi construction across service-less and service-backed SDKs; adjust Uploads API service config shape and pass logger to OAuth.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/web/src/test/mocks/audiusSdk.ts Update test mock to instantiate SDK via createSdkWithServices() instead of sdk().
packages/web/src/services/audius-sdk/audiusSdk.ts Update web SDK initialization to call createSdkWithServices().
packages/sdk/src/sdk/types.ts Rename/privatize config schemas and define SdkConfigSchema union + SdkConfig type.
packages/sdk/src/sdk/sdk.ts Replace overloaded sdk() implementation with sdk = createSdk alias.
packages/sdk/src/sdk/scripts/verifyUser.ts Update script to construct SDK via createSdkWithServices().
packages/sdk/src/sdk/scripts/manageRewardsLookupTable.ts Update script to use createSdkWithServices() and adjust imports.
packages/sdk/src/sdk/index.ts Export createSdk and createSdkWithServices from SDK entrypoint.
packages/sdk/src/sdk/createSdkWithServices.ts Add schema parse, add Uploads API, and pass logger into OAuth.
packages/sdk/src/sdk/createSdk.ts Rename service-less constructor to createSdk, add schema parse, bind resolve, wire Uploads API, and pass logger into OAuth.
packages/sdk/src/sdk/api/uploads/types.ts Rename Uploads API services config prop from storageService to storage.
packages/sdk/src/sdk/api/uploads/UploadsApi.ts Update Uploads API constructor to use services.storage.
packages/mobile/src/services/sdk/audius-sdk.ts Update mobile SDK initialization to call createSdkWithServices().
packages/discovery-provider/plugins/pedalboard/apps/trending-challenge-rewards/src/sdk.ts Update plugin SDK initialization to call createSdkWithServices().
packages/discovery-provider/plugins/pedalboard/apps/relay/src/index.ts Update relay plugin SDK initialization to call createSdkWithServices().
packages/commands/src/utils.ts Update commands SDK initialization to call createSdkWithServices().
.changeset/real-rabbits-pretend.md Add major-version changeset describing the constructor behavior change and migration path.
Comments suppressed due to low confidence (1)

packages/sdk/src/sdk/createSdk.ts:39

  • This call to SdkConfigSchema.parse(config) relies on the union schema for validation, but the union members are non-strict() objects, so configs that include extra auth fields can pass validation via the wrong branch (e.g. bearerToken present but empty). To avoid accepting partially-specified write-auth configs, consider tightening SdkConfigSchema (e.g. strict/discriminated union) or re-validating based on the presence of bearerToken/apiSecret like the previous constructor did.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/sdk/src/sdk/createSdkWithServices.ts
Comment thread packages/sdk/src/sdk/types.ts
@github-actions
Copy link
Copy Markdown
Contributor

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-13906.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

@rickyrombo rickyrombo merged commit e0e1ecb into main Mar 12, 2026
14 checks passed
@rickyrombo rickyrombo deleted the mjp-sdk-create branch March 12, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants