gas-client
Advanced tools
Comparing version 0.1.0 to 0.2.1
@@ -69,3 +69,3 @@ "use strict"; | ||
} catch (err) { | ||
if (err.toString() === 'ReferenceError: google is not defined' && process && process.env && process.env.NODE_ENV === 'development') { | ||
if (typeof google === 'undefined') { | ||
// we'll store and access the resolve/reject functions here by id | ||
@@ -92,2 +92,3 @@ window.gasStore = {}; // set up the message 'receive' handler | ||
if (status === 'ERROR') { | ||
// TODO: return here so resolve doesn't get called on error | ||
reject(response); | ||
@@ -94,0 +95,0 @@ } |
{ | ||
"name": "gas-client", | ||
"version": "0.1.0", | ||
"version": "0.2.1", | ||
"description": "A client-side utility class that can call server-side Google Apps Script functions", | ||
@@ -15,2 +15,5 @@ "main": "build/index.js", | ||
"prepack": "yarn build", | ||
"test": "jest --coverage", | ||
"test:watch": "jest --coverage --watch", | ||
"prebuild": "rm -rf build", | ||
"build": "babel src/index.js -d build" | ||
@@ -33,2 +36,3 @@ }, | ||
"@babel/preset-env": "^7.10.4", | ||
"@types/jest": "^26.0.15", | ||
"babel-eslint": "^10.1.0", | ||
@@ -40,3 +44,5 @@ "eslint": "^7.5.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"eslint-plugin-jest": "^24.1.3", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.0.5" | ||
@@ -43,0 +49,0 @@ }, |
@@ -105,19 +105,6 @@ # gas-client | ||
Development mode for the `gas-client` helper class will be run when: | ||
Development mode for the `gas-client` helper class will be run when the `google` client API cannot be loaded. | ||
1. the `google` client API cannot be found, i.e. an error is thrown with the message "ReferenceError: google is not defined", and | ||
2. a `process.env.NODE_ENV` variable is set to `'development'`. [webpack.DefinePlugin](https://webpack.js.org/plugins/define-plugin/) can be set this up like this: | ||
```javascript | ||
plugins: [ | ||
// ..., | ||
new webpack.DefinePlugin({ | ||
'process.env': JSON.stringify({ NODE_ENV: 'development' }), | ||
}), | ||
]; | ||
``` | ||
Calling `new Server({ allowedDevelopmentDomains })` will create an instance with the following method in development mode: | ||
- `serverFunctions`: a proxy object, used for development purposes, that mimics calling `google.script.run`. It will dispatch a message to the parent iframe (our custom Dev Server), which will call an app that actually interacts with the `google.script.run` API. Development mode will also handle the response and resolve or reject based on the response type. See the implementation for details on the event signature. |
@@ -55,8 +55,3 @@ import { v4 as uuidv4 } from 'uuid'; | ||
} catch (err) { | ||
if ( | ||
err.toString() === 'ReferenceError: google is not defined' && | ||
process && | ||
process.env && | ||
process.env.NODE_ENV === 'development' | ||
) { | ||
if (typeof google === 'undefined') { | ||
// we'll store and access the resolve/reject functions here by id | ||
@@ -86,2 +81,3 @@ window.gasStore = {}; | ||
if (status === 'ERROR') { | ||
// TODO: return here so resolve doesn't get called on error | ||
reject(response); | ||
@@ -88,0 +84,0 @@ } |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
1
16763
14
211
110