@bucketco/node-sdk
Advanced tools
Comparing version 1.4.2 to 1.4.3
{ | ||
"name": "@bucketco/node-sdk", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -50,2 +50,9 @@ "use strict"; | ||
var _a, _b, _c, _d; | ||
this._initialize = (0, utils_1.once)(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
if (!this._config.offline) { | ||
yield this.getFeaturesCache().refresh(); | ||
} | ||
(_a = this._config.logger) === null || _a === void 0 ? void 0 : _a.info("Bucket initialized"); | ||
})); | ||
(0, utils_1.ok)((0, utils_1.isObject)(options), "options must be an object"); | ||
@@ -415,10 +422,8 @@ (0, utils_1.ok)(options.host === undefined || | ||
* Call this method before calling `getFeatures` to ensure the feature definitions are cached. | ||
* The client will ignore subsequent calls to this method. | ||
**/ | ||
initialize() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
if (!this._config.offline) { | ||
yield this.getFeaturesCache().refresh(); | ||
} | ||
(_a = this._config.logger) === null || _a === void 0 ? void 0 : _a.info("Bucket initialized"); | ||
yield this._initialize(); | ||
return; | ||
}); | ||
@@ -425,0 +430,0 @@ } |
@@ -11,2 +11,3 @@ "use strict"; | ||
exports.hashObject = hashObject; | ||
exports.once = once; | ||
const crypto_1 = require("crypto"); | ||
@@ -156,2 +157,14 @@ /** | ||
} | ||
function once(fn) { | ||
let called = false; | ||
let returned; | ||
return function () { | ||
if (called) { | ||
return returned; | ||
} | ||
returned = fn(); | ||
called = true; | ||
return returned; | ||
}; | ||
} | ||
//# sourceMappingURL=utils.js.map |
@@ -141,2 +141,3 @@ import type { FeatureOverridesFn, IdType } from "./types"; | ||
}): Promise<void>; | ||
private _initialize; | ||
/** | ||
@@ -149,2 +150,3 @@ * Initializes the client by caching the features definitions. | ||
* Call this method before calling `getFeatures` to ensure the feature definitions are cached. | ||
* The client will ignore subsequent calls to this method. | ||
**/ | ||
@@ -151,0 +153,0 @@ initialize(): Promise<void>; |
@@ -50,1 +50,2 @@ import { IdType, Logger, LogLevel } from "./types"; | ||
export declare function hashObject(obj: Record<string, any>): string; | ||
export declare function once<T extends () => ReturnType<T>>(fn: T): () => ReturnType<T>; |
{ | ||
"name": "@bucketco/node-sdk", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"license": "MIT", | ||
@@ -49,3 +49,3 @@ "repository": { | ||
}, | ||
"gitHead": "67abc1868074101798bb8827da6480ecb7b43b11" | ||
"gitHead": "5411ac337abbcdf254584286599ae94b934c0ca7" | ||
} |
@@ -19,5 +19,5 @@ # Bucket Node.js SDK | ||
To get started you need to obtain a secret key from | ||
[Environment setting view](https://app.bucket.co/envs/{environment}/settings/app-environments) | ||
in **Bucket.co**. | ||
To get started you need to obtain your secret key from the | ||
[environment settings](https://app.bucket.co/envs/current/settings/app-environments) | ||
in Bucket. | ||
@@ -32,3 +32,3 @@ > [!CAUTION] | ||
1. Find the Bucket secret key for your development environment on https://app.bucket.co | ||
1. Find the Bucket secret key for your development environment under [environment settings](https://app.bucket.co/envs/current/settings/app-environments) in Bucket. | ||
2. Set `BUCKET_SECRET_KEY` in your `.env` file | ||
@@ -35,0 +35,0 @@ 3. Create a `bucket.ts` file containing the following: |
Sorry, the diff of this file is not supported yet
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
138514
2060