@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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @builder.io/sdk
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - f4fffe9: Permanently removes the `apiEndpoint` prop from `builder.get()` and `builder.getAll()` which had options `'content'` and `'query'`. Content API is now the only possible API endpoint for content fetching.
8
+
9
+ ### Patch Changes
10
+
11
+ - 443a3e3: Types: add jsdoc comments for some Builder SDK types
12
+
3
13
  ## 3.0.7
4
14
 
5
15
  ### Patch Changes
@@ -1052,7 +1052,7 @@
1052
1052
 
1053
1053
  var DEFAULT_API_VERSION = 'v3';
1054
1054
 
1055
- var SDK_VERSION = '3.0.7';
1055
+ var SDK_VERSION = '4.0.0';
1056
1056
 
1057
1057
  function datePlusMinutes(minutes) {
1058
1058
  if (minutes === void 0) { minutes = 30; }
@@ -2405,6 +2405,7 @@
2405
2405
  };
2406
2406
  Builder.prototype.flushGetContentQueue = function (usePastQueue, useQueue) {
2407
2407
  var _this = this;
2408
+ var _a, _b;
2408
2409
  if (usePastQueue === void 0) { usePastQueue = false; }
2409
2410
  if (!this.apiKey) {
2410
2411
  throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
@@ -2421,7 +2422,6 @@
2421
2422
  return;
2422
2423
  }
2423
2424
  var queue = useQueue || (usePastQueue ? this.priorContentQueue : this.getContentQueue) || [];
2424
- var apiEndpoint = queue[0].apiEndpoint || 'query';
2425
2425
  // TODO: do this on every request send?
2426
2426
  this.getOverridesFromQueryString();
2427
2427
  var queryParams = __assign(__assign({
@@ -2496,6 +2496,7 @@
2496
2496
  }
2497
2497
  }
2498
2498
  }
2499
+ 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';
2499
2500
  for (var _i = 0, queue_2 = queue; _i < queue_2.length; _i++) {
2500
2501
  var options = queue_2[_i];
2501
2502
  var format_1 = options.format;
@@ -2527,11 +2528,11 @@
2527
2528
  'rev',
2528
2529
  'static',
2529
2530
  ];
2530
- for (var _a = 0, properties_1 = properties; _a < properties_1.length; _a++) {
2531
- var key = properties_1[_a];
2531
+ for (var _c = 0, properties_1 = properties; _c < properties_1.length; _c++) {
2532
+ var key = properties_1[_c];
2532
2533
  var value = options[key];
2533
2534
  if (value !== undefined) {
2534
- if (apiEndpoint === 'query') {
2535
+ if (isApiCallForCodegen) {
2535
2536
  queryParams.options = queryParams.options || {};
2536
2537
  queryParams.options[options.key] = queryParams.options[options.key] || {};
2537
2538
  queryParams.options[options.key][key] = JSON.stringify(value);
@@ -2553,10 +2554,8 @@
2553
2554
  var params = omit(QueryString.parse(this.overrideParams), 'apiKey');
2554
2555
  assign(queryParams, params);
2555
2556
  }
2556
- var format = queryParams.format;
2557
- var isApiCallForCodegen = format === 'solid' || format === 'react';
2558
- var isApiCallForCodegenOrQuery = isApiCallForCodegen || apiEndpoint === 'query';
2559
- if (apiEndpoint === 'content') {
2557
+ queryParams.format;
2558
+ if (!isApiCallForCodegen) {
2560
2559
  queryParams.enrich = true;
2561
2560
  if (queue[0].query) {
2562
2561
  var flattened = this.flattenMongoQuery({ query: queue[0].query });
@@ -2575,9 +2574,6 @@
2575
2574
  if (isApiCallForCodegen) {
2576
2575
  url = "".concat(host, "/api/v1/codegen/").concat(this.apiKey, "/").concat(keyNames);
2577
2576
  }
2578
- else if (apiEndpoint === 'query') {
2579
- url = "".concat(host, "/api/v3/query/").concat(this.apiKey, "/").concat(keyNames);
2580
- }
2581
2577
  else {
2582
2578
  url = "".concat(host, "/api/v3/content/").concat(queue[0].model);
2583
2579
  }
@@ -2600,7 +2596,7 @@
2600
2596
  if (!observer) {
2601
2597
  return;
2602
2598
  }
2603
- var data = isApiCallForCodegenOrQuery ? result[keyName] : result.results;
2599
+ var data = isApiCallForCodegen ? result[keyName] : result.results;
2604
2600
  var sorted = data; // sortBy(data, item => item.priority);
2605
2601
  if (data) {
2606
2602
  var testModifiedResults = Builder.isServer