@builder.io/sdk 4.0.3 → 5.0.0-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.
@@ -1052,7 +1052,7 @@
1052
1052
 
1053
1053
  var DEFAULT_API_VERSION = 'v3';
1054
1054
 
1055
- var SDK_VERSION = '4.0.3';
1055
+ var SDK_VERSION = '5.0.0-0';
1056
1056
 
1057
1057
  function datePlusMinutes(minutes) {
1058
1058
  if (minutes === void 0) { minutes = 30; }
@@ -2413,7 +2413,6 @@
2413
2413
  };
2414
2414
  Builder.prototype.flushGetContentQueue = function (usePastQueue, useQueue) {
2415
2415
  var _this = this;
2416
- var _a, _b;
2417
2416
  if (usePastQueue === void 0) { usePastQueue = false; }
2418
2417
  if (!this.apiKey) {
2419
2418
  throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
@@ -2430,6 +2429,7 @@
2430
2429
  return;
2431
2430
  }
2432
2431
  var queue = useQueue || (usePastQueue ? this.priorContentQueue : this.getContentQueue) || [];
2432
+ var apiEndpoint = queue[0].apiEndpoint || 'query';
2433
2433
  // TODO: do this on every request send?
2434
2434
  this.getOverridesFromQueryString();
2435
2435
  var queryParams = __assign(__assign({
@@ -2504,7 +2504,6 @@
2504
2504
  }
2505
2505
  }
2506
2506
  }
2507
- var isApiCallForCodegen = ((_a = queue[0].options) === null || _a === void 0 ? void 0 : _a.format) === 'solid' || ((_b = queue[0].options) === null || _b === void 0 ? void 0 : _b.format) === 'react';
2508
2507
  for (var _i = 0, queue_2 = queue; _i < queue_2.length; _i++) {
2509
2508
  var options = queue_2[_i];
2510
2509
  var format_1 = options.format;
@@ -2536,11 +2535,11 @@
2536
2535
  'rev',
2537
2536
  'static',
2538
2537
  ];
2539
- for (var _c = 0, properties_1 = properties; _c < properties_1.length; _c++) {
2540
- var key = properties_1[_c];
2538
+ for (var _a = 0, properties_1 = properties; _a < properties_1.length; _a++) {
2539
+ var key = properties_1[_a];
2541
2540
  var value = options[key];
2542
2541
  if (value !== undefined) {
2543
- if (isApiCallForCodegen) {
2542
+ if (apiEndpoint === 'query') {
2544
2543
  queryParams.options = queryParams.options || {};
2545
2544
  queryParams.options[options.key] = queryParams.options[options.key] || {};
2546
2545
  queryParams.options[options.key][key] = JSON.stringify(value);
@@ -2562,8 +2561,10 @@
2562
2561
  var params = omit(QueryString.parse(this.overrideParams), 'apiKey');
2563
2562
  assign(queryParams, params);
2564
2563
  }
2565
- queryParams.format;
2566
- if (!isApiCallForCodegen) {
2564
+ var format = queryParams.format;
2565
+ var isApiCallForCodegen = format === 'solid' || format === 'react';
2566
+ var isApiCallForCodegenOrQuery = isApiCallForCodegen || apiEndpoint === 'query';
2567
+ if (apiEndpoint === 'content') {
2567
2568
  queryParams.enrich = true;
2568
2569
  if (queue[0].query) {
2569
2570
  var flattened = this.flattenMongoQuery({ query: queue[0].query });
@@ -2582,6 +2583,9 @@
2582
2583
  if (isApiCallForCodegen) {
2583
2584
  url = "".concat(host, "/api/v1/codegen/").concat(this.apiKey, "/").concat(keyNames);
2584
2585
  }
2586
+ else if (apiEndpoint === 'query') {
2587
+ url = "".concat(host, "/api/v3/query/").concat(this.apiKey, "/").concat(keyNames);
2588
+ }
2585
2589
  else {
2586
2590
  url = "".concat(host, "/api/v3/content/").concat(queue[0].model);
2587
2591
  }
@@ -2604,7 +2608,7 @@
2604
2608
  if (!observer) {
2605
2609
  return;
2606
2610
  }
2607
- var data = isApiCallForCodegen ? result[keyName] : result.results;
2611
+ var data = isApiCallForCodegenOrQuery ? result[keyName] : result.results;
2608
2612
  var sorted = data; // sortBy(data, item => item.priority);
2609
2613
  if (data) {
2610
2614
  var testModifiedResults = Builder.isServer