Load record from API
import { Corva } from '@corva/node-sdk';
export const handler = new Corva().stream(async (event, context) => {
const entry = context.api.provider('some-provider').dataset('some-collection').entry('some-id');
context.logger.info(entry.instance); // undefined
await entry.get();
context.logger.info(entry.instance); // JSON
});
Remove current record
import { Corva } from '@corva/node-sdk';
export const handler = new Corva().stream(async (event, context) => {
const entry = await context.api.provider('some-provider').dataset('some-collection').findOne({});
context.logger.info(entry.instance); // JSON
await entry.remove();
context.logger.info(entry.instance); // JSON, still there
await entry.update({ any: 'data' }); // will throw an error
});
Fully replace current record
Update current record
import { Corva } from '@corva/node-sdk';
export const handler = new Corva().stream(async (event, context) => {
const entry = await context.api.provider('some-provider').dataset('some-collection').findOne({});
context.logger.info(entry.instance); // JSON
await entry.update({ some: 'data' });
context.logger.info(entry.instance); // JSON, { data: { some: 'data' } }
});
Optional
schemaVersion: number
Dataset record's data