@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/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.1.3';
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) {