@bothrs/util
Advanced tools
Comparing version 1.14.0 to 1.15.0
@@ -17,3 +17,3 @@ import { | ||
log: process.env.AIRTABLE_LOG ? console.log : undefined, | ||
app: process.env.AIRTABLE_APP, | ||
app: process.env.AIRTABLE_APP || 'http://localhost:20011/', | ||
key: process.env.AIRTABLE_API_KEY, | ||
@@ -20,0 +20,0 @@ } |
@@ -6,4 +6,4 @@ import { serialize } from './url' | ||
export function app(app?: string) { | ||
return 'https://api.airtable.com/v0/' + app + '/' | ||
export function app(app: string) { | ||
return app.includes('/') ? app : 'https://api.airtable.com/v0/' + app + '/' | ||
} | ||
@@ -34,3 +34,3 @@ | ||
if (body.error) { | ||
throw new Error(body.error) | ||
throw new Error(body.error.message) | ||
} | ||
@@ -50,3 +50,3 @@ return unpack(body) | ||
if (body.error) { | ||
throw new Error(body.error) | ||
throw new Error(body.error.message) | ||
} | ||
@@ -75,3 +75,6 @@ return unpack(body) | ||
}).then(r => r.json()) | ||
const { records } = body | ||
const { error, records } = body | ||
if (error) { | ||
throw new Error(error.message) | ||
} | ||
if (records) { | ||
@@ -94,3 +97,6 @@ return records.map(unpack) | ||
}).then(r => r.json()) | ||
const { offset, records } = body | ||
const { error, offset, records } = body | ||
if (error) { | ||
throw new Error(error.message) | ||
} | ||
if (offset) { | ||
@@ -124,3 +130,3 @@ return selectAll( | ||
if (body.error) { | ||
throw new Error(body.error) | ||
throw new Error(body.error.message) | ||
} | ||
@@ -141,3 +147,3 @@ return unpack(body) | ||
if (body.error) { | ||
throw new Error(body.error) | ||
throw new Error(body.error.message) | ||
} | ||
@@ -184,3 +190,3 @@ return unpack(body) | ||
export interface Environment { | ||
app?: string | ||
app: string | ||
key?: string | ||
@@ -187,0 +193,0 @@ log?: Function |
{ | ||
"name": "@bothrs/util", | ||
"version": "1.14.0", | ||
"version": "1.15.0", | ||
"description": "Common helper functions", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
63082
65
2232