@guilhermetod/gas-client
Advanced tools
Comparing version 1.0.0-beta.1 to 1.0.0-beta.2
@@ -1,4 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FunctionHost = void 0; | ||
var FunctionHost = /** @class */ (function () { | ||
@@ -17,2 +14,2 @@ function FunctionHost() { | ||
}()); | ||
exports.FunctionHost = FunctionHost; | ||
export { FunctionHost }; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -26,7 +25,5 @@ var extendStatics = function (d, b) { | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GASPromises = void 0; | ||
var ignored_function_names_1 = require("../utils/ignored-function-names"); | ||
var promisify_1 = require("../utils/promisify"); | ||
var function_host_1 = require("./function-host"); | ||
import { ignoredFunctionNames } from '../utils/ignored-function-names'; | ||
import { promisify } from '../utils/promisify'; | ||
import { FunctionHost } from './function-host'; | ||
var GASPromises = /** @class */ (function (_super) { | ||
@@ -44,9 +41,9 @@ __extends(GASPromises, _super); | ||
var _a; | ||
return (ignored_function_names_1.ignoredFunctionNames.includes(functionName) | ||
return (ignoredFunctionNames.includes(functionName) | ||
? acc | ||
: __assign(__assign({}, acc), (_a = {}, _a[functionName] = promisify_1.promisify(functionName), _a))); | ||
: __assign(__assign({}, acc), (_a = {}, _a[functionName] = promisify(functionName), _a))); | ||
}, {}); | ||
}; | ||
return GASPromises; | ||
}(function_host_1.FunctionHost)); | ||
exports.GASPromises = GASPromises; | ||
}(FunctionHost)); | ||
export { GASPromises }; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -15,7 +14,5 @@ var extendStatics = function (d, b) { | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ServerProxy = void 0; | ||
var check_allow_list_1 = require("../utils/check-allow-list"); | ||
var proxy_handler_1 = require("../utils/proxy-handler"); | ||
var function_host_1 = require("./function-host"); | ||
import { checkAllowList } from '../utils/check-allow-list'; | ||
import { proxyHandler } from '../utils/proxy-handler'; | ||
import { FunctionHost } from './function-host'; | ||
var ServerProxy = /** @class */ (function (_super) { | ||
@@ -28,3 +25,3 @@ __extends(ServerProxy, _super); | ||
window.addEventListener('message', _this.buildMessageListener(), false); | ||
_this._serverFunctions = new Proxy({}, { get: proxy_handler_1.proxyHandler }); | ||
_this._serverFunctions = new Proxy({}, { get: proxyHandler }); | ||
return _this; | ||
@@ -36,3 +33,3 @@ } | ||
var _a; | ||
var allowOrigin = check_allow_list_1.checkAllowList(event.origin, (_a = _this._config) === null || _a === void 0 ? void 0 : _a.allowedDevelopmentDomains); | ||
var allowOrigin = checkAllowList(event.origin, (_a = _this._config) === null || _a === void 0 ? void 0 : _a.allowedDevelopmentDomains); | ||
if (!allowOrigin || event.data.type !== 'RESPONSE') | ||
@@ -49,3 +46,3 @@ return; | ||
return ServerProxy; | ||
}(function_host_1.FunctionHost)); | ||
exports.ServerProxy = ServerProxy; | ||
}(FunctionHost)); | ||
export { ServerProxy }; |
@@ -1,15 +0,12 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GASClient = void 0; | ||
var is_gas_environment_1 = require("./utils/is-gas-environment"); | ||
var gas_promises_1 = require("./classes/gas-promises"); | ||
var server_proxy_1 = require("./classes/server-proxy"); | ||
import { isGASEnvironment } from './utils/is-gas-environment'; | ||
import { GASPromises } from './classes/gas-promises'; | ||
import { ServerProxy } from './classes/server-proxy'; | ||
var GASClient = /** @class */ (function () { | ||
function GASClient(_config) { | ||
this._config = _config; | ||
if (is_gas_environment_1.isGASEnvironment()) { | ||
this._functionHost = new gas_promises_1.GASPromises(); | ||
if (isGASEnvironment()) { | ||
this._functionHost = new GASPromises(); | ||
} | ||
else { | ||
this._functionHost = new server_proxy_1.ServerProxy(this._config); | ||
this._functionHost = new ServerProxy(this._config); | ||
} | ||
@@ -26,2 +23,2 @@ } | ||
}()); | ||
exports.GASClient = GASClient; | ||
export { GASClient }; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; |
@@ -1,4 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.checkAllowList = void 0; | ||
var checkAllowList = function (eventOrigin, allowedDevelopmentDomains) { | ||
@@ -13,2 +10,2 @@ if (typeof allowedDevelopmentDomains === 'string') { | ||
}; | ||
exports.checkAllowList = checkAllowList; | ||
export { checkAllowList }; |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ignoredFunctionNames = void 0; | ||
var ignoredFunctionNames = ['withFailureHandler', 'withLogger', 'withSuccessHandler', 'withUserObject']; | ||
exports.ignoredFunctionNames = ignoredFunctionNames; | ||
export { ignoredFunctionNames }; |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isGASEnvironment = void 0; | ||
var isGASEnvironment = function () { var _a; return typeof google !== 'undefined' && Boolean((_a = google === null || google === void 0 ? void 0 : google.script) === null || _a === void 0 ? void 0 : _a.run); }; | ||
exports.isGASEnvironment = isGASEnvironment; | ||
export { isGASEnvironment }; |
@@ -1,4 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.promisify = void 0; | ||
var promisify = function (functionName) { return (function () { | ||
@@ -16,2 +13,2 @@ var args = []; | ||
}); }; | ||
exports.promisify = promisify; | ||
export { promisify }; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
@@ -9,7 +8,5 @@ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.proxyHandler = void 0; | ||
var uuid_1 = require("uuid"); | ||
import { v4 as uuidv4 } from 'uuid'; | ||
var proxyHandler = function (target, functionName) { | ||
var id = uuid_1.v4(); | ||
var id = uuidv4(); | ||
var promise = new Promise(function (resolve, reject) { | ||
@@ -32,2 +29,2 @@ window.gasStore[id] = { resolve: resolve, reject: reject }; | ||
}; | ||
exports.proxyHandler = proxyHandler; | ||
export { proxyHandler }; |
{ | ||
"name": "@guilhermetod/gas-client", | ||
"version": "1.0.0-beta.1", | ||
"version": "1.0.0-beta.2", | ||
"description": "A client-side utility class that can call server-side Google Apps Script functions", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
19001
277