Skip to content

Commit

Permalink
Merge pull request #330 from Airtable/v0.11.6
Browse files Browse the repository at this point in the history
v0.11.6
  • Loading branch information
FredZhao-at committed Nov 28, 2022
2 parents 560b466 + b468d8f commit 2d36eb6
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 20 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# v0.11.6
* Remove behavior of including `AIRTABLE_API_KEY` in airtable.browser.js via envify
* Add web worker compatibility

# v0.11.5
* Update select() and list() to support to use POST endpoint when GET url length would exceed Airtable's 16k character limit
* Update select() and list() to explicitly choose to use GET or POST endpoint via new 'method' arg
* Update select() and list() to explicitly choose to use GET or POST endpoint via new 'method' arg

# v0.11.4
* Add support for returnFieldsByFieldId param.

# v0.11.3
* Adds a UMD build to use for browser-targeted builds. This fixes an issue where other apps that
* Add a UMD build to use for browser-targeted builds. This fixes an issue where other apps that
use airtable.js as a dependency were bundling code that expects to run in a node environment when
building for a browser enviornment.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ There are three configurable options available:

* `apiKey` - your secret API token. Visit [/create/tokens](https://airtable.com/create/tokens) to create a personal access token. [OAuth access tokens](https://airtable.com/developers/web/guides/oauth-integrations) can also be used.
* `endpointUrl` - the API endpoint to hit. You might want to override
it if you are using an API proxy (e.g. runscope.net) to debug your API calls. (`AIRTABLE_ENDPOINT_URL`)
it if you are using an API proxy (e.g. runscope.net) to debug your API calls. (`AIRTABLE_ENDPOINT_URL`)
* `requestTimeout` - the timeout in milliseconds for requests. The default is 5 minutes (`300000`)

You can set the options globally via `Airtable.configure`:
Expand Down
14 changes: 8 additions & 6 deletions build/airtable.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=
"use strict";
// istanbul ignore file
var AbortController;
if (typeof window === 'undefined') {
var browserGlobal = typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : null; // self is the global in web workers
if (!browserGlobal) {
AbortController = require('abort-controller');
}
else if ('signal' in new Request('')) {
AbortController = window.AbortController;
AbortController = browserGlobal.AbortController;
}
else {
/* eslint-disable @typescript-eslint/no-var-requires */
Expand Down Expand Up @@ -326,7 +327,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
// istanbul ignore file
var node_fetch_1 = __importDefault(require("node-fetch"));
module.exports = typeof window === 'undefined' ? node_fetch_1.default : window.fetch.bind(window);
var browserGlobal = typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : null; // self is the global in web workers
module.exports = !browserGlobal ? node_fetch_1.default : browserGlobal.fetch.bind(browserGlobal);

},{"node-fetch":20}],8:[function(require,module,exports){
"use strict";
Expand Down Expand Up @@ -443,7 +445,7 @@ module.exports = objectToQueryParamString;

},{"lodash/isArray":79,"lodash/isNil":85,"lodash/keys":93}],12:[function(require,module,exports){
"use strict";
module.exports = "0.11.5";
module.exports = "0.11.6";

},{}],13:[function(require,module,exports){
"use strict";
Expand Down Expand Up @@ -3718,9 +3720,9 @@ var Airtable = /** @class */ (function () {
};
Airtable.default_config = function () {
return {
endpointUrl: undefined || 'https://api.airtable.com',
endpointUrl: "" || 'https://api.airtable.com',
apiVersion: '0.1.0',
apiKey: undefined,
apiKey: "",
noRetryIfRateLimited: false,
requestTimeout: 300 * 1000,
};
Expand Down
6 changes: 6 additions & 0 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ module.exports = function(grunt) {
transform: [
[
'envify',
// IMPORTANT: mask out environment variables that should never be shipped to the browser
{
_: 'purge',
AIRTABLE_ENDPOINT_URL: '',
AIRTABLE_API_KEY: '',
npm_package_version: pkg.version,
},
],
Expand All @@ -42,8 +45,11 @@ module.exports = function(grunt) {
transform: [
[
'envify',
// IMPORTANT: mask out environment variables that should never be shipped to the browser
{
_: 'purge',
AIRTABLE_ENDPOINT_URL: '',
AIRTABLE_API_KEY: '',
npm_package_version: pkg.version,
},
],
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "airtable",
"version": "0.11.5",
"version": "0.11.6",
"license": "MIT",
"homepage": "https://github.com/airtable/airtable.js",
"repository": "git://github.com/airtable/airtable.js.git",
Expand Down
6 changes: 4 additions & 2 deletions src/abort-controller.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// istanbul ignore file
let AbortController: new () => AbortController;
if (typeof window === 'undefined') {
const browserGlobal =
typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : null; // self is the global in web workers
if (!browserGlobal) {
AbortController = require('abort-controller');
} else if ('signal' in new Request('')) {
AbortController = window.AbortController;
AbortController = browserGlobal.AbortController;
} else {
/* eslint-disable @typescript-eslint/no-var-requires */
const polyfill = require('abortcontroller-polyfill/dist/cjs-ponyfill');
Expand Down
5 changes: 4 additions & 1 deletion src/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// istanbul ignore file
import nodeFetch from 'node-fetch';

export = typeof window === 'undefined' ? (nodeFetch as typeof fetch) : window.fetch.bind(window);
const browserGlobal =
typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : null; // self is the global in web workers

export = !browserGlobal ? (nodeFetch as typeof fetch) : browserGlobal.fetch.bind(browserGlobal);
14 changes: 8 additions & 6 deletions test/test_files/airtable.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=
"use strict";
// istanbul ignore file
var AbortController;
if (typeof window === 'undefined') {
var browserGlobal = typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : null; // self is the global in web workers
if (!browserGlobal) {
AbortController = require('abort-controller');
}
else if ('signal' in new Request('')) {
AbortController = window.AbortController;
AbortController = browserGlobal.AbortController;
}
else {
/* eslint-disable @typescript-eslint/no-var-requires */
Expand Down Expand Up @@ -326,7 +327,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
// istanbul ignore file
var node_fetch_1 = __importDefault(require("node-fetch"));
module.exports = typeof window === 'undefined' ? node_fetch_1.default : window.fetch.bind(window);
var browserGlobal = typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : null; // self is the global in web workers
module.exports = !browserGlobal ? node_fetch_1.default : browserGlobal.fetch.bind(browserGlobal);

},{"node-fetch":20}],8:[function(require,module,exports){
"use strict";
Expand Down Expand Up @@ -443,7 +445,7 @@ module.exports = objectToQueryParamString;

},{"lodash/isArray":79,"lodash/isNil":85,"lodash/keys":93}],12:[function(require,module,exports){
"use strict";
module.exports = "0.11.5";
module.exports = "0.11.6";

},{}],13:[function(require,module,exports){
"use strict";
Expand Down Expand Up @@ -3718,9 +3720,9 @@ var Airtable = /** @class */ (function () {
};
Airtable.default_config = function () {
return {
endpointUrl: undefined || 'https://api.airtable.com',
endpointUrl: "" || 'https://api.airtable.com',
apiVersion: '0.1.0',
apiKey: undefined,
apiKey: "",
noRetryIfRateLimited: false,
requestTimeout: 300 * 1000,
};
Expand Down

0 comments on commit 2d36eb6

Please sign in to comment.