Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
3ef32b2
feat(SD-960): rm outdated files and created new base Salable class
SasankAVST Oct 2, 2024
a9d4912
feat(SD-964): added licenses resources
SasankAVST Oct 3, 2024
1a614f0
feat(SD-964): updated licenses resource with all methods
SasankAVST Oct 7, 2024
e7f10ed
feat: product resource with its methods
joshokoro Oct 7, 2024
3628963
feat: plan resource with its methods
joshokoro Oct 7, 2024
e8073ea
chore: rm unused typing
SasankAVST Oct 8, 2024
28d5958
feat: subscriptions resource with its methods
joshokoro Oct 8, 2024
c0cc545
feat: pricing table resource with its method
joshokoro Oct 8, 2024
7858344
fix: rm comment
SasankAVST Oct 8, 2024
fe275a3
chore: added getUrl utility function
SasankAVST Oct 9, 2024
90dc8c0
chore: use baseUrl
SasankAVST Oct 9, 2024
cf59fe0
chore: correcct pricing table jsdoc
joshokoro Oct 9, 2024
b104e8a
fix: added fixed getUrl function
SasankAVST Oct 9, 2024
074cd99
chore: refactor getUrl function
SasankAVST Oct 9, 2024
229f2a1
Merge pull request #84 from Salable/feat/SD-964-licenses-resource
SasankAVST Oct 9, 2024
7d1a43c
Merge branch 'feat/SD-960-node-sdk-v4' of github.com:Salable/node-sdk…
joshokoro Oct 9, 2024
fb3dc21
chore: extracting query params and typeing of response of pricing tab…
joshokoro Oct 9, 2024
d6fcc70
Merge branch 'feat/SD-960-node-sdk-v4' of github.com:Salable/node-sdk…
joshokoro Oct 9, 2024
e3df226
chore: extracting query params and typeing of response of product me…
joshokoro Oct 10, 2024
6a96886
Merge branch 'feat/SD-960-node-sdk-v4' of github.com:Salable/node-sdk…
joshokoro Oct 11, 2024
7f9105b
chore: extracting query params and typing of response of pricing tabl…
joshokoro Oct 11, 2024
92fe019
Merge branch 'feat/SD-960-node-sdk-v4' of github.com:Salable/node-sdk…
joshokoro Oct 11, 2024
cf1bc99
chore: extracting query params and typing of response of subscription…
joshokoro Oct 11, 2024
56e001f
chore: add documentation reference to methods
joshokoro Oct 11, 2024
2479441
chore: add documentation reference to methods
joshokoro Oct 11, 2024
bf4f66c
chore: setup jest-extended + minor refactors
SasankAVST Oct 16, 2024
7f67e69
Merge pull request #92 from Salable/feat/SD-1066-subscriptions-resource
joshokoro Oct 17, 2024
6a5356a
Merge pull request #89 from Salable/feat/SD-1065-products-resource
joshokoro Oct 17, 2024
ca36b7a
Merge branch 'feat/resources-combine' of github.com:Salable/node-sdk …
joshokoro Oct 18, 2024
c8f4a6d
fix: request types clean up
orderandchaos-at-work Oct 20, 2024
f8db46d
Merge pull request #94 from Salable/fix/request-types-clean-up
orderandchaos-at-work Oct 21, 2024
285ad64
fix: types for product, plan, subscriptions, and pricing tables
joshokoro Oct 21, 2024
f4195fd
Merge remote-tracking branch 'origin' into feat/SD-1076-licenses-tests
SasankAVST Oct 21, 2024
8045ff3
fix: merge conflict
SasankAVST Oct 21, 2024
42b680b
chore: resolve merge conflict
SasankAVST Oct 21, 2024
05f6554
chore(SD-1076): added unit tests for licenses v2
SasankAVST Oct 21, 2024
a50544d
fix: issues with jest-extended + typos
orderandchaos-at-work Oct 21, 2024
82a60e4
fix: type issues
orderandchaos-at-work Oct 21, 2024
c840f5f
feat: added unit tests for licenses v2 + minor changes
SasankAVST Oct 22, 2024
b3d8c82
Merge branch 'feat/SD-960-node-sdk-v4' of github.com:Salable/node-sdk…
joshokoro Oct 22, 2024
5a460d6
fix: added createMany method + create individual unit tests for searc…
SasankAVST Oct 23, 2024
542341c
test: test suite for pricing table resource
joshokoro Oct 23, 2024
3c10acd
fix: license resource import
joshokoro Oct 23, 2024
9afc479
fix: update init request test
SasankAVST Oct 24, 2024
150ea24
fix: added types to test schemas
SasankAVST Oct 24, 2024
5bdf2af
test: product resource and methods test cases and suites
joshokoro Oct 24, 2024
16cd8d4
Merge pull request #95 from Salable/feat/SD-1076-license-v2-tests
SasankAVST Oct 24, 2024
f8c42e9
test: plan resource and methods test cases and suites
joshokoro Oct 25, 2024
8761dcc
Merge branch 'feat/SD-960-node-sdk-v4' of github.com:Salable/node-sdk…
joshokoro Oct 25, 2024
7b0009e
Merge pull request #96 from Salable/test/product-and-plan-resource
joshokoro Oct 25, 2024
0408b4e
feat(SD1103): added tests for subscription resource
SasankAVST Oct 29, 2024
1702d25
Merge branch 'feat/SD-960-node-sdk-v4' into feat/SD-1103-subscription…
SasankAVST Oct 29, 2024
29e8022
Merge pull request #97 from Salable/feat/SD-1103-subscription-v2-tests
orderandchaos-at-work Oct 29, 2024
f16a369
fix: add inits
orderandchaos-at-work Oct 29, 2024
5c8c191
fix: use new Salable in tests
orderandchaos-at-work Oct 29, 2024
4ff770a
chore: install dependencies for unit tests
SasankAVST Oct 30, 2024
d0c0be5
fix: moved prisma to dev dependencies
SasankAVST Oct 30, 2024
c096bf6
Merge pull request #98 from Salable/feat/install-dependencies
SasankAVST Oct 30, 2024
2a05682
feat: setup stripe test data function + set up prisma
SasankAVST Nov 6, 2024
843e66b
build: testing bitbucket repo clone
joshokoro Nov 6, 2024
ec6a3e7
Merge pull request #100 from Salable/feat/create-stripe-test-data
SasankAVST Nov 6, 2024
864f377
feat: added create-test-data function
SasankAVST Nov 11, 2024
648f6ca
fix: moved Stripe setup function to jest globalSetup
SasankAVST Nov 12, 2024
e6104cf
feat: moved stripe and test data to global object + minor changes
SasankAVST Nov 13, 2024
57c5c35
Merge pull request #101 from Salable/feat/create-test-data
SasankAVST Nov 13, 2024
1851fe1
feat: updated licenses resource with test data
SasankAVST Nov 16, 2024
c656bb0
chore: rm status from errors + add 404 error handling
SasankAVST Nov 18, 2024
79864e1
fix: schema update + updated license schema
SasankAVST Nov 18, 2024
744d735
Merge pull request #104 from Salable/feat/licenses-test-data
SasankAVST Nov 18, 2024
b7efd91
feat: added test data for subscriptions resource
SasankAVST Nov 19, 2024
748cf30
feat: added usage resource and tests
SasankAVST Nov 26, 2024
907bd85
Merge pull request #107 from Salable/feat/usage-resource
SasankAVST Nov 26, 2024
1ea7e61
fix: renamed reactiveSubscription to reactivateSubscription
SasankAVST Nov 28, 2024
8ebb0c8
Merge pull request #108 from Salable/fix/subscriptions-typo
SasankAVST Nov 28, 2024
b7e2573
feat: setup stripe test data function + set up prisma
SasankAVST Nov 6, 2024
de721b1
feat: added create-test-data function
SasankAVST Nov 11, 2024
9d1fb67
fix: moved Stripe setup function to jest globalSetup
SasankAVST Nov 12, 2024
f40c14a
ci: workflow for testing package
joshokoro Nov 12, 2024
5f55297
feat: moved stripe and test data to global object + minor changes
SasankAVST Nov 13, 2024
63eb9a0
feat: updated licenses resource with test data
SasankAVST Nov 16, 2024
574a7a4
chore: rm status from errors + add 404 error handling
SasankAVST Nov 18, 2024
5b622dd
fix: schema update + updated license schema
SasankAVST Nov 18, 2024
4f1985f
feat: added test data for subscriptions resource
SasankAVST Nov 19, 2024
3043a22
test: fix test fail for plan, pricing table, and products resource
joshokoro Nov 19, 2024
20de575
test: fix failing test for licenses, subscriptions, pricing table, an…
joshokoro Nov 19, 2024
c3251cc
ci: bump node version for ci
joshokoro Nov 20, 2024
7e09048
ci: resolve jest not found
joshokoro Nov 20, 2024
65c61cc
ci: provide missing aws 3rd party region
joshokoro Nov 21, 2024
c7d6d92
ci: fix missing global test uuids
joshokoro Nov 22, 2024
e884695
test: fix for missing stripe uuids
joshokoro Nov 25, 2024
dc86d12
test: increase timeout for test
joshokoro Nov 26, 2024
e20cc9e
feat: added usage resource and tests
SasankAVST Nov 26, 2024
8559dbe
test: fix for subscription resources test fail
joshokoro Nov 27, 2024
ea05e65
test: downgrade stripe sdk version
joshokoro Nov 27, 2024
f3c4fa8
test: fix for subscription resources test fail
joshokoro Nov 27, 2024
1f36a5b
ci: fix for husky deprecation
joshokoro Nov 27, 2024
e414f5d
ci: checkout repo in full
joshokoro Dec 2, 2024
d2d6847
feat: added create-test-data function
SasankAVST Nov 11, 2024
899393d
feat: updated licenses resource with test data
SasankAVST Nov 16, 2024
aa85df0
feat: added test data for subscriptions resource
SasankAVST Nov 19, 2024
7370153
feat: added usage resource and tests
SasankAVST Nov 26, 2024
37af2be
fix: renamed reactiveSubscription to reactivateSubscription
SasankAVST Nov 28, 2024
7663ea9
feat: setup stripe test data function + set up prisma
SasankAVST Nov 6, 2024
6fba03c
Merge branch 'feat/SD-960-node-sdk-v4' of github.com:Salable/node-sdk…
joshokoro Dec 2, 2024
7f359e4
ci: remove coverage test
joshokoro Dec 2, 2024
0dfda45
feat: updated licenses documentation
SasankAVST Dec 2, 2024
f1b10e4
fix: use underscores in code examples
SasankAVST Dec 2, 2024
85ad345
Merge pull request #103 from Salable/test/ci-cd
joshokoro Dec 3, 2024
61c4fa1
docs: add documentation for product resources v4
joshokoro Dec 3, 2024
27efedd
feat: updated plans docs + minor changes to licenses resource
SasankAVST Dec 3, 2024
9feb6e5
feat: updated pricing table resource docs
SasankAVST Dec 3, 2024
b264759
Merge pull request #112 from Salable/feat/pricing-tables-docs
SasankAVST Dec 3, 2024
ed827fd
docs: add documentation for subscriptions resources v4
joshokoro Dec 4, 2024
1e8e317
docs: add documentation for usage resources v4
joshokoro Dec 4, 2024
705bd0e
Merge pull request #111 from Salable/feat/plans-docs
SasankAVST Dec 4, 2024
f9a8c63
feat(SD-1201): updated changelog with v4 changes
SasankAVST Dec 5, 2024
b2356a5
docs: update to subscription resource options
joshokoro Dec 5, 2024
3802ee7
docs: change subscription uuid to in example to test uuid
joshokoro Dec 5, 2024
fd4b481
fix: moved RBAC section of changelog to end
SasankAVST Dec 5, 2024
ff5a283
docs: change product uuid to in example to test uuid and adding requi…
joshokoro Dec 5, 2024
4cbfe88
docs: change usage uuid to in example to test uuid
joshokoro Dec 5, 2024
8915278
Merge pull request #114 from Salable/feat/subscription-resources-v4-docs
joshokoro Dec 5, 2024
ff655b7
Merge pull request #113 from Salable/feat/usage-resources-v4-docs
joshokoro Dec 5, 2024
6775654
Merge pull request #110 from Salable/feat/product-resources-v4-docs
joshokoro Dec 5, 2024
ea12d7d
Merge pull request #115 from Salable/feat/changelog-update-v4
SasankAVST Dec 5, 2024
88e5a76
fix: added missing filter params to get-all-licenses method
SasankAVST Dec 6, 2024
b6ea7c2
Merge pull request #116 from Salable/fix/missing-license-filter-params
SasankAVST Dec 6, 2024
f5c36d4
chore: update packages and audit fix
joshokoro Dec 9, 2024
c9008e2
fix: added missing option parameters
SasankAVST Dec 9, 2024
c516264
Merge pull request #118 from Salable/fix/missing-option-params
SasankAVST Dec 9, 2024
0594013
chore: adding rollup linux as optional dependencies
joshokoro Dec 10, 2024
547040e
chore: installing rollup linux as optional dependencies
joshokoro Dec 10, 2024
dfbe899
Merge pull request #117 from Salable/chore/SD-1078-update-packages
joshokoro Dec 10, 2024
24d3f2f
docs: adding correct documentation url
joshokoro Dec 10, 2024
f6faf10
docs: update readme
joshokoro Dec 10, 2024
b8bae71
Merge branch 'feat/SD-960-node-sdk-v4' of github.com:Salable/node-sdk…
joshokoro Dec 11, 2024
2652a50
Merge pull request #109 from Salable/feat/v4-docs
joshokoro Dec 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

91 changes: 0 additions & 91 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x.x
node-version: 18.x.x

- name: Install dependencies
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x.x
node-version: 18.x.x

- name: Install dependencies
run: npm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x.x
node-version: 18.x.x

- name: Install dependencies
run: npm ci
Expand Down
85 changes: 58 additions & 27 deletions .github/workflows/jest-tests.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,73 @@
name: Jest tests
name: Clone Bitbucket Repo and test

on:
push:
branches: ["main"]
branches: ["main", "feat/SD-960-node-sdk-v4"]
pull_request:
types: [opened, synchronize]

jobs:
tests:
name: Run Jest tests
timeout-minutes: 15
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ubuntu-latest
env:
REGION: ${{ vars.REGION }}
ENVIRONMENT: ${{ vars.ENVIRONMENT }}
AWS_THIRD_PARTY_API_REGION: ${{ vars.AWS_THIRD_PARTY_API_REGION }}
ACCOUNT: ${{ secrets.ACCOUNT }}
SEED_API_KEY: ${{ secrets.SEED_API_KEY }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }}
SEGMENT_SOURCE_ID: ${{ secrets.SEGMENT_SOURCE_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SALABLE_STRIPE_SECRET_KEY: ${{ secrets.SALABLE_STRIPE_SECRET_KEY }}
SALABLE_STRIPE_TEST_SECRET_KEY: ${{ secrets.SALABLE_STRIPE_TEST_SECRET_KEY }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
LAUNCHDARKLY_KEY: ${{ secrets.LAUNCHDARKLY_KEY }}
KMS_ENCRYPTION_KEY_ARN: ${{ secrets.KMS_ENCRYPTION_KEY_ARN }}
SALABLE_BASE_URL: ${{ secrets.SALABLE_BASE_TEST_URL }}
SALABLE_TEST_API_KEY: ${{ secrets.SALABLE_TEST_API_KEY }}
STRIPE_ACCOUNT_ID: ${{ secrets.STRIPE_ACCOUNT_ID }}
STRIPE_KEY: ${{ secrets.STRIPE_KEY }}

steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout this repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history to avoid shallow clone issues

- name: Set up SSH agent
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.BITBUCKET_SSH_KEY }}

- name: Add Bitbucket to known_hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts

- name: Clone Bitbucket repository
run: |
git clone ${{ vars.SALABLE_API_REPO_URL }}
if [ ! -d "salable-api" ]; then
echo "Error: Directory 'salable-api' does not exist."
exit 1
fi

- name: Build and deploy

- name: Fetch main branch
run: git fetch --no-tags --depth=1000 origin main
run: |
cd salable-api
npm ci
npx prisma generate
npx prisma db push --force-reset
npx sst build --stage node-sdk --region ${{ vars.REGION }}
npx sst deploy --stage node-sdk --region ${{ vars.REGION }}

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x.x
- name: Install dependencies
run: npm ci

- name: Install dependencies
run: npm install

- name: Jest Tests Overall
run: npm run test

- name: Jest Tests Code Coverage (branch)
run: npm run test:coverage

- name: Jest Tests Code Coverage (global)
run: npm run test:globalCoverage
- name: Jest Tests Overall
run: npm run test
5 changes: 1 addition & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ""
npx --no -- commitlint --edit ""
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run pre-commit
npm test
3 changes: 0 additions & 3 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run test:coverage
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
prisma

test-utils
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"singleQuote": true,
"semi": true,
"arrowParens": "always",
"printWidth": 100,
"printWidth": 300,
"bracketSpacing": true,
"tabWidth": 2
}
28 changes: 10 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,48 @@
## [3.4.1](https://github.com/Salable/node-sdk/compare/v3.4.0...v3.4.1) (2024-10-10)


### Bug Fixes

* deprecate rbac ([b75d464](https://github.com/Salable/node-sdk/commit/b75d464d1d01a9d801f097920bdf89758aadaecd))
- deprecate rbac ([b75d464](https://github.com/Salable/node-sdk/commit/b75d464d1d01a9d801f097920bdf89758aadaecd))

# [3.4.0](https://github.com/Salable/node-sdk/compare/v3.3.0...v3.4.0) (2024-07-12)


### Features

* **SD-168:** added verify-signature method ([c8b4a42](https://github.com/Salable/node-sdk/commit/c8b4a42a83fa72e6884adcfac96cefbddaf0dc20))
- **SD-168:** added verify-signature method ([c8b4a42](https://github.com/Salable/node-sdk/commit/c8b4a42a83fa72e6884adcfac96cefbddaf0dc20))

# [3.3.0](https://github.com/Salable/node-sdk/compare/v3.2.1...v3.3.0) (2024-02-01)


### Bug Fixes

* fixed licenses cancelMany method ([3cf5fe7](https://github.com/Salable/node-sdk/commit/3cf5fe7c052befd466f94c034214d4dec5043700))

- fixed licenses cancelMany method ([3cf5fe7](https://github.com/Salable/node-sdk/commit/3cf5fe7c052befd466f94c034214d4dec5043700))

### Features

* currency and quantity parameters added checkout link and pricing table methods ([f822750](https://github.com/Salable/node-sdk/commit/f82275015c83fac69df2b0ab7b6b681821334c24))
- currency and quantity parameters added checkout link and pricing table methods ([f822750](https://github.com/Salable/node-sdk/commit/f82275015c83fac69df2b0ab7b6b681821334c24))

## [3.2.1](https://github.com/Salable/node-sdk/compare/v3.2.0...v3.2.1) (2023-12-05)


### Bug Fixes

* added isTest to the response types ([46ba143](https://github.com/Salable/node-sdk/commit/46ba14365b7393b43a4d0417ecf6785d60633bc6))
- added isTest to the response types ([46ba143](https://github.com/Salable/node-sdk/commit/46ba14365b7393b43a4d0417ecf6785d60633bc6))

# [3.2.0](https://github.com/Salable/node-sdk/compare/v3.1.0...v3.2.0) (2023-11-27)


### Features

* added grace as an optional parameter to license check ([39105e8](https://github.com/Salable/node-sdk/commit/39105e806c7dfc4ddbafc0e825e19a8628532457))
- added grace as an optional parameter to license check ([39105e8](https://github.com/Salable/node-sdk/commit/39105e806c7dfc4ddbafc0e825e19a8628532457))

# [3.1.0](https://github.com/Salable/node-sdk/compare/v3.0.1...v3.1.0) (2023-11-24)


### Bug Fixes

* updated getByGranteeId response type comment ([143a3a8](https://github.com/Salable/node-sdk/commit/143a3a883339aa8992cfecb74ba807c6e16e3705))

- updated getByGranteeId response type comment ([143a3a8](https://github.com/Salable/node-sdk/commit/143a3a883339aa8992cfecb74ba807c6e16e3705))

### Features

* create licenses updated to be able to create many licenses ([d0b7f43](https://github.com/Salable/node-sdk/commit/d0b7f4382e38fd7d774bf5eef7e4ac25f80a3978))
* create licenses updated to be able to create many licenses ([9b43b3a](https://github.com/Salable/node-sdk/commit/9b43b3a69be7d9e529766e0e465647dce93dcf7a))
* licenses endpoints up to date ([e0972da](https://github.com/Salable/node-sdk/commit/e0972dacceea6d9723b2969ba5d9e5948bcea133))
- create licenses updated to be able to create many licenses ([d0b7f43](https://github.com/Salable/node-sdk/commit/d0b7f4382e38fd7d774bf5eef7e4ac25f80a3978))
- create licenses updated to be able to create many licenses ([9b43b3a](https://github.com/Salable/node-sdk/commit/9b43b3a69be7d9e529766e0e465647dce93dcf7a))
- licenses endpoints up to date ([e0972da](https://github.com/Salable/node-sdk/commit/e0972dacceea6d9723b2969ba5d9e5948bcea133))

## [3.0.1](https://github.com/Salable/node-sdk/compare/v3.0.0...v3.0.1) (2023-11-24)

Expand Down
43 changes: 39 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Salable SDK for JavaScript
# Salable SDK for JavaScript

The Salable SDK enables you to easily interact with the Salable ecosystem, accessing the Salable API, and other toolkit methods.

Expand All @@ -9,12 +9,47 @@ Let’s walk through setting up a project that uses the Salable API Class from t
1. Create a new Node.js project.
2. Inside of the project, run: `npm install @salable/node-sdk`. Adding packages results in update in lock file, [yarn.lock](https://yarnpkg.com/getting-started/qa/#should-lockfiles-be-committed-to-the-repository) or [package-lock.json](https://docs.npmjs.com/configuring-npm/package-lock-json). You **should** commit your lock file along with your code to avoid potential breaking changes.

3. Create a new file called index.js, Instantiate a Salable Class and send a request.
## v4.0.0 Update

The SDK now supports Salable API version selection and developers can choose which version of the Salable API they want to interact with via the SDK
As such, the Salable API version is now a required argument when instantiating the SDK

```typescript
import { Salable } from '@salable/node-sdk';

const salable = new Salable('{{API_KEY}}');
const salable = new Salable('your_api_key', 'v2');
```
> **_NOTE:_** Support for `v1` of the Salable API has been deprecated, `v2` is currently the only supported version

### General Changes

const check = await salable.licenses.check('{{PRODUCT_UUID}}', ['userId_1']);
#### Salable API versioning and Types
- Types and method documentation are dynamic and automatically adjust to the version selected

```typescript
import { Salable } from '@salable/node-sdk';

const salableV1 = new Salable('your_api_key', 'v1'); // NOTE: 'v1' is not supported and used for example purposes
const salableV2 = new Salable('your_api_key', 'v2');

// The "licenses.getUsage" method is supported in this version and will work
await salableV1.licenses.getUsage():

// This will error as "licenses.getUsage" has been deprecated in 'v2'
await salableV2.licenses.getUsage(): // Will error with: "Property 'getUsage' does not exist ..."
```
#### Pagination
- All methods are now scope authorized and your API Key must contain the appropriate scopes to user certain methods
- `getAll` endpoints are now paginated and offer cursor based pagination

```typescript
{
first: "item-id-1",
last: "item-id-3",
data: [
{id: "item-id-1"},
{id: "item-id-2"},
{id: "item-id-3"}
]
}
```
Loading
Loading