tinacms 2.2.2 → 2.2.4

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.js CHANGED
@@ -4627,6 +4627,8 @@ var __publicField = (obj, key, value) => {
4627
4627
  React__namespace.useEffect(() => {
4628
4628
  if (field.experimental___filter && optionSets.length > 0) {
4629
4629
  setFilteredOptionsList(field.experimental___filter(optionSets, void 0));
4630
+ } else {
4631
+ setFilteredOptionsList(optionSets);
4630
4632
  }
4631
4633
  }, [optionSets, field.experimental___filter]);
4632
4634
  if (loading === true) {
@@ -4647,7 +4649,7 @@ var __publicField = (obj, key, value) => {
4647
4649
  {
4648
4650
  shouldFilter: !field.experimental___filter,
4649
4651
  filter: (value2, search) => {
4650
- if (value2.toLowerCase().replace(/\//g, "").includes(search.toLowerCase()))
4652
+ if (value2.toLowerCase().includes(search.toLowerCase()))
4651
4653
  return 1;
4652
4654
  return 0;
4653
4655
  }
@@ -8524,7 +8526,7 @@ var __publicField = (obj, key, value) => {
8524
8526
  const { message = "Unexpected error generating upload url" } = await res.json();
8525
8527
  throw new Error(message);
8526
8528
  }
8527
- const { signedUrl } = await res.json();
8529
+ const { signedUrl, requestId } = await res.json();
8528
8530
  if (!signedUrl) {
8529
8531
  throw new Error("Unexpected error generating upload url");
8530
8532
  }
@@ -8546,6 +8548,21 @@ var __publicField = (obj, key, value) => {
8546
8548
  throw new Error(`Upload error: '${matches[2]}'`);
8547
8549
  }
8548
8550
  }
8551
+ const updateStartTime = Date.now();
8552
+ while (true) {
8553
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8554
+ const { error, message } = await this.api.getRequestStatus(requestId);
8555
+ if (error !== void 0) {
8556
+ if (error) {
8557
+ throw new Error(message);
8558
+ } else {
8559
+ break;
8560
+ }
8561
+ }
8562
+ if (Date.now() - updateStartTime > 3e4) {
8563
+ throw new Error("Time out waiting for upload to complete");
8564
+ }
8565
+ }
8549
8566
  const src = `https://assets.tina.io/${this.api.clientId}/${path}`;
8550
8567
  newFiles.push({
8551
8568
  directory: item.directory,
@@ -8731,9 +8748,34 @@ var __publicField = (obj, key, value) => {
8731
8748
  const path = `${media.directory ? `${media.directory}/${media.filename}` : media.filename}`;
8732
8749
  if (!this.isLocal) {
8733
8750
  if (await this.isAuthenticated()) {
8734
- await this.api.authProvider.fetchWithToken(`${this.url}/${path}`, {
8735
- method: "DELETE"
8736
- });
8751
+ const res = await this.api.authProvider.fetchWithToken(
8752
+ `${this.url}/${path}`,
8753
+ {
8754
+ method: "DELETE"
8755
+ }
8756
+ );
8757
+ if (res.status == 200) {
8758
+ const { requestId } = await res.json();
8759
+ const deleteStartTime = Date.now();
8760
+ while (true) {
8761
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8762
+ const { error, message } = await this.api.getRequestStatus(
8763
+ requestId
8764
+ );
8765
+ if (error !== void 0) {
8766
+ if (error) {
8767
+ throw new Error(message);
8768
+ } else {
8769
+ break;
8770
+ }
8771
+ }
8772
+ if (Date.now() - deleteStartTime > 3e4) {
8773
+ throw new Error("Time out waiting for delete to complete");
8774
+ }
8775
+ }
8776
+ } else {
8777
+ throw new Error("Unexpected error deleting media asset");
8778
+ }
8737
8779
  } else {
8738
8780
  throw E_UNAUTHORIZED;
8739
8781
  }
@@ -10514,8 +10556,13 @@ var __publicField = (obj, key, value) => {
10514
10556
  variant: "danger",
10515
10557
  onClick: async () => {
10516
10558
  setProcessing(true);
10517
- await deleteFunc();
10518
- close2();
10559
+ try {
10560
+ await deleteFunc();
10561
+ } catch (e) {
10562
+ console.error(e);
10563
+ } finally {
10564
+ close2();
10565
+ }
10519
10566
  }
10520
10567
  },
10521
10568
  /* @__PURE__ */ React.createElement("span", { className: "mr-1" }, "Delete"),
@@ -28466,6 +28513,16 @@ mutation addPendingDocumentMutation(
28466
28513
  const val = await res.json();
28467
28514
  return val;
28468
28515
  }
28516
+ async getRequestStatus(requestId) {
28517
+ const res = await this.authProvider.fetchWithToken(
28518
+ `${this.contentApiBase}/request-status/${this.clientId}/${requestId}`,
28519
+ {
28520
+ method: "GET"
28521
+ }
28522
+ );
28523
+ const val = await res.json();
28524
+ return val;
28525
+ }
28469
28526
  async createPullRequest({
28470
28527
  baseBranch,
28471
28528
  branch,
package/dist/index.mjs CHANGED
@@ -4650,6 +4650,8 @@ const ComboboxDemo = ({
4650
4650
  React.useEffect(() => {
4651
4651
  if (field.experimental___filter && optionSets.length > 0) {
4652
4652
  setFilteredOptionsList(field.experimental___filter(optionSets, void 0));
4653
+ } else {
4654
+ setFilteredOptionsList(optionSets);
4653
4655
  }
4654
4656
  }, [optionSets, field.experimental___filter]);
4655
4657
  if (loading === true) {
@@ -4670,7 +4672,7 @@ const ComboboxDemo = ({
4670
4672
  {
4671
4673
  shouldFilter: !field.experimental___filter,
4672
4674
  filter: (value2, search) => {
4673
- if (value2.toLowerCase().replace(/\//g, "").includes(search.toLowerCase()))
4675
+ if (value2.toLowerCase().includes(search.toLowerCase()))
4674
4676
  return 1;
4675
4677
  return 0;
4676
4678
  }
@@ -8547,7 +8549,7 @@ class TinaMediaStore {
8547
8549
  const { message = "Unexpected error generating upload url" } = await res.json();
8548
8550
  throw new Error(message);
8549
8551
  }
8550
- const { signedUrl } = await res.json();
8552
+ const { signedUrl, requestId } = await res.json();
8551
8553
  if (!signedUrl) {
8552
8554
  throw new Error("Unexpected error generating upload url");
8553
8555
  }
@@ -8569,6 +8571,21 @@ class TinaMediaStore {
8569
8571
  throw new Error(`Upload error: '${matches[2]}'`);
8570
8572
  }
8571
8573
  }
8574
+ const updateStartTime = Date.now();
8575
+ while (true) {
8576
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8577
+ const { error, message } = await this.api.getRequestStatus(requestId);
8578
+ if (error !== void 0) {
8579
+ if (error) {
8580
+ throw new Error(message);
8581
+ } else {
8582
+ break;
8583
+ }
8584
+ }
8585
+ if (Date.now() - updateStartTime > 3e4) {
8586
+ throw new Error("Time out waiting for upload to complete");
8587
+ }
8588
+ }
8572
8589
  const src = `https://assets.tina.io/${this.api.clientId}/${path}`;
8573
8590
  newFiles.push({
8574
8591
  directory: item.directory,
@@ -8754,9 +8771,34 @@ class TinaMediaStore {
8754
8771
  const path = `${media.directory ? `${media.directory}/${media.filename}` : media.filename}`;
8755
8772
  if (!this.isLocal) {
8756
8773
  if (await this.isAuthenticated()) {
8757
- await this.api.authProvider.fetchWithToken(`${this.url}/${path}`, {
8758
- method: "DELETE"
8759
- });
8774
+ const res = await this.api.authProvider.fetchWithToken(
8775
+ `${this.url}/${path}`,
8776
+ {
8777
+ method: "DELETE"
8778
+ }
8779
+ );
8780
+ if (res.status == 200) {
8781
+ const { requestId } = await res.json();
8782
+ const deleteStartTime = Date.now();
8783
+ while (true) {
8784
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8785
+ const { error, message } = await this.api.getRequestStatus(
8786
+ requestId
8787
+ );
8788
+ if (error !== void 0) {
8789
+ if (error) {
8790
+ throw new Error(message);
8791
+ } else {
8792
+ break;
8793
+ }
8794
+ }
8795
+ if (Date.now() - deleteStartTime > 3e4) {
8796
+ throw new Error("Time out waiting for delete to complete");
8797
+ }
8798
+ }
8799
+ } else {
8800
+ throw new Error("Unexpected error deleting media asset");
8801
+ }
8760
8802
  } else {
8761
8803
  throw E_UNAUTHORIZED;
8762
8804
  }
@@ -10537,8 +10579,13 @@ const DeleteModal$1 = ({
10537
10579
  variant: "danger",
10538
10580
  onClick: async () => {
10539
10581
  setProcessing(true);
10540
- await deleteFunc();
10541
- close2();
10582
+ try {
10583
+ await deleteFunc();
10584
+ } catch (e) {
10585
+ console.error(e);
10586
+ } finally {
10587
+ close2();
10588
+ }
10542
10589
  }
10543
10590
  },
10544
10591
  /* @__PURE__ */ React__default.createElement("span", { className: "mr-1" }, "Delete"),
@@ -28489,6 +28536,16 @@ mutation addPendingDocumentMutation(
28489
28536
  const val = await res.json();
28490
28537
  return val;
28491
28538
  }
28539
+ async getRequestStatus(requestId) {
28540
+ const res = await this.authProvider.fetchWithToken(
28541
+ `${this.contentApiBase}/request-status/${this.clientId}/${requestId}`,
28542
+ {
28543
+ method: "GET"
28544
+ }
28545
+ );
28546
+ const val = await res.json();
28547
+ return val;
28548
+ }
28492
28549
  async createPullRequest({
28493
28550
  baseBranch,
28494
28551
  branch,
@@ -87,6 +87,10 @@ export declare class Client {
87
87
  assetsSyncing: string[];
88
88
  }>;
89
89
  getProject(): Promise<TinaCloudProject>;
90
+ getRequestStatus(requestId: string): Promise<{
91
+ error: boolean;
92
+ message?: string;
93
+ }>;
90
94
  createPullRequest({ baseBranch, branch, title, }: {
91
95
  baseBranch: string;
92
96
  branch: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -124,8 +124,8 @@
124
124
  "yup": "^1.4.0",
125
125
  "zod": "^3.23.8",
126
126
  "@tinacms/mdx": "1.4.2",
127
- "@tinacms/schema-tools": "1.6.2",
128
- "@tinacms/search": "1.0.28"
127
+ "@tinacms/search": "1.0.28",
128
+ "@tinacms/schema-tools": "1.6.2"
129
129
  },
130
130
  "devDependencies": {
131
131
  "@graphql-tools/utils": "^10.3.3",