Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
lightspeed-sdk
Advanced tools
Note: This is not a Lightspeed official package.
Use your favorite package manager to install any of the packages and save to your package.json:
npm install lightspeed-sdk
Import the Retail API and initialize it:
const { LightspeedRetailApi } = import 'lightspeed-sdk';
const retailApi= new LightspeedRetailApi({
clientId: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET',
refreshToken: 'REFRESH_TOKEN',
});
Import the Ecom API and initialize it:
const { LightspeedEcomApi } = import 'lightspeed-sdk';
const ecomApi = new LightspeedEcomApi({
apiKey: 'my_api_key',
apiSecret: 'my_api_key',
clusterId: 'US1',
});
Post customer information:
const customer = await retailApi.postCustomer(customer);
Update customer information:
const customer = await retailApi.putCustomer(customer, customerID);
Retrieve account information:
const account = await retailApi.getAccount();
Retrieve items by id:
const item = await retailApi.getItemById('accountNumber', 'id');
Retrieve all items:
const items = await retailApi.getItems('accountNumber');
for await (const item of items) {
console.log(item); // { itemID: 'X', ... }
}
or
const items = await retailApi.getItems('accountNumber').toArray();
console.log(items); // [{ itemID: 'X', ... }, {...}]
Pagination is handled by the SDK by returning a cursor when querying:
The object has an async iterable
so you can do a for await
loop to retrieve all the items,
or load all at the same time by doing .toArray()
on the object. Doing .toArray()
could lead to performance
issues if the collection is too big.
Retrieve account information:
const account = await ecomApi.getAccount();
Get orders:
const orders = await ecomApi.getOrders();
Pagination in the ecom api works similarly to the retail api with some minor differences
const orders = await ecomApi.getOrders();
console.log('Number of orders=', orders.getCount());
const iterator = orders.items();
const firstItem = await iterator.next().value;
This package supports Node v8 LTS and higher. It's highly recommended to use the latest LTS version of node, and the documentation is written using syntax and features from that version.
FAQs
Unofficial Lightspeed SDK for Node.js
The npm package lightspeed-sdk receives a total of 2 weekly downloads. As such, lightspeed-sdk popularity was classified as not popular.
We found that lightspeed-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.