@builder.io/sdk 3.0.7 → 4.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.
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 = '3.0.7';
953
+ var SDK_VERSION = '4.0.0';
954
954
 
955
955
  function datePlusMinutes(minutes) {
956
956
  if (minutes === void 0) { minutes = 30; }
@@ -2303,6 +2303,7 @@ var Builder = /** @class */ (function () {
2303
2303
  };
2304
2304
  Builder.prototype.flushGetContentQueue = function (usePastQueue, useQueue) {
2305
2305
  var _this = this;
2306
+ var _a, _b;
2306
2307
  if (usePastQueue === void 0) { usePastQueue = false; }
2307
2308
  if (!this.apiKey) {
2308
2309
  throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
@@ -2319,7 +2320,6 @@ var Builder = /** @class */ (function () {
2319
2320
  return;
2320
2321
  }
2321
2322
  var queue = useQueue || (usePastQueue ? this.priorContentQueue : this.getContentQueue) || [];
2322
- var apiEndpoint = queue[0].apiEndpoint || 'query';
2323
2323
  // TODO: do this on every request send?
2324
2324
  this.getOverridesFromQueryString();
2325
2325
  var queryParams = __assign(__assign({
@@ -2394,6 +2394,7 @@ var Builder = /** @class */ (function () {
2394
2394
  }
2395
2395
  }
2396
2396
  }
2397
+ 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';
2397
2398
  for (var _i = 0, queue_2 = queue; _i < queue_2.length; _i++) {
2398
2399
  var options = queue_2[_i];
2399
2400
  var format_1 = options.format;
@@ -2425,11 +2426,11 @@ var Builder = /** @class */ (function () {
2425
2426
  'rev',
2426
2427
  'static',
2427
2428
  ];
2428
- for (var _a = 0, properties_1 = properties; _a < properties_1.length; _a++) {
2429
- var key = properties_1[_a];
2429
+ for (var _c = 0, properties_1 = properties; _c < properties_1.length; _c++) {
2430
+ var key = properties_1[_c];
2430
2431
  var value = options[key];
2431
2432
  if (value !== undefined) {
2432
- if (apiEndpoint === 'query') {
2433
+ if (isApiCallForCodegen) {
2433
2434
  queryParams.options = queryParams.options || {};
2434
2435
  queryParams.options[options.key] = queryParams.options[options.key] || {};
2435
2436
  queryParams.options[options.key][key] = JSON.stringify(value);
@@ -2451,10 +2452,8 @@ var Builder = /** @class */ (function () {
2451
2452
  var params = omit(QueryString.parse(this.overrideParams), 'apiKey');
2452
2453
  assign(queryParams, params);
2453
2454
  }
2454
- var format = queryParams.format;
2455
- var isApiCallForCodegen = format === 'solid' || format === 'react';
2456
- var isApiCallForCodegenOrQuery = isApiCallForCodegen || apiEndpoint === 'query';
2457
- if (apiEndpoint === 'content') {
2455
+ queryParams.format;
2456
+ if (!isApiCallForCodegen) {
2458
2457
  queryParams.enrich = true;
2459
2458
  if (queue[0].query) {
2460
2459
  var flattened = this.flattenMongoQuery({ query: queue[0].query });
@@ -2473,9 +2472,6 @@ var Builder = /** @class */ (function () {
2473
2472
  if (isApiCallForCodegen) {
2474
2473
  url = "".concat(host, "/api/v1/codegen/").concat(this.apiKey, "/").concat(keyNames);
2475
2474
  }
2476
- else if (apiEndpoint === 'query') {
2477
- url = "".concat(host, "/api/v3/query/").concat(this.apiKey, "/").concat(keyNames);
2478
- }
2479
2475
  else {
2480
2476
  url = "".concat(host, "/api/v3/content/").concat(queue[0].model);
2481
2477
  }
@@ -2498,7 +2494,7 @@ var Builder = /** @class */ (function () {
2498
2494
  if (!observer) {
2499
2495
  return;
2500
2496
  }
2501
- var data = isApiCallForCodegenOrQuery ? result[keyName] : result.results;
2497
+ var data = isApiCallForCodegen ? result[keyName] : result.results;
2502
2498
  var sorted = data; // sortBy(data, item => item.priority);
2503
2499
  if (data) {
2504
2500
  var testModifiedResults = Builder.isServer