@builder.io/sdk-solid 4.1.3 → 4.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.
@@ -5502,7 +5502,7 @@ function getPreviewContent(_searchParams) {
5502
5502
  }
5503
5503
 
5504
5504
  // src/constants/sdk-version.ts
5505
- var SDK_VERSION = "4.1.3";
5505
+ var SDK_VERSION = "4.2.0";
5506
5506
 
5507
5507
  // src/helpers/sdk-headers.ts
5508
5508
  var getSdkHeaders = () => ({
@@ -6408,13 +6408,15 @@ function EnableEditor(props) {
6408
6408
  }
6409
6409
  function runHttpRequests() {
6410
6410
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
6411
- Object.entries(requests).forEach(([key, url]) => {
6412
- if (!url)
6411
+ Object.entries(requests).forEach(([key, httpRequest]) => {
6412
+ if (!httpRequest)
6413
6413
  return;
6414
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
6414
6415
  if (httpReqsPending()[key])
6415
6416
  return;
6416
6417
  if (httpReqsData()[key] && !isEditing())
6417
6418
  return;
6419
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
6418
6420
  httpReqsPending()[key] = true;
6419
6421
  const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
6420
6422
  code: group,
@@ -6423,14 +6425,27 @@ function EnableEditor(props) {
6423
6425
  rootState: props.builderContextSignal.rootState,
6424
6426
  rootSetState: props.builderContextSignal.rootSetState
6425
6427
  })));
6426
- logFetch(evaluatedUrl);
6427
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
6428
+ const fetchRequestObj = isCoreRequest ? {
6429
+ url: evaluatedUrl,
6430
+ method: httpRequest.request.method,
6431
+ headers: httpRequest.request.headers,
6432
+ body: httpRequest.request.body
6433
+ } : {
6434
+ url: evaluatedUrl,
6435
+ method: "GET"
6436
+ };
6437
+ logFetch(JSON.stringify(fetchRequestObj));
6438
+ fetch(fetchRequestObj.url, {
6439
+ method: fetchRequestObj.method,
6440
+ headers: fetchRequestObj.headers,
6441
+ body: fetchRequestObj.body
6442
+ }).then((response) => response.json()).then((json) => {
6428
6443
  mergeNewRootState({
6429
6444
  [key]: json
6430
6445
  });
6431
6446
  httpReqsData()[key] = true;
6432
6447
  }).catch((err) => {
6433
- console.error("error fetching dynamic data", url, err);
6448
+ console.error("error fetching dynamic data", JSON.stringify(httpRequest), err);
6434
6449
  }).finally(() => {
6435
6450
  httpReqsPending()[key] = false;
6436
6451
  });
@@ -4994,7 +4994,7 @@ function getPreviewContent(_searchParams) {
4994
4994
  }
4995
4995
 
4996
4996
  // src/constants/sdk-version.ts
4997
- var SDK_VERSION = "4.1.3";
4997
+ var SDK_VERSION = "4.2.0";
4998
4998
 
4999
4999
  // src/helpers/sdk-headers.ts
5000
5000
  var getSdkHeaders = () => ({
@@ -5899,38 +5899,59 @@ function EnableEditor(props) {
5899
5899
  }
5900
5900
  function runHttpRequests() {
5901
5901
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
5902
- Object.entries(requests).forEach(([key, url]) => {
5903
- if (!url)
5904
- return;
5905
- if (httpReqsPending()[key])
5906
- return;
5907
- if (httpReqsData()[key] && !isEditing())
5908
- return;
5909
- httpReqsPending()[key] = true;
5910
- const evaluatedUrl = url.replace(
5911
- /{{([^}]+)}}/g,
5912
- (_match, group) => String(
5913
- evaluate({
5914
- code: group,
5915
- context: props.context || {},
5916
- localState: void 0,
5917
- rootState: props.builderContextSignal.rootState,
5918
- rootSetState: props.builderContextSignal.rootSetState
5919
- })
5920
- )
5921
- );
5922
- logFetch(evaluatedUrl);
5923
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
5924
- mergeNewRootState({
5925
- [key]: json
5902
+ Object.entries(requests).forEach(
5903
+ ([key, httpRequest]) => {
5904
+ if (!httpRequest)
5905
+ return;
5906
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
5907
+ if (httpReqsPending()[key])
5908
+ return;
5909
+ if (httpReqsData()[key] && !isEditing())
5910
+ return;
5911
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
5912
+ httpReqsPending()[key] = true;
5913
+ const evaluatedUrl = url.replace(
5914
+ /{{([^}]+)}}/g,
5915
+ (_match, group) => String(
5916
+ evaluate({
5917
+ code: group,
5918
+ context: props.context || {},
5919
+ localState: void 0,
5920
+ rootState: props.builderContextSignal.rootState,
5921
+ rootSetState: props.builderContextSignal.rootSetState
5922
+ })
5923
+ )
5924
+ );
5925
+ const fetchRequestObj = isCoreRequest ? {
5926
+ url: evaluatedUrl,
5927
+ method: httpRequest.request.method,
5928
+ headers: httpRequest.request.headers,
5929
+ body: httpRequest.request.body
5930
+ } : {
5931
+ url: evaluatedUrl,
5932
+ method: "GET"
5933
+ };
5934
+ logFetch(JSON.stringify(fetchRequestObj));
5935
+ fetch(fetchRequestObj.url, {
5936
+ method: fetchRequestObj.method,
5937
+ headers: fetchRequestObj.headers,
5938
+ body: fetchRequestObj.body
5939
+ }).then((response) => response.json()).then((json) => {
5940
+ mergeNewRootState({
5941
+ [key]: json
5942
+ });
5943
+ httpReqsData()[key] = true;
5944
+ }).catch((err) => {
5945
+ console.error(
5946
+ "error fetching dynamic data",
5947
+ JSON.stringify(httpRequest),
5948
+ err
5949
+ );
5950
+ }).finally(() => {
5951
+ httpReqsPending()[key] = false;
5926
5952
  });
5927
- httpReqsData()[key] = true;
5928
- }).catch((err) => {
5929
- console.error("error fetching dynamic data", url, err);
5930
- }).finally(() => {
5931
- httpReqsPending()[key] = false;
5932
- });
5933
- });
5953
+ }
5954
+ );
5934
5955
  }
5935
5956
  function emitStateUpdate() {
5936
5957
  if (isEditing()) {
@@ -5489,7 +5489,7 @@ function getPreviewContent(_searchParams) {
5489
5489
  }
5490
5490
 
5491
5491
  // src/constants/sdk-version.ts
5492
- var SDK_VERSION = "4.1.3";
5492
+ var SDK_VERSION = "4.2.0";
5493
5493
 
5494
5494
  // src/helpers/sdk-headers.ts
5495
5495
  var getSdkHeaders = () => ({
@@ -6390,13 +6390,15 @@ function EnableEditor(props) {
6390
6390
  }
6391
6391
  function runHttpRequests() {
6392
6392
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
6393
- Object.entries(requests).forEach(([key, url]) => {
6394
- if (!url)
6393
+ Object.entries(requests).forEach(([key, httpRequest]) => {
6394
+ if (!httpRequest)
6395
6395
  return;
6396
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
6396
6397
  if (httpReqsPending()[key])
6397
6398
  return;
6398
6399
  if (httpReqsData()[key] && !isEditing())
6399
6400
  return;
6401
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
6400
6402
  httpReqsPending()[key] = true;
6401
6403
  const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
6402
6404
  code: group,
@@ -6405,8 +6407,21 @@ function EnableEditor(props) {
6405
6407
  rootState: props.builderContextSignal.rootState,
6406
6408
  rootSetState: props.builderContextSignal.rootSetState
6407
6409
  })));
6408
- logFetch(evaluatedUrl);
6409
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
6410
+ const fetchRequestObj = isCoreRequest ? {
6411
+ url: evaluatedUrl,
6412
+ method: httpRequest.request.method,
6413
+ headers: httpRequest.request.headers,
6414
+ body: httpRequest.request.body
6415
+ } : {
6416
+ url: evaluatedUrl,
6417
+ method: "GET"
6418
+ };
6419
+ logFetch(JSON.stringify(fetchRequestObj));
6420
+ fetch(fetchRequestObj.url, {
6421
+ method: fetchRequestObj.method,
6422
+ headers: fetchRequestObj.headers,
6423
+ body: fetchRequestObj.body
6424
+ }).then((response) => response.json()).then((json) => {
6410
6425
  mergeNewRootState({
6411
6426
  [key]: json
6412
6427
  });
@@ -4983,7 +4983,7 @@ function getPreviewContent(_searchParams) {
4983
4983
  }
4984
4984
 
4985
4985
  // src/constants/sdk-version.ts
4986
- var SDK_VERSION = "4.1.3";
4986
+ var SDK_VERSION = "4.2.0";
4987
4987
 
4988
4988
  // src/helpers/sdk-headers.ts
4989
4989
  var getSdkHeaders = () => ({
@@ -5883,37 +5883,54 @@ function EnableEditor(props) {
5883
5883
  }
5884
5884
  function runHttpRequests() {
5885
5885
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
5886
- Object.entries(requests).forEach(([key, url]) => {
5887
- if (!url)
5888
- return;
5889
- if (httpReqsPending()[key])
5890
- return;
5891
- if (httpReqsData()[key] && !isEditing())
5892
- return;
5893
- httpReqsPending()[key] = true;
5894
- const evaluatedUrl = url.replace(
5895
- /{{([^}]+)}}/g,
5896
- (_match, group) => String(
5897
- evaluate({
5898
- code: group,
5899
- context: props.context || {},
5900
- localState: void 0,
5901
- rootState: props.builderContextSignal.rootState,
5902
- rootSetState: props.builderContextSignal.rootSetState
5903
- })
5904
- )
5905
- );
5906
- logFetch(evaluatedUrl);
5907
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
5908
- mergeNewRootState({
5909
- [key]: json
5886
+ Object.entries(requests).forEach(
5887
+ ([key, httpRequest]) => {
5888
+ if (!httpRequest)
5889
+ return;
5890
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
5891
+ if (httpReqsPending()[key])
5892
+ return;
5893
+ if (httpReqsData()[key] && !isEditing())
5894
+ return;
5895
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
5896
+ httpReqsPending()[key] = true;
5897
+ const evaluatedUrl = url.replace(
5898
+ /{{([^}]+)}}/g,
5899
+ (_match, group) => String(
5900
+ evaluate({
5901
+ code: group,
5902
+ context: props.context || {},
5903
+ localState: void 0,
5904
+ rootState: props.builderContextSignal.rootState,
5905
+ rootSetState: props.builderContextSignal.rootSetState
5906
+ })
5907
+ )
5908
+ );
5909
+ const fetchRequestObj = isCoreRequest ? {
5910
+ url: evaluatedUrl,
5911
+ method: httpRequest.request.method,
5912
+ headers: httpRequest.request.headers,
5913
+ body: httpRequest.request.body
5914
+ } : {
5915
+ url: evaluatedUrl,
5916
+ method: "GET"
5917
+ };
5918
+ logFetch(JSON.stringify(fetchRequestObj));
5919
+ fetch(fetchRequestObj.url, {
5920
+ method: fetchRequestObj.method,
5921
+ headers: fetchRequestObj.headers,
5922
+ body: fetchRequestObj.body
5923
+ }).then((response) => response.json()).then((json) => {
5924
+ mergeNewRootState({
5925
+ [key]: json
5926
+ });
5927
+ httpReqsData()[key] = true;
5928
+ }).catch((err) => {
5929
+ }).finally(() => {
5930
+ httpReqsPending()[key] = false;
5910
5931
  });
5911
- httpReqsData()[key] = true;
5912
- }).catch((err) => {
5913
- }).finally(() => {
5914
- httpReqsPending()[key] = false;
5915
- });
5916
- });
5932
+ }
5933
+ );
5917
5934
  }
5918
5935
  function emitStateUpdate() {
5919
5936
  if (isEditing()) {
package/lib/edge/dev.js CHANGED
@@ -8683,7 +8683,7 @@ function getPreviewContent(_searchParams) {
8683
8683
  }
8684
8684
 
8685
8685
  // src/constants/sdk-version.ts
8686
- var SDK_VERSION = "4.1.3";
8686
+ var SDK_VERSION = "4.2.0";
8687
8687
 
8688
8688
  // src/helpers/sdk-headers.ts
8689
8689
  var getSdkHeaders = () => ({
@@ -9589,13 +9589,15 @@ function EnableEditor(props) {
9589
9589
  }
9590
9590
  function runHttpRequests() {
9591
9591
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
9592
- Object.entries(requests).forEach(([key, url]) => {
9593
- if (!url)
9592
+ Object.entries(requests).forEach(([key, httpRequest]) => {
9593
+ if (!httpRequest)
9594
9594
  return;
9595
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
9595
9596
  if (httpReqsPending()[key])
9596
9597
  return;
9597
9598
  if (httpReqsData()[key] && !isEditing())
9598
9599
  return;
9600
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
9599
9601
  httpReqsPending()[key] = true;
9600
9602
  const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
9601
9603
  code: group,
@@ -9604,14 +9606,27 @@ function EnableEditor(props) {
9604
9606
  rootState: props.builderContextSignal.rootState,
9605
9607
  rootSetState: props.builderContextSignal.rootSetState
9606
9608
  })));
9607
- logFetch(evaluatedUrl);
9608
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
9609
+ const fetchRequestObj = isCoreRequest ? {
9610
+ url: evaluatedUrl,
9611
+ method: httpRequest.request.method,
9612
+ headers: httpRequest.request.headers,
9613
+ body: httpRequest.request.body
9614
+ } : {
9615
+ url: evaluatedUrl,
9616
+ method: "GET"
9617
+ };
9618
+ logFetch(JSON.stringify(fetchRequestObj));
9619
+ fetch(fetchRequestObj.url, {
9620
+ method: fetchRequestObj.method,
9621
+ headers: fetchRequestObj.headers,
9622
+ body: fetchRequestObj.body
9623
+ }).then((response) => response.json()).then((json) => {
9609
9624
  mergeNewRootState({
9610
9625
  [key]: json
9611
9626
  });
9612
9627
  httpReqsData()[key] = true;
9613
9628
  }).catch((err) => {
9614
- console.error("error fetching dynamic data", url, err);
9629
+ console.error("error fetching dynamic data", JSON.stringify(httpRequest), err);
9615
9630
  }).finally(() => {
9616
9631
  httpReqsPending()[key] = false;
9617
9632
  });
package/lib/edge/dev.jsx CHANGED
@@ -8177,7 +8177,7 @@ function getPreviewContent(_searchParams) {
8177
8177
  }
8178
8178
 
8179
8179
  // src/constants/sdk-version.ts
8180
- var SDK_VERSION = "4.1.3";
8180
+ var SDK_VERSION = "4.2.0";
8181
8181
 
8182
8182
  // src/helpers/sdk-headers.ts
8183
8183
  var getSdkHeaders = () => ({
@@ -9082,38 +9082,59 @@ function EnableEditor(props) {
9082
9082
  }
9083
9083
  function runHttpRequests() {
9084
9084
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
9085
- Object.entries(requests).forEach(([key, url]) => {
9086
- if (!url)
9087
- return;
9088
- if (httpReqsPending()[key])
9089
- return;
9090
- if (httpReqsData()[key] && !isEditing())
9091
- return;
9092
- httpReqsPending()[key] = true;
9093
- const evaluatedUrl = url.replace(
9094
- /{{([^}]+)}}/g,
9095
- (_match, group) => String(
9096
- evaluate({
9097
- code: group,
9098
- context: props.context || {},
9099
- localState: void 0,
9100
- rootState: props.builderContextSignal.rootState,
9101
- rootSetState: props.builderContextSignal.rootSetState
9102
- })
9103
- )
9104
- );
9105
- logFetch(evaluatedUrl);
9106
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
9107
- mergeNewRootState({
9108
- [key]: json
9085
+ Object.entries(requests).forEach(
9086
+ ([key, httpRequest]) => {
9087
+ if (!httpRequest)
9088
+ return;
9089
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
9090
+ if (httpReqsPending()[key])
9091
+ return;
9092
+ if (httpReqsData()[key] && !isEditing())
9093
+ return;
9094
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
9095
+ httpReqsPending()[key] = true;
9096
+ const evaluatedUrl = url.replace(
9097
+ /{{([^}]+)}}/g,
9098
+ (_match, group) => String(
9099
+ evaluate({
9100
+ code: group,
9101
+ context: props.context || {},
9102
+ localState: void 0,
9103
+ rootState: props.builderContextSignal.rootState,
9104
+ rootSetState: props.builderContextSignal.rootSetState
9105
+ })
9106
+ )
9107
+ );
9108
+ const fetchRequestObj = isCoreRequest ? {
9109
+ url: evaluatedUrl,
9110
+ method: httpRequest.request.method,
9111
+ headers: httpRequest.request.headers,
9112
+ body: httpRequest.request.body
9113
+ } : {
9114
+ url: evaluatedUrl,
9115
+ method: "GET"
9116
+ };
9117
+ logFetch(JSON.stringify(fetchRequestObj));
9118
+ fetch(fetchRequestObj.url, {
9119
+ method: fetchRequestObj.method,
9120
+ headers: fetchRequestObj.headers,
9121
+ body: fetchRequestObj.body
9122
+ }).then((response) => response.json()).then((json) => {
9123
+ mergeNewRootState({
9124
+ [key]: json
9125
+ });
9126
+ httpReqsData()[key] = true;
9127
+ }).catch((err) => {
9128
+ console.error(
9129
+ "error fetching dynamic data",
9130
+ JSON.stringify(httpRequest),
9131
+ err
9132
+ );
9133
+ }).finally(() => {
9134
+ httpReqsPending()[key] = false;
9109
9135
  });
9110
- httpReqsData()[key] = true;
9111
- }).catch((err) => {
9112
- console.error("error fetching dynamic data", url, err);
9113
- }).finally(() => {
9114
- httpReqsPending()[key] = false;
9115
- });
9116
- });
9136
+ }
9137
+ );
9117
9138
  }
9118
9139
  function emitStateUpdate() {
9119
9140
  if (isEditing()) {
package/lib/edge/index.js CHANGED
@@ -8670,7 +8670,7 @@ function getPreviewContent(_searchParams) {
8670
8670
  }
8671
8671
 
8672
8672
  // src/constants/sdk-version.ts
8673
- var SDK_VERSION = "4.1.3";
8673
+ var SDK_VERSION = "4.2.0";
8674
8674
 
8675
8675
  // src/helpers/sdk-headers.ts
8676
8676
  var getSdkHeaders = () => ({
@@ -9571,13 +9571,15 @@ function EnableEditor(props) {
9571
9571
  }
9572
9572
  function runHttpRequests() {
9573
9573
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
9574
- Object.entries(requests).forEach(([key, url]) => {
9575
- if (!url)
9574
+ Object.entries(requests).forEach(([key, httpRequest]) => {
9575
+ if (!httpRequest)
9576
9576
  return;
9577
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
9577
9578
  if (httpReqsPending()[key])
9578
9579
  return;
9579
9580
  if (httpReqsData()[key] && !isEditing())
9580
9581
  return;
9582
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
9581
9583
  httpReqsPending()[key] = true;
9582
9584
  const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
9583
9585
  code: group,
@@ -9586,8 +9588,21 @@ function EnableEditor(props) {
9586
9588
  rootState: props.builderContextSignal.rootState,
9587
9589
  rootSetState: props.builderContextSignal.rootSetState
9588
9590
  })));
9589
- logFetch(evaluatedUrl);
9590
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
9591
+ const fetchRequestObj = isCoreRequest ? {
9592
+ url: evaluatedUrl,
9593
+ method: httpRequest.request.method,
9594
+ headers: httpRequest.request.headers,
9595
+ body: httpRequest.request.body
9596
+ } : {
9597
+ url: evaluatedUrl,
9598
+ method: "GET"
9599
+ };
9600
+ logFetch(JSON.stringify(fetchRequestObj));
9601
+ fetch(fetchRequestObj.url, {
9602
+ method: fetchRequestObj.method,
9603
+ headers: fetchRequestObj.headers,
9604
+ body: fetchRequestObj.body
9605
+ }).then((response) => response.json()).then((json) => {
9591
9606
  mergeNewRootState({
9592
9607
  [key]: json
9593
9608
  });
@@ -8166,7 +8166,7 @@ function getPreviewContent(_searchParams) {
8166
8166
  }
8167
8167
 
8168
8168
  // src/constants/sdk-version.ts
8169
- var SDK_VERSION = "4.1.3";
8169
+ var SDK_VERSION = "4.2.0";
8170
8170
 
8171
8171
  // src/helpers/sdk-headers.ts
8172
8172
  var getSdkHeaders = () => ({
@@ -9066,37 +9066,54 @@ function EnableEditor(props) {
9066
9066
  }
9067
9067
  function runHttpRequests() {
9068
9068
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
9069
- Object.entries(requests).forEach(([key, url]) => {
9070
- if (!url)
9071
- return;
9072
- if (httpReqsPending()[key])
9073
- return;
9074
- if (httpReqsData()[key] && !isEditing())
9075
- return;
9076
- httpReqsPending()[key] = true;
9077
- const evaluatedUrl = url.replace(
9078
- /{{([^}]+)}}/g,
9079
- (_match, group) => String(
9080
- evaluate({
9081
- code: group,
9082
- context: props.context || {},
9083
- localState: void 0,
9084
- rootState: props.builderContextSignal.rootState,
9085
- rootSetState: props.builderContextSignal.rootSetState
9086
- })
9087
- )
9088
- );
9089
- logFetch(evaluatedUrl);
9090
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
9091
- mergeNewRootState({
9092
- [key]: json
9069
+ Object.entries(requests).forEach(
9070
+ ([key, httpRequest]) => {
9071
+ if (!httpRequest)
9072
+ return;
9073
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
9074
+ if (httpReqsPending()[key])
9075
+ return;
9076
+ if (httpReqsData()[key] && !isEditing())
9077
+ return;
9078
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
9079
+ httpReqsPending()[key] = true;
9080
+ const evaluatedUrl = url.replace(
9081
+ /{{([^}]+)}}/g,
9082
+ (_match, group) => String(
9083
+ evaluate({
9084
+ code: group,
9085
+ context: props.context || {},
9086
+ localState: void 0,
9087
+ rootState: props.builderContextSignal.rootState,
9088
+ rootSetState: props.builderContextSignal.rootSetState
9089
+ })
9090
+ )
9091
+ );
9092
+ const fetchRequestObj = isCoreRequest ? {
9093
+ url: evaluatedUrl,
9094
+ method: httpRequest.request.method,
9095
+ headers: httpRequest.request.headers,
9096
+ body: httpRequest.request.body
9097
+ } : {
9098
+ url: evaluatedUrl,
9099
+ method: "GET"
9100
+ };
9101
+ logFetch(JSON.stringify(fetchRequestObj));
9102
+ fetch(fetchRequestObj.url, {
9103
+ method: fetchRequestObj.method,
9104
+ headers: fetchRequestObj.headers,
9105
+ body: fetchRequestObj.body
9106
+ }).then((response) => response.json()).then((json) => {
9107
+ mergeNewRootState({
9108
+ [key]: json
9109
+ });
9110
+ httpReqsData()[key] = true;
9111
+ }).catch((err) => {
9112
+ }).finally(() => {
9113
+ httpReqsPending()[key] = false;
9093
9114
  });
9094
- httpReqsData()[key] = true;
9095
- }).catch((err) => {
9096
- }).finally(() => {
9097
- httpReqsPending()[key] = false;
9098
- });
9099
- });
9115
+ }
9116
+ );
9100
9117
  }
9101
9118
  function emitStateUpdate() {
9102
9119
  if (isEditing()) {
package/lib/node/dev.js CHANGED
@@ -5671,7 +5671,7 @@ function getPreviewContent(_searchParams) {
5671
5671
  }
5672
5672
 
5673
5673
  // src/constants/sdk-version.ts
5674
- var SDK_VERSION = "4.1.3";
5674
+ var SDK_VERSION = "4.2.0";
5675
5675
 
5676
5676
  // src/helpers/sdk-headers.ts
5677
5677
  var getSdkHeaders = () => ({
@@ -6577,13 +6577,15 @@ function EnableEditor(props) {
6577
6577
  }
6578
6578
  function runHttpRequests() {
6579
6579
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
6580
- Object.entries(requests).forEach(([key, url]) => {
6581
- if (!url)
6580
+ Object.entries(requests).forEach(([key, httpRequest]) => {
6581
+ if (!httpRequest)
6582
6582
  return;
6583
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
6583
6584
  if (httpReqsPending()[key])
6584
6585
  return;
6585
6586
  if (httpReqsData()[key] && !isEditing())
6586
6587
  return;
6588
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
6587
6589
  httpReqsPending()[key] = true;
6588
6590
  const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
6589
6591
  code: group,
@@ -6592,14 +6594,27 @@ function EnableEditor(props) {
6592
6594
  rootState: props.builderContextSignal.rootState,
6593
6595
  rootSetState: props.builderContextSignal.rootSetState
6594
6596
  })));
6595
- logFetch(evaluatedUrl);
6596
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
6597
+ const fetchRequestObj = isCoreRequest ? {
6598
+ url: evaluatedUrl,
6599
+ method: httpRequest.request.method,
6600
+ headers: httpRequest.request.headers,
6601
+ body: httpRequest.request.body
6602
+ } : {
6603
+ url: evaluatedUrl,
6604
+ method: "GET"
6605
+ };
6606
+ logFetch(JSON.stringify(fetchRequestObj));
6607
+ fetch(fetchRequestObj.url, {
6608
+ method: fetchRequestObj.method,
6609
+ headers: fetchRequestObj.headers,
6610
+ body: fetchRequestObj.body
6611
+ }).then((response) => response.json()).then((json) => {
6597
6612
  mergeNewRootState({
6598
6613
  [key]: json
6599
6614
  });
6600
6615
  httpReqsData()[key] = true;
6601
6616
  }).catch((err) => {
6602
- console.error("error fetching dynamic data", url, err);
6617
+ console.error("error fetching dynamic data", JSON.stringify(httpRequest), err);
6603
6618
  }).finally(() => {
6604
6619
  httpReqsPending()[key] = false;
6605
6620
  });
package/lib/node/dev.jsx CHANGED
@@ -5165,7 +5165,7 @@ function getPreviewContent(_searchParams) {
5165
5165
  }
5166
5166
 
5167
5167
  // src/constants/sdk-version.ts
5168
- var SDK_VERSION = "4.1.3";
5168
+ var SDK_VERSION = "4.2.0";
5169
5169
 
5170
5170
  // src/helpers/sdk-headers.ts
5171
5171
  var getSdkHeaders = () => ({
@@ -6070,38 +6070,59 @@ function EnableEditor(props) {
6070
6070
  }
6071
6071
  function runHttpRequests() {
6072
6072
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
6073
- Object.entries(requests).forEach(([key, url]) => {
6074
- if (!url)
6075
- return;
6076
- if (httpReqsPending()[key])
6077
- return;
6078
- if (httpReqsData()[key] && !isEditing())
6079
- return;
6080
- httpReqsPending()[key] = true;
6081
- const evaluatedUrl = url.replace(
6082
- /{{([^}]+)}}/g,
6083
- (_match, group) => String(
6084
- evaluate({
6085
- code: group,
6086
- context: props.context || {},
6087
- localState: void 0,
6088
- rootState: props.builderContextSignal.rootState,
6089
- rootSetState: props.builderContextSignal.rootSetState
6090
- })
6091
- )
6092
- );
6093
- logFetch(evaluatedUrl);
6094
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
6095
- mergeNewRootState({
6096
- [key]: json
6073
+ Object.entries(requests).forEach(
6074
+ ([key, httpRequest]) => {
6075
+ if (!httpRequest)
6076
+ return;
6077
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
6078
+ if (httpReqsPending()[key])
6079
+ return;
6080
+ if (httpReqsData()[key] && !isEditing())
6081
+ return;
6082
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
6083
+ httpReqsPending()[key] = true;
6084
+ const evaluatedUrl = url.replace(
6085
+ /{{([^}]+)}}/g,
6086
+ (_match, group) => String(
6087
+ evaluate({
6088
+ code: group,
6089
+ context: props.context || {},
6090
+ localState: void 0,
6091
+ rootState: props.builderContextSignal.rootState,
6092
+ rootSetState: props.builderContextSignal.rootSetState
6093
+ })
6094
+ )
6095
+ );
6096
+ const fetchRequestObj = isCoreRequest ? {
6097
+ url: evaluatedUrl,
6098
+ method: httpRequest.request.method,
6099
+ headers: httpRequest.request.headers,
6100
+ body: httpRequest.request.body
6101
+ } : {
6102
+ url: evaluatedUrl,
6103
+ method: "GET"
6104
+ };
6105
+ logFetch(JSON.stringify(fetchRequestObj));
6106
+ fetch(fetchRequestObj.url, {
6107
+ method: fetchRequestObj.method,
6108
+ headers: fetchRequestObj.headers,
6109
+ body: fetchRequestObj.body
6110
+ }).then((response) => response.json()).then((json) => {
6111
+ mergeNewRootState({
6112
+ [key]: json
6113
+ });
6114
+ httpReqsData()[key] = true;
6115
+ }).catch((err) => {
6116
+ console.error(
6117
+ "error fetching dynamic data",
6118
+ JSON.stringify(httpRequest),
6119
+ err
6120
+ );
6121
+ }).finally(() => {
6122
+ httpReqsPending()[key] = false;
6097
6123
  });
6098
- httpReqsData()[key] = true;
6099
- }).catch((err) => {
6100
- console.error("error fetching dynamic data", url, err);
6101
- }).finally(() => {
6102
- httpReqsPending()[key] = false;
6103
- });
6104
- });
6124
+ }
6125
+ );
6105
6126
  }
6106
6127
  function emitStateUpdate() {
6107
6128
  if (isEditing()) {
package/lib/node/index.js CHANGED
@@ -5658,7 +5658,7 @@ function getPreviewContent(_searchParams) {
5658
5658
  }
5659
5659
 
5660
5660
  // src/constants/sdk-version.ts
5661
- var SDK_VERSION = "4.1.3";
5661
+ var SDK_VERSION = "4.2.0";
5662
5662
 
5663
5663
  // src/helpers/sdk-headers.ts
5664
5664
  var getSdkHeaders = () => ({
@@ -6559,13 +6559,15 @@ function EnableEditor(props) {
6559
6559
  }
6560
6560
  function runHttpRequests() {
6561
6561
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
6562
- Object.entries(requests).forEach(([key, url]) => {
6563
- if (!url)
6562
+ Object.entries(requests).forEach(([key, httpRequest]) => {
6563
+ if (!httpRequest)
6564
6564
  return;
6565
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
6565
6566
  if (httpReqsPending()[key])
6566
6567
  return;
6567
6568
  if (httpReqsData()[key] && !isEditing())
6568
6569
  return;
6570
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
6569
6571
  httpReqsPending()[key] = true;
6570
6572
  const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
6571
6573
  code: group,
@@ -6574,8 +6576,21 @@ function EnableEditor(props) {
6574
6576
  rootState: props.builderContextSignal.rootState,
6575
6577
  rootSetState: props.builderContextSignal.rootSetState
6576
6578
  })));
6577
- logFetch(evaluatedUrl);
6578
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
6579
+ const fetchRequestObj = isCoreRequest ? {
6580
+ url: evaluatedUrl,
6581
+ method: httpRequest.request.method,
6582
+ headers: httpRequest.request.headers,
6583
+ body: httpRequest.request.body
6584
+ } : {
6585
+ url: evaluatedUrl,
6586
+ method: "GET"
6587
+ };
6588
+ logFetch(JSON.stringify(fetchRequestObj));
6589
+ fetch(fetchRequestObj.url, {
6590
+ method: fetchRequestObj.method,
6591
+ headers: fetchRequestObj.headers,
6592
+ body: fetchRequestObj.body
6593
+ }).then((response) => response.json()).then((json) => {
6579
6594
  mergeNewRootState({
6580
6595
  [key]: json
6581
6596
  });
@@ -5154,7 +5154,7 @@ function getPreviewContent(_searchParams) {
5154
5154
  }
5155
5155
 
5156
5156
  // src/constants/sdk-version.ts
5157
- var SDK_VERSION = "4.1.3";
5157
+ var SDK_VERSION = "4.2.0";
5158
5158
 
5159
5159
  // src/helpers/sdk-headers.ts
5160
5160
  var getSdkHeaders = () => ({
@@ -6054,37 +6054,54 @@ function EnableEditor(props) {
6054
6054
  }
6055
6055
  function runHttpRequests() {
6056
6056
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
6057
- Object.entries(requests).forEach(([key, url]) => {
6058
- if (!url)
6059
- return;
6060
- if (httpReqsPending()[key])
6061
- return;
6062
- if (httpReqsData()[key] && !isEditing())
6063
- return;
6064
- httpReqsPending()[key] = true;
6065
- const evaluatedUrl = url.replace(
6066
- /{{([^}]+)}}/g,
6067
- (_match, group) => String(
6068
- evaluate({
6069
- code: group,
6070
- context: props.context || {},
6071
- localState: void 0,
6072
- rootState: props.builderContextSignal.rootState,
6073
- rootSetState: props.builderContextSignal.rootSetState
6074
- })
6075
- )
6076
- );
6077
- logFetch(evaluatedUrl);
6078
- fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
6079
- mergeNewRootState({
6080
- [key]: json
6057
+ Object.entries(requests).forEach(
6058
+ ([key, httpRequest]) => {
6059
+ if (!httpRequest)
6060
+ return;
6061
+ const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
6062
+ if (httpReqsPending()[key])
6063
+ return;
6064
+ if (httpReqsData()[key] && !isEditing())
6065
+ return;
6066
+ const url = isCoreRequest ? httpRequest.request.url : httpRequest;
6067
+ httpReqsPending()[key] = true;
6068
+ const evaluatedUrl = url.replace(
6069
+ /{{([^}]+)}}/g,
6070
+ (_match, group) => String(
6071
+ evaluate({
6072
+ code: group,
6073
+ context: props.context || {},
6074
+ localState: void 0,
6075
+ rootState: props.builderContextSignal.rootState,
6076
+ rootSetState: props.builderContextSignal.rootSetState
6077
+ })
6078
+ )
6079
+ );
6080
+ const fetchRequestObj = isCoreRequest ? {
6081
+ url: evaluatedUrl,
6082
+ method: httpRequest.request.method,
6083
+ headers: httpRequest.request.headers,
6084
+ body: httpRequest.request.body
6085
+ } : {
6086
+ url: evaluatedUrl,
6087
+ method: "GET"
6088
+ };
6089
+ logFetch(JSON.stringify(fetchRequestObj));
6090
+ fetch(fetchRequestObj.url, {
6091
+ method: fetchRequestObj.method,
6092
+ headers: fetchRequestObj.headers,
6093
+ body: fetchRequestObj.body
6094
+ }).then((response) => response.json()).then((json) => {
6095
+ mergeNewRootState({
6096
+ [key]: json
6097
+ });
6098
+ httpReqsData()[key] = true;
6099
+ }).catch((err) => {
6100
+ }).finally(() => {
6101
+ httpReqsPending()[key] = false;
6081
6102
  });
6082
- httpReqsData()[key] = true;
6083
- }).catch((err) => {
6084
- }).finally(() => {
6085
- httpReqsPending()[key] = false;
6086
- });
6087
- });
6103
+ }
6104
+ );
6088
6105
  }
6089
6106
  function emitStateUpdate() {
6090
6107
  if (isEditing()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-solid",
3
- "version": "4.1.3",
3
+ "version": "4.2.0",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist",