airtable-db
v1.0.0
Published
The domain layer for Airtable
Downloads
7
Readme
airtable-db
The domain layer for Airtable
Usage
// src/domain.js
import { AirtableDomain } from '@lambdaschool/airtable-db';
import logger from './logger'
export default new AirtableDomain({ logging: (msg, context) => logger.debug(msg, context) });
// application-file.js
import domain from './domain'
function doAirtableStuff() {
const { projectManagerRoles, sections, students } = domain.repositories;
const [
studentRecords,
projectManagerRoleRecords,
sectionRecords,
] = await Promise.all([
students.selectColumns(['calculatedSprintPassRate', 'currentSection', 'originalSectionsPerCourse', 'sprintRetros']),
projectManagerRoles.selectColumns(['studentRecord', 'projectedGraduationSection']),
sections.selectColumns(['sectionSprint']),
]);
}
To dynamically select a repository, you can use domain.findRepository('students')
.
For a list of all functions, see the individual repositories. The BaseRepository has many generic functions which are present on all repositories. Additionally, a given repository might have targeted functions for special cases.
Development
npm i
npm test
Deployment
Because an npm package is generated by this project, the following versioning steps need to be followed to publish the package.
- Verify that all PRs have been merged into the
staging
branch. - Open up a PR to merge the
staging
branch into themaster
branch. Typically the PR is named after the version that will be published, for examplev2.1.0
. - After reviewing the changes that will be merged into master, determine the appropriate version change,
major
,minor
, orpatch
. - While on the
staging
branch locally, update theCHANGELOG.md
file with an entry for the new version you're about to publish. Commit your changes. - While still on the
staging
branch locally, version the project usingnpm version <semver>
where<semver>
ismajor
,minor
, orpatch
. For example:npm version patch
. git push
your local staging branch up to origin.- When the PR has been reviewed and merged into master, the package will be published by CI after the tests pass.