@builder.io/sdk 2.0.4 → 2.0.5

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.umd.js CHANGED
@@ -152,7 +152,7 @@
152
152
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
153
153
  }
154
154
 
155
- var version = "2.0.4-0";
155
+ var version = "2.0.5-0";
156
156
 
157
157
  var Subscription = /** @class */ (function () {
158
158
  function Subscription(listeners, listener) {
@@ -1362,6 +1362,17 @@
1362
1362
  Builder.registerTrustedHost = function (host) {
1363
1363
  this.trustedHosts.push(host);
1364
1364
  };
1365
+ /**
1366
+ * @param context @type {import('isolated-vm').Context}
1367
+ * Use this function to control the execution context of custom code on the server.
1368
+ * const ivm = require('isolated-vm');
1369
+ * const isolate = new ivm.Isolate({ memoryLimit: 128 });
1370
+ * const context = isolate.createContextSync();
1371
+ * Builder.setServerContext(context);
1372
+ */
1373
+ Builder.setServerContext = function (context) {
1374
+ this.serverContext = context;
1375
+ };
1365
1376
  Builder.isTrustedHost = function (hostname) {
1366
1377
  return (this.trustedHosts.findIndex(function (trustedHost) { return trustedHost === hostname || hostname.endsWith(".".concat(trustedHost)); }) > -1);
1367
1378
  };
@@ -2321,7 +2332,7 @@
2321
2332
  // even though we only use `fetch()` now, we prefer to keep the old behavior and use the `fetch` that comes from
2322
2333
  // the core SDK for consistency
2323
2334
  Builder.prototype.requestUrl = function (url, options) {
2324
- return getFetch()(url, options).then(function (res) { return res.json(); });
2335
+ return getFetch()(url, __assign({ next: __assign({ revalidate: 1 }, options === null || options === void 0 ? void 0 : options.next) }, options)).then(function (res) { return res.json(); });
2325
2336
  };
2326
2337
  Object.defineProperty(Builder.prototype, "host", {
2327
2338
  get: function () {
@@ -2486,7 +2497,7 @@
2486
2497
  }
2487
2498
  var queryStr = QueryString.stringifyDeep(queryParams);
2488
2499
  var format = queryParams.format;
2489
- var requestOptions = { headers: {} };
2500
+ var requestOptions = { headers: {}, next: { revalidate: 1 } };
2490
2501
  if (this.authToken) {
2491
2502
  requestOptions.headers = __assign(__assign({}, requestOptions.headers), { Authorization: "Bearer ".concat(this.authToken) });
2492
2503
  }