Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
NodeJS client for interacting with Grist.
The grist-api
package simplifies using the Grist
API in Javascript/TypeScript. There is also an analogous Python
package.
npm install grist-api
const {GristDocAPI} = require('grist-api');
// Put here the URL of your document.
const DOC_URL = "https://docs.getgrist.com/123456789abc/My-Document";
async function main() {
const api = new GristDocAPI(DOC_URL);
// Add some rows to a table
await api.addRecords('Food', [
{Name: 'eggs', AmountToBuy: 12},
{Name: 'beets', AmountToBuy: 1},
]);
// Fetch all rows.
const data = await api.fetchTable('Food');
console.log(data);
// Sync data by a key column.
await api.syncTable('Food', [{Name: 'eggs', AmountToBuy: 0}], ['Name']);
}
main();
To run this, first prepare a Grist doc to play with:
Food
with columns Name
and AmountToBuy
DOC_URL
in the code above to that of your document (the part after doc ID doesn't
matter).To use the API, you need to get your API key in Grist from Profile Settings. This API key may be
provided to GristDocAPI
in several ways, and is looked for in this order:
new GristDocAPI(DOC_URL, {apiKey: 'XXX'})
.GRIST_API_KEY=<key>
.~/.grist-api-key
file.Public documents may be accessed without an API key, or with an empty string for the API key (to stop searching the locations above).
Create an API instance. You may specify either a doc URL, or just the doc ID (the part
of the URL after "/doc/"). If you specify a URL, then options.server
is unneeded and ignored.
The options are:
apiKey
(string) The API key, available in Grist from Profile Settings. If omitted, will be taken from
GRIST_API_KEY
env var, or ~/.grist-api-key
file.server
(string) The server URL, i.e. the part of the document URL before "/doc/". Ignored if
you specify a full URL for the first argument.dryrun
(boolean) If set, will not make any changes to the doc. You may run with
DEBUG=grist-api
to see what calls it would make.chunkSize
(number, default: 500) Split large requests into smaller one, each limited to
chunkSize rows. If your requests are very large and hit size limits, try using a smaller value.Fetch all data in the table by the given name, returning a list of records with attributes corresponding to the columns in that table.
If filters is given, it should be an object mapping column names to array values, to fetch only
records that match. For example {Name: ['eggs']}
.
Adds new records to the given table. The data is a list of objects, with attributes corresponding to the columns in the table. Returns a list of added rowIds.
Deletes records from the given table. The data is a list of record IDs.
Update existing records in the given table. The data is a list of objects, with attributes corresponding to the columns in the table. Each object must contain the key "id" with the rowId of the row to update.
If records aren't all for the same set of columns, then a single-call update is impossible, so we'll make multiple calls.
Updates Grist table with new data, updating existing rows or adding new ones, matching rows on the given key columns. (This method does not remove rows from Grist.)
The records
parameter is a list of objects with column IDs as attributes.
The keyColIds
parameter lists primary-key columns, which must be present in the given records.
If options.filters
is given, it should be an object mapping colIds to arrays
of values. Only records matching these filters will be matched as candidates
for existing rows to update. New records whose columns don't match filters will
be ignored.
FAQs
NodeJS client for interacting with Grist
The npm package grist-api receives a total of 15 weekly downloads. As such, grist-api popularity was classified as not popular.
We found that grist-api 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.