@flatfile/listener
Advanced tools
Comparing version 0.0.2 to 0.0.3
# @flatfile/listener | ||
## 0.0.3 | ||
### Patch Changes | ||
- c946831: Updates to use the dataUrl for getting records | ||
## 0.0.2 | ||
@@ -4,0 +10,0 @@ |
@@ -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; |
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
840772
9997
12
20
+ Added@flatfile/api@^0.0.16
+ Added@flatfile/api@0.0.16(transitive)
- Removedaxios@^1.2.1
- Removedasynckit@0.4.0(transitive)
- Removedaxios@1.7.7(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedfollow-redirects@1.15.9(transitive)
- Removedform-data@4.0.1(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedproxy-from-env@1.1.0(transitive)