New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@looker/sdk

Package Overview
Dependencies
Maintainers
6
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@looker/sdk - npm Package Compare versions

Comparing version 0.1.3-beta.10 to 0.1.3-beta.11

2

dist/rtl/apiSettings.js

@@ -112,3 +112,3 @@ "use strict";

'timeout' in settings
? parseInt(settings.timeout.toString())
? parseInt(settings.timeout.toString(), 10)
: this.timeout;

@@ -115,0 +115,0 @@ if (!this.isConfigured()) {

@@ -13,4 +13,4 @@ import { ApiSettings, IApiSettings } from './apiSettings';

/**
* Parse .ini formatted content
* @param contents {string} formatted as an .ini file
* Parses `.ini` formatted content
* @param contents formatted as an `.ini` file
* @constructor

@@ -29,10 +29,33 @@ */

/**
* Configuration initializer
* @class NodeSettings
* Configuration initializer for Node applications
*
* This class can be used directly when configuration settings should NOT come
* from the default environment variables or a configuration file
*
*/
export declare class NodeSettings extends ApiSettings {
constructor(contents: string, section?: string);
constructor(contents: string | IApiSettings, section?: string);
/**
* All descendants of NodeSettings must implement readConfig to retrieve API credentials
* since credentials are not stored in memory
*
* @param {string} section
* @returns {IApiSection} is not returned and an error is thrown instead
*
* @throws sdkError
*
*/
readConfig(section?: string): IApiSection;
}
export declare class NodeSettingsEnv extends ApiSettings {
/**
* Read configuration settings from Node environment variables
*
* This class initializes SDK settings **only** from the values passed in to its constructor and
* (potentially) configured environment variables, and does not read a configuration file at all
*
* Any environment variables that **are** set, will override the values passed in to the constructor
* with the same key
*
*/
export declare class NodeSettingsEnv extends NodeSettings {
constructor(contents?: string | IApiSettings, section?: string);

@@ -43,11 +66,13 @@ readConfig(section?: string): IApiSection;

* Example class that reads a configuration from a file in node
* @class NodeSettingsIniFile
*
* If `fileName` is not specified in the constructor, the default file name is `./looker.ini`
*
* **Warning**: INI files storing credentials should be secured in the run-time environment, and
* ignored by version control systems so credentials never get checked in to source code repositories
* **Warning**: `.ini` files storing credentials should be secured in the run-time environment, and
* ignored by version control systems so credentials never get checked in to source code repositories.
* A recommended pattern is using Node environment variables to specify confidential API credentials
* while using an `.ini` file for values like `base_url` and `api_version`.
*
* **Note**: If the configuration file is specified but does **not** exist, an error will be thrown.
* No error is thrown if the fileName defaulted to `./looker.ini` inside the constructor
* No error is thrown if the fileName defaulted to `./looker.ini` inside the constructor and that
* file does not exist. In that case, configuration from environment variables will be required.
*

@@ -54,0 +79,0 @@ */

@@ -38,2 +38,13 @@ "use strict";

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __importStar = (this && this.__importStar) || function (mod) {

@@ -53,4 +64,4 @@ if (mod && mod.__esModule) return mod;

/**
* Parse .ini formatted content
* @param contents {string} formatted as an .ini file
* Parses `.ini` formatted content
* @param contents formatted as an `.ini` file
* @constructor

@@ -78,5 +89,7 @@ */

/**
* Configuration initializer
* @class NodeSettings
* Configuration initializer for Node applications
*
* This class can be used directly when configuration settings should NOT come
* from the default environment variables or a configuration file
*
*/

@@ -87,9 +100,28 @@ var NodeSettings = /** @class */ (function (_super) {

var _this = this;
var settings = exports.ApiConfigSection(contents, section);
var settings = typeof contents === 'string' ? exports.ApiConfigSection(contents, section) : contents;
_this = _super.call(this, settings) || this;
return _this;
}
/**
* All descendants of NodeSettings must implement readConfig to retrieve API credentials
* since credentials are not stored in memory
*
* @param {string} section
* @returns {IApiSection} is not returned and an error is thrown instead
*
* @throws sdkError
*
*/
// @ts-ignore
NodeSettings.prototype.readConfig = function (section) {
throw transport_1.sdkError({ message: 'NodeSettings has no config to read' });
};
return NodeSettings;
}(apiSettings_1.ApiSettings));
exports.NodeSettings = NodeSettings;
/**
* A utility function that loads environment variables and maps them to the standard configuration values
*
* @returns the populated `IApiSection`, which may be empty
*/
var readEnvConfig = function () {

@@ -106,2 +138,10 @@ var values = {};

};
/**
* A utility function that loads the configuration values from the specified file name and overrides them
* with environment variable values, if the environment variables exist
*
* @param {string} fileName Name of configuration file to read
* @param {string} section Optional. Name of section of configuration file to read
* @returns {IApiSection} containing the configuration values
*/
var readIniConfig = function (fileName, section) {

@@ -111,10 +151,17 @@ // get environment variables

if (fileName && fs.existsSync(fileName)) {
var values_1 = exports.ApiConfigSection(fs.readFileSync(fileName, constants_1.utf8), section);
// override any config file settings with environment values if the environment value is set
Object.keys(values_1).forEach(function (key) {
config[key] = config[key] || values_1[key];
});
config = __assign({}, exports.ApiConfigSection(fs.readFileSync(fileName, constants_1.utf8), section), config);
}
return config;
};
/**
* Read configuration settings from Node environment variables
*
* This class initializes SDK settings **only** from the values passed in to its constructor and
* (potentially) configured environment variables, and does not read a configuration file at all
*
* Any environment variables that **are** set, will override the values passed in to the constructor
* with the same key
*
*/
var NodeSettingsEnv = /** @class */ (function (_super) {

@@ -127,3 +174,3 @@ __extends(NodeSettingsEnv, _super);

if (typeof contents === 'string') {
settings = apiSettings_1.ValueSettings(exports.ApiConfigSection(contents, section));
settings = exports.ApiConfigSection(contents, section);
}

@@ -133,7 +180,8 @@ else {

}
settings = __assign({}, readEnvConfig(), settings);
}
else {
settings = apiSettings_1.ValueSettings(readEnvConfig());
settings = readEnvConfig();
}
_this = _super.call(this, settings) || this;
_this = _super.call(this, __assign({}, apiSettings_1.DefaultSettings(), settings)) || this;
return _this;

@@ -146,15 +194,17 @@ }

return NodeSettingsEnv;
}(apiSettings_1.ApiSettings));
}(NodeSettings));
exports.NodeSettingsEnv = NodeSettingsEnv;
/**
* Example class that reads a configuration from a file in node
* @class NodeSettingsIniFile
*
* If `fileName` is not specified in the constructor, the default file name is `./looker.ini`
*
* **Warning**: INI files storing credentials should be secured in the run-time environment, and
* ignored by version control systems so credentials never get checked in to source code repositories
* **Warning**: `.ini` files storing credentials should be secured in the run-time environment, and
* ignored by version control systems so credentials never get checked in to source code repositories.
* A recommended pattern is using Node environment variables to specify confidential API credentials
* while using an `.ini` file for values like `base_url` and `api_version`.
*
* **Note**: If the configuration file is specified but does **not** exist, an error will be thrown.
* No error is thrown if the fileName defaulted to `./looker.ini` inside the constructor
* No error is thrown if the fileName defaulted to `./looker.ini` inside the constructor and that
* file does not exist. In that case, configuration from environment variables will be required.
*

@@ -161,0 +211,0 @@ */

@@ -187,11 +187,10 @@ /// <reference types="node" />

* Does this content type have a UTF-8 charset?
* @param {string} contentType
* @returns {RegExpMatchArray | null}
* @param contentType
* @returns match if it exists
*/
export declare function isUtf8(contentType: string): RegExpMatchArray | null;
/** constructs the path argument including any optional query parameters
@param {string} path the base path of the request
@param {[key: string]: string} obj optional collection of query parameters to encode and append to the path
/**
* constructs the path argument including any optional query parameters
* @param path the base path of the request
* @param obj optional collection of query parameters to encode and append to the path
*/

@@ -198,0 +197,0 @@ export declare function addQueryParams(path: string, obj?: {

@@ -140,4 +140,4 @@ "use strict";

* Does this content type have a UTF-8 charset?
* @param {string} contentType
* @returns {RegExpMatchArray | null}
* @param contentType
* @returns match if it exists
*/

@@ -148,7 +148,6 @@ function isUtf8(contentType) {

exports.isUtf8 = isUtf8;
/** constructs the path argument including any optional query parameters
@param {string} path the base path of the request
@param {[key: string]: string} obj optional collection of query parameters to encode and append to the path
/**
* constructs the path argument including any optional query parameters
* @param path the base path of the request
* @param obj optional collection of query parameters to encode and append to the path
*/

@@ -155,0 +154,0 @@ function addQueryParams(path, obj) {

{
"name": "@looker/sdk",
"version": "0.1.3-beta.10",
"version": "0.1.3-beta.11",
"description": "Looker SDK",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc