Registry / database / sql-data-api

sql-data-api

JSON →
library0.3.14jsnpmunverified

Javascript client for Worksheet Systems SQL Data API, version 0.3.14. Enables querying and saving data to SQL databases via REST API with authentication support (user/password or access token). Supports table queries with filtering, sorting, pagination, joins, and aggregation; also provides insert/update/delete operations. Includes TypeScript definitions. Release cadence is irregular; appears active.

npm install sql-data-api
INSTALL
IMPORT
SIG · SQL-DATA-API
S
sql-data-api
databasejavascriptv0.3.14
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sqlDataApi
import { sqlDataApi } from 'sql-data-api'
const sqlDataApi = require('sql-data-api')
ESM only; named export, not default.
setBaseUrl
import { setBaseUrl } from 'sql-data-api'
import setBaseUrl from 'sql-data-api'
Named export, not default.
authenticate
import { authenticate } from 'sql-data-api'
import authenticate from 'sql-data-api'
Named export, not default. Returns a promise.
setUserAccessToken
import { setUserAccessToken } from 'sql-data-api'
import setUserAccessToken from 'sql-data-api'
Named export, not default. Use token from app.worksheet.systems.

Sets base URL and access token, then queries first 10 active users from the 'Users' table.

import { setBaseUrl, setUserAccessToken, sqlDataApi } from 'sql-data-api'; setBaseUrl('https://api.worksheet.systems'); const token = process.env.ACCESS_TOKEN ?? ''; setUserAccessToken(token); async function getUsers() { const data = await sqlDataApi('myConnection') .query('Users', 'Id, Name, Email', { filter: "Status = 'active'", top: 10 }); console.log(data); } getUsers();
Debug
Known issues
gotchasetBaseUrl() must be called before any query or save operation.
fix
Call setBaseUrl() at app initialization.
affects: >=0.1.0
gotchaAccess token must be set via setUserAccessToken() before authentication; password authentication is less secure.
fix
Use setUserAccessToken with a token generated from Worksheet Systems account settings.
affects: >=0.1.0
breakingIn version 0.2.x, the query() method signature changed: second parameter is now fieldsOrQuery (string or SqlReadQueryInfo) instead of just string.
fix
Update query calls to use new signature if they passed an object as second argument.
affects: >=0.2.0
deprecatedThe authenticate() function is deprecated; use setUserAccessToken() instead.
fix
Replace authenticate(username, password) with setUserAccessToken(token).
affects: >=0.3.0
Errors
Common errors & fixes
TypeError: sqlDataApi is not a function
Importing as default instead of named import.
fix
Use: import { sqlDataApi } from 'sql-data-api'
Error: Base URL not set
setBaseUrl() was not called before operations.
fix
Call setBaseUrl('https://api.worksheet.systems') at the top of your script.
Error: 'connectionName' not found
The connection name passed to sqlDataApi() does not exist.
fix
Verify the connection name is correct and exists in your Worksheet Systems account.
Upgrade
Version history
0.3.14latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
Meta
1
OpenAI (training)
1
Resources
sql-data-api — npm install sql-data-api · libregistry