fix(deps): update dependency splitwise to v2 - #498
Open
renovate[bot] wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.0.0→2.0.0Release Notes
keriwarr/splitwise (splitwise)
v2.0.0Compare Source
Complete rewrite in TypeScript. v2 is not backwards-compatible with v1; see
the migration guide at the bottom of this entry.
Highlights
.d.tsdeclarations for everyexport.
fetch,crypto.subtle, andBlob/FormData. Dropsoauth,ramda,validate.js,es6-promisify,and
querystring.sw.expenses.list(),sw.groups.create(),sw.users.getCurrent()— replacing the flatsw.getExpenses()style.Authorization Code + PKCE flow for end-user delegation.
instanceofchecks for auth/validation/ratelimit/server/constraint failures.
responses);
delete()/restore()returnPromise<void>and rely on theabsence of an exception as the success signal.
onRequest/onResponse/onError).timeout/maxRetries/baseUrloverrides onevery method.
sw.expenses.list().sw.expenses.create({ receipt: blob }).sw.rawRequest()escape hatch for endpoints not yet covered by thetyped API.
appInfo.tsc— works in Node 18+, Bun, Deno,Cloudflare Workers, modern browsers.
Added
SplitwiseError(base),SplitwiseApiError,SplitwiseAuthenticationError(401),SplitwiseForbiddenError(403),SplitwiseNotFoundError(404),SplitwiseValidationError(400),SplitwiseRateLimitError(429, withretryAfter),SplitwiseServerError(5xx),SplitwiseConstraintError(200 withsuccess:false/ non-emptyerrors),SplitwiseConnectionError(network).sw.expenses.restore()andsw.groups.restore()(undelete endpoints,not present in v1).
sw.comments.{list,create,delete}resource (not present in v1).sw.expenses.create({ receipt: Blob })for multipart receipt upload.sw.rawRequest(method, path, options)escape hatch.sw.getAccessToken()method (replaces v1'ssw.getAccessToken()—same name, similar semantics, but now async and returns a string).
Splitwise.createAuthorizationUrl()andSplitwise.fromAuthorizationCode()for the Authorization Code + PKCEflow.
argument with
signal,timeout,maxRetries,baseUrl.hooks(request/response/error callbacks),appInfo(added to User-Agent header),fetch(injectable),logger/logLevel.NotificationTypeconstant +notificationTypeName()helper fordecoding the numeric
Notification.typefield.sw.expenses.list().SDK_VERSIONconstant exported from the package root.Changed (breaking)
Method names and namespacing
sw.test()sw.test()(now returns{clientId, token, requestUrl, params}— it's a whoami, not a boolean)sw.getCurrentUser()sw.users.getCurrent()sw.getUser({id})sw.users.get({id})sw.updateUser({id, ...})sw.users.update({id, ...})sw.getGroups()sw.groups.list()sw.getGroup({id})sw.groups.get({id})sw.createGroup(...)sw.groups.create(...)sw.deleteGroup({id})sw.groups.delete({id})(nowPromise<void>)sw.addUserToGroup(...)sw.groups.addUser(...)(returnsUser)sw.removeUserFromGroup(...)sw.groups.removeUser(...)(nowPromise<void>)sw.getExpenses(...)sw.expenses.list(...)(returnsPagedResult)sw.getExpense({id})sw.expenses.get({id})sw.createExpense(...)sw.expenses.create(...)sw.updateExpense({id, ...})sw.expenses.update({id, ...})sw.deleteExpense({id})sw.expenses.delete({id})(nowPromise<void>)sw.getFriends()sw.friends.list()sw.getFriend({id})sw.friends.get({id})sw.createFriend(...)sw.friends.create(...)(onlyuserEmailis required now)sw.createFriends(...)sw.friends.createMultiple(...)sw.deleteFriend({id})sw.friends.delete({id})(nowPromise<void>)sw.getCurrencies()sw.currencies.list()sw.getCategories()sw.categories.list()sw.parseSentence(...)sw.parseSentence(...)(returns typedParseSentenceResponseinstead ofunknown)sw.getNotifications(...)sw.notifications.list(...)sw.getMainData(...)sw.getMainData(...)(unchanged)sw.createDebt({from, to, ...})sw.expenses.createDebt({paidBy, owedBy, ...})(renamed args for clarity)Parameter and response shapes
snake_case directly; v2 converts at the HTTP boundary.
createDebtarguments renamed:from→paidBy,to→owedBy.Also,
amountacceptsstring | number(v1 docs showed numbers but typedstrings);
descriptionis now optional.ExpenseListParams.friendshipIdrenamed tofriendId. v1'sfriendship_idwas a bug — the actual API parameter isfriend_id, sofilter-by-friend has been silently broken since v1.
friends.createMultiplewire shape fixed. v1 sentfriends__N__email;the API expects
users__N__email, and the response is{users: [...]}(not
{friends: [...]}).friends.createresponse shape fixed. v1 expected{friends: [theNewFriend]}; the actual API returns{friend: ...}(singular).v1's
createFriendwas returningundefinedfor the new friend.update_expenseno longer acceptssplitEqually— the API rejects itwith HTTP 400.
Promise<void>instead ofPromise<{success: boolean}>. The Stripe-style convention: an exceptionis the failure signal, no exception means success.
addUserreturns the addedUserobject instead of{success}.Useful when adding by email — the API gives back the assigned user_id.
sw.test()returns{clientId, token, requestUrl, params}instead ofthe v1 raw response. The endpoint is closer to a whoami than a generic
health check.
0/1automatically in form bodies (v1required manual conversion).
Configuration
group_id,user_id,expense_id, orfriend_idto the constructor and have them appliedimplicitly. v2 requires explicit IDs on every method call. Passing any of
these to the constructor now throws
TypeErrorwith a migration hint.{debug, info, warn, error}object. v1'slogLevel: 'error' | 'info'becomes
'none' | 'error' | 'warn' | 'info' | 'debug'in v2.OAuthtoBearer(the modern OAuth2convention).
Retry-After, retries 429/5xx/connection failures by default. v1 had noretry.
Removed (breaking)
validate.jsruntime parameter validation. TypeScript typesenforce shape at compile time; runtime validation is the API's job.
creation_methodparameter restriction list. v2 accepts the fieldas an arbitrary string (verified to round-trip through the API).
oauth,ramda,validate.js,es6-promisify,querystring).Internal
tscbuilds (no bundler) intodist/cjs/anddist/esm/.scripts/generate-fixtures.tsrecordsreal API responses (with automatic PII scrubbing); 21 integration tests
replay them through the SDK.
Migration guide
Most upgrades are mechanical — search/replace the renamed methods and
update any constructor options.
For the Authorization Code + PKCE flow (new in v2):
Configuration
📅 Schedule: (in timezone Europe/Paris)
* 0-3 1 * *)🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.