Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@flatfile/plugin-record-hook

Package Overview
Dependencies
Maintainers
26
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flatfile/plugin-record-hook - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

6

CHANGELOG.md
# @flatfile/plugin-record-hook
## 0.1.5
### Patch Changes
- c2310c0: Add event to RecordHook Handler
## 0.1.4

@@ -4,0 +10,0 @@

2

dist/index.d.ts
import { FlatfileEvent, FlatfileListener } from '@flatfile/listener';
import { FlatfileRecord } from '@flatfile/hooks';
declare const RecordHook: (event: FlatfileEvent, handler: (record: FlatfileRecord) => any | Promise<any>) => Promise<((record: FlatfileRecord) => any | Promise<any>) | undefined>;
declare const RecordHook: (event: FlatfileEvent, handler: (record: FlatfileRecord, event: FlatfileEvent) => any | Promise<any>) => Promise<((record: FlatfileRecord, event: FlatfileEvent) => any | Promise<any>) | undefined>;

@@ -6,0 +6,0 @@ declare const recordHook: (sheetSlug: string, callback: (record: FlatfileRecord) => {}) => (client: FlatfileListener) => void;

@@ -122,3 +122,3 @@ "use strict";

for (const x of batch.records) {
await handler(x);
await handler(x, event);
}

@@ -125,0 +125,0 @@ const recordsUpdates = new RecordTranslater(

{
"name": "@flatfile/plugin-record-hook",
"version": "0.1.4",
"version": "0.1.5",
"description": "A plugin for writing custom record-level hooks in Flatfile.",

@@ -5,0 +5,0 @@ "registryMetadata": {

import { FlatfileEvent } from '@flatfile/listener'
import { FlatfileRecord, FlatfileRecords } from '@flatfile/hooks'
import { RecordWithLinks, Record_, RecordsWithLinks, Records } from '@flatfile/api/api'
import { Record_, Records } from '@flatfile/api/api'
import { RecordTranslater } from './record.translater'

@@ -9,7 +9,7 @@ import api from '@flatfile/api'

event: FlatfileEvent,
handler: (record: FlatfileRecord) => any | Promise<any>
handler: (record: FlatfileRecord, event: FlatfileEvent) => any | Promise<any>
) => {
const { sheetId } = event.context
try {
const records = await event.cache.init<RecordsWithLinks>(
const records = await event.cache.init<Records>(
'records',

@@ -24,3 +24,3 @@ async () => (await event.data).records

for (const x of batch.records) {
await handler(x)
await handler(x, event)
}

@@ -36,3 +36,3 @@

event.afterAll(async () => {
const records = event.cache.get<RecordsWithLinks>('records')
const records = event.cache.get<Records>('records')
try {

@@ -52,3 +52,3 @@ return await api.records.update(sheetId, records)

const prepareXRecords = async (records: any): Promise<FlatfileRecords<any>> => {
const clearedMessages: RecordWithLinks[] = records.map(
const clearedMessages: Record_[] = records.map(
(record: { values: { [x: string]: { messages: never[] } } }) => {

@@ -62,4 +62,4 @@ // clear existing cell validation messages

)
const fromX = new RecordTranslater<RecordWithLinks>(clearedMessages)
const fromX = new RecordTranslater<Record_>(clearedMessages)
return fromX.toFlatFileRecords()
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc