Skip to content

Commit

Permalink
Rollout (#542)
Browse files Browse the repository at this point in the history
* chore: add rollout plugin and add simplified record helpers to common

* release
  • Loading branch information
dboskovic authored Jun 28, 2024
1 parent adca51c commit 0a4afa0
Show file tree
Hide file tree
Showing 10 changed files with 573 additions and 25 deletions.
6 changes: 6 additions & 0 deletions .changeset/lemon-trainers-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@flatfile/plugin-rollout': patch
'@flatfile/util-common': patch
---

Introduces Simplified record helpers for memory efficient processing of large datasets and launches a rollout plugin for helping with schema updating.
54 changes: 37 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions plugins/rollout/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!-- START_INFOCARD -->

# @flatfile/plugin-rollout
**Automatically rollout schema changes to already live workbooks.**


This plugin listens for new agent deployments and automatically applies schema changes to already live workbooks. The plugin will update the schema of the workbook to match the latest schema of the sheet and trigger a rerun of hooks on all records in all sheets.

**Events Handled:**
- `commit:created`
- `agent:updated`
- `agent:created`


<!-- END_INFOCARD -->


## Parameters

#### `namespace` - `string`

Optionally only apply this updater to workbooks in certain namespaces.

#### `dev` - `boolean`

Also run the updater in local dev mode whenever the agent reloads (this can be problematic if you have many spaces in your dev environment).


#### `updater` - `cb: (workbooks: Flatfile.Workbook[]) => Flatfile.Workbook[]`

A callback to use to update the workbooks you want to migrate. This callback should return the updated workbooks so that data hooks can be run.

## API Calls

- `GET /api/v1/spaces`
- `GET /api/v1/secrets`
- `GET /api/v1/spaces/:id`
- `GET /api/v1/workbooks`
- `POST /api/v1/jobs`

**install**
```bash
npm i @flatfile/plugin-rollout
```

**import**
```js
import { rollout } from "@flatfile/plugin-rollout";
```

**listener.js**
```js
listener.use(rollout({ updater: (workbooks) => {
// update workbooks here with new schema
}}));
```
50 changes: 50 additions & 0 deletions plugins/rollout/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "@flatfile/plugin-rollout",
"version": "1.0.0",
"url": "https://github.com/FlatFilers/flatfile-plugins/tree/main/plugins/rollout",
"description": "A plugin for automatically rolling out new changes to workbooks in flatfile.",
"registryMetadata": {
"category": "core"
},
"engines": {
"node": ">= 16"
},
"files": [
"dist/**"
],
"source": "src/index.ts",
"main": "dist/main.js",
"module": "dist/module.mjs",
"types": "dist/types.d.ts",
"scripts": {
"build": "parcel build",
"build:watch": "parcel watch",
"build:prod": "NODE_ENV=production parcel build",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
},
"keywords": [
"flatfile-plugins",
"category-core",
"featured"
],
"author": "David Boskovic",
"repository": {
"type": "git",
"url": "https://github.com/FlatFilers/flatfile-plugins.git",
"directory": "plugins/rollout"
},
"license": "ISC",
"dependencies": {
"@flatfile/util-common": "^1.3.2",
"async": "^3.2.5",
"modern-async": "^2.0.0"
},
"peerDependencies": {
"@flatfile/api": "^1.8.9",
"@flatfile/listener": "^1.0.1"
},
"devDependencies": {
"@flatfile/rollup-config": "0.1.1"
}
}
5 changes: 5 additions & 0 deletions plugins/rollout/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { buildConfig } from '@flatfile/rollup-config'

const config = buildConfig({})

export default config
Loading

0 comments on commit 0a4afa0

Please sign in to comment.