@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.esm.js
CHANGED
|
@@ -950,7 +950,7 @@ function toError(err) {
|
|
|
950
950
|
|
|
951
951
|
var DEFAULT_API_VERSION = 'v3';
|
|
952
952
|
|
|
953
|
-
var SDK_VERSION = '6.
|
|
953
|
+
var SDK_VERSION = '6.2.0';
|
|
954
954
|
|
|
955
955
|
function datePlusMinutes(minutes) {
|
|
956
956
|
if (minutes === void 0) { minutes = 30; }
|
|
@@ -2506,6 +2506,14 @@ var Builder = /** @class */ (function () {
|
|
|
2506
2506
|
if (this.apiEndpoint === 'content') {
|
|
2507
2507
|
queryParams.includeRefs = true;
|
|
2508
2508
|
}
|
|
2509
|
+
if (this.apiEndpoint === 'query') {
|
|
2510
|
+
if ('enrich' in options && options.enrich !== undefined) {
|
|
2511
|
+
queryParams.enrich = options.enrich;
|
|
2512
|
+
}
|
|
2513
|
+
if (options.enrichOptions) {
|
|
2514
|
+
this.flattenEnrichOptions(options.enrichOptions, 'enrichOptions', queryParams);
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2509
2517
|
var properties = [
|
|
2510
2518
|
'prerender',
|
|
2511
2519
|
'extractCss',
|
|
@@ -2533,6 +2541,15 @@ var Builder = /** @class */ (function () {
|
|
|
2533
2541
|
}
|
|
2534
2542
|
}
|
|
2535
2543
|
}
|
|
2544
|
+
// Handle enrich and enrichOptions for content endpoint
|
|
2545
|
+
if (this.apiEndpoint === 'content') {
|
|
2546
|
+
if ('enrich' in options && options.enrich !== undefined) {
|
|
2547
|
+
queryParams.enrich = options.enrich;
|
|
2548
|
+
}
|
|
2549
|
+
if (options.enrichOptions) {
|
|
2550
|
+
this.flattenEnrichOptions(options.enrichOptions, 'enrichOptions', queryParams);
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2536
2553
|
}
|
|
2537
2554
|
if (this.preview && this.previewingModel === ((_b = queue === null || queue === void 0 ? void 0 : queue[0]) === null || _b === void 0 ? void 0 : _b.model)) {
|
|
2538
2555
|
queryParams.preview = 'true';
|
|
@@ -2691,6 +2708,22 @@ var Builder = /** @class */ (function () {
|
|
|
2691
2708
|
}
|
|
2692
2709
|
return Builder.isBrowser && setCookie(name, value, expires);
|
|
2693
2710
|
};
|
|
2711
|
+
/**
|
|
2712
|
+
* Recursively flattens enrichOptions object into dot-notation query parameters
|
|
2713
|
+
* @private
|
|
2714
|
+
*/
|
|
2715
|
+
Builder.prototype.flattenEnrichOptions = function (obj, prefix, result) {
|
|
2716
|
+
for (var _i = 0, _a = Object.entries(obj); _i < _a.length; _i++) {
|
|
2717
|
+
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
2718
|
+
var newKey = "".concat(prefix, ".").concat(key);
|
|
2719
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
2720
|
+
this.flattenEnrichOptions(value, newKey, result);
|
|
2721
|
+
}
|
|
2722
|
+
else {
|
|
2723
|
+
result[newKey] = value;
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
};
|
|
2694
2727
|
Builder.prototype.getContent = function (modelName, options) {
|
|
2695
2728
|
if (options === void 0) { options = {}; }
|
|
2696
2729
|
if (!this.apiKey) {
|