@builder.io/sdk 6.1.3 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/index.browser.js +34 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.js +34 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +34 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +34 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/builder.class.d.ts +47 -1
- package/dist/src/builder.class.js +33 -0
- package/dist/src/builder.class.js.map +1 -1
- package/dist/src/builder.class.test.js +108 -0
- package/dist/src/builder.class.test.js.map +1 -1
- package/dist/src/sdk-version.d.ts +1 -1
- package/dist/src/sdk-version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -958,7 +958,7 @@ function toError(err) {
|
|
|
958
958
|
|
|
959
959
|
var DEFAULT_API_VERSION = 'v3';
|
|
960
960
|
|
|
961
|
-
var SDK_VERSION = '6.
|
|
961
|
+
var SDK_VERSION = '6.2.0';
|
|
962
962
|
|
|
963
963
|
function datePlusMinutes(minutes) {
|
|
964
964
|
if (minutes === void 0) { minutes = 30; }
|
|
@@ -2514,6 +2514,14 @@ var Builder = /** @class */ (function () {
|
|
|
2514
2514
|
if (this.apiEndpoint === 'content') {
|
|
2515
2515
|
queryParams.includeRefs = true;
|
|
2516
2516
|
}
|
|
2517
|
+
if (this.apiEndpoint === 'query') {
|
|
2518
|
+
if ('enrich' in options && options.enrich !== undefined) {
|
|
2519
|
+
queryParams.enrich = options.enrich;
|
|
2520
|
+
}
|
|
2521
|
+
if (options.enrichOptions) {
|
|
2522
|
+
this.flattenEnrichOptions(options.enrichOptions, 'enrichOptions', queryParams);
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2517
2525
|
var properties = [
|
|
2518
2526
|
'prerender',
|
|
2519
2527
|
'extractCss',
|
|
@@ -2541,6 +2549,15 @@ var Builder = /** @class */ (function () {
|
|
|
2541
2549
|
}
|
|
2542
2550
|
}
|
|
2543
2551
|
}
|
|
2552
|
+
// Handle enrich and enrichOptions for content endpoint
|
|
2553
|
+
if (this.apiEndpoint === 'content') {
|
|
2554
|
+
if ('enrich' in options && options.enrich !== undefined) {
|
|
2555
|
+
queryParams.enrich = options.enrich;
|
|
2556
|
+
}
|
|
2557
|
+
if (options.enrichOptions) {
|
|
2558
|
+
this.flattenEnrichOptions(options.enrichOptions, 'enrichOptions', queryParams);
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2544
2561
|
}
|
|
2545
2562
|
if (this.preview && this.previewingModel === ((_b = queue === null || queue === void 0 ? void 0 : queue[0]) === null || _b === void 0 ? void 0 : _b.model)) {
|
|
2546
2563
|
queryParams.preview = 'true';
|
|
@@ -2699,6 +2716,22 @@ var Builder = /** @class */ (function () {
|
|
|
2699
2716
|
}
|
|
2700
2717
|
return Builder.isBrowser && setCookie(name, value, expires);
|
|
2701
2718
|
};
|
|
2719
|
+
/**
|
|
2720
|
+
* Recursively flattens enrichOptions object into dot-notation query parameters
|
|
2721
|
+
* @private
|
|
2722
|
+
*/
|
|
2723
|
+
Builder.prototype.flattenEnrichOptions = function (obj, prefix, result) {
|
|
2724
|
+
for (var _i = 0, _a = Object.entries(obj); _i < _a.length; _i++) {
|
|
2725
|
+
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
2726
|
+
var newKey = "".concat(prefix, ".").concat(key);
|
|
2727
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
2728
|
+
this.flattenEnrichOptions(value, newKey, result);
|
|
2729
|
+
}
|
|
2730
|
+
else {
|
|
2731
|
+
result[newKey] = value;
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
};
|
|
2702
2735
|
Builder.prototype.getContent = function (modelName, options) {
|
|
2703
2736
|
if (options === void 0) { options = {}; }
|
|
2704
2737
|
if (!this.apiKey) {
|