Socket
Socket
Sign inDemoInstall

@flatfile/listener

Package Overview
Dependencies
Maintainers
25
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flatfile/listener - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

6

CHANGELOG.md
# @flatfile/listener
## 0.0.3
### Patch Changes
- c946831: Updates to use the dataUrl for getting records
## 0.0.2

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

3

dist/index.d.ts

@@ -6,2 +6,4 @@ import { DefaultApi, Event } from '@flatfile/api';

get api(): DefaultApi;
private _fetch?;
fetch(url: string): any;
}

@@ -28,2 +30,3 @@

readonly target: string;
readonly action: string;
readonly context: any;

@@ -30,0 +33,0 @@ readonly payload: any;

4

package.json
{
"name": "@flatfile/listener",
"version": "0.0.2",
"version": "0.0.3",
"description": "A PubSub Listener for configuring and using Flatfile",

@@ -31,6 +31,6 @@ "main": "dist/index.js",

"dependencies": {
"@flatfile/api": "^0.0.16",
"@flatfile/hooks": "1.2.3",
"@flatfile/orm": "0.1.0",
"@flatfile/schema": "0.2.13",
"axios": "^1.2.1",
"case-anything": "^2.1.10",

@@ -37,0 +37,0 @@ "date-fns": "^2.29.1",

@@ -26,2 +26,21 @@ import { Configuration, DefaultApi } from '@flatfile/api'

}
private _fetch?: any
fetch(url: string) {
if (this._fetch) {
return this._fetch
}
const headers = {
Authorization:
`Bearer ${process.env.FLATFILE_BEARER_TOKEN}` ?? `Bearer ...`,
}
const fetchUrl = FLATFILE_API_URL + '/' + url
return fetch(fetchUrl, {
headers,
})
.then((resp) => resp.json())
.then((resp) => resp.data)
}
}
import { AuthenticatedClient } from './authenticated.client'
import { Event, RecordsResponseData } from '@flatfile/api'
import { Event } from '@flatfile/api'
import fetch from 'node-fetch'
export class FlatfileEvent extends AuthenticatedClient {

@@ -23,2 +23,3 @@ /**

public readonly target: string
public readonly action: string
public readonly context: any

@@ -34,2 +35,3 @@ public readonly payload: any

this.target = src.target || ''
this.action = src.context.actionName || ''
}

@@ -44,13 +46,4 @@

get data(): Promise<any> {
const { sheetId, versionId } = this.context
if (sheetId && versionId) {
return this.api
.getRecords({
sheetId,
versionId,
includeCounts: false,
})
.then((res) => {
return res.data
})
if (this.src.dataUrl) {
return this.fetch(this.src.dataUrl)
} else {

@@ -57,0 +50,0 @@ return this.payload

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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