tinacms 2.2.3 → 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
@@ -4649,7 +4649,7 @@ var __publicField = (obj, key, value) => {
4649
4649
  {
4650
4650
  shouldFilter: !field.experimental___filter,
4651
4651
  filter: (value2, search) => {
4652
- if (value2.toLowerCase().replace(/\//g, "").includes(search.toLowerCase()))
4652
+ if (value2.toLowerCase().includes(search.toLowerCase()))
4653
4653
  return 1;
4654
4654
  return 0;
4655
4655
  }
@@ -8526,7 +8526,7 @@ var __publicField = (obj, key, value) => {
8526
8526
  const { message = "Unexpected error generating upload url" } = await res.json();
8527
8527
  throw new Error(message);
8528
8528
  }
8529
- const { signedUrl } = await res.json();
8529
+ const { signedUrl, requestId } = await res.json();
8530
8530
  if (!signedUrl) {
8531
8531
  throw new Error("Unexpected error generating upload url");
8532
8532
  }
@@ -8548,6 +8548,21 @@ var __publicField = (obj, key, value) => {
8548
8548
  throw new Error(`Upload error: '${matches[2]}'`);
8549
8549
  }
8550
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
+ }
8551
8566
  const src = `https://assets.tina.io/${this.api.clientId}/${path}`;
8552
8567
  newFiles.push({
8553
8568
  directory: item.directory,
@@ -8733,9 +8748,34 @@ var __publicField = (obj, key, value) => {
8733
8748
  const path = `${media.directory ? `${media.directory}/${media.filename}` : media.filename}`;
8734
8749
  if (!this.isLocal) {
8735
8750
  if (await this.isAuthenticated()) {
8736
- await this.api.authProvider.fetchWithToken(`${this.url}/${path}`, {
8737
- method: "DELETE"
8738
- });
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
+ }
8739
8779
  } else {
8740
8780
  throw E_UNAUTHORIZED;
8741
8781
  }
@@ -10516,8 +10556,13 @@ var __publicField = (obj, key, value) => {
10516
10556
  variant: "danger",
10517
10557
  onClick: async () => {
10518
10558
  setProcessing(true);
10519
- await deleteFunc();
10520
- close2();
10559
+ try {
10560
+ await deleteFunc();
10561
+ } catch (e) {
10562
+ console.error(e);
10563
+ } finally {
10564
+ close2();
10565
+ }
10521
10566
  }
10522
10567
  },
10523
10568
  /* @__PURE__ */ React.createElement("span", { className: "mr-1" }, "Delete"),
@@ -28468,6 +28513,16 @@ mutation addPendingDocumentMutation(
28468
28513
  const val = await res.json();
28469
28514
  return val;
28470
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
+ }
28471
28526
  async createPullRequest({
28472
28527
  baseBranch,
28473
28528
  branch,
package/dist/index.mjs CHANGED
@@ -4672,7 +4672,7 @@ const ComboboxDemo = ({
4672
4672
  {
4673
4673
  shouldFilter: !field.experimental___filter,
4674
4674
  filter: (value2, search) => {
4675
- if (value2.toLowerCase().replace(/\//g, "").includes(search.toLowerCase()))
4675
+ if (value2.toLowerCase().includes(search.toLowerCase()))
4676
4676
  return 1;
4677
4677
  return 0;
4678
4678
  }
@@ -8549,7 +8549,7 @@ class TinaMediaStore {
8549
8549
  const { message = "Unexpected error generating upload url" } = await res.json();
8550
8550
  throw new Error(message);
8551
8551
  }
8552
- const { signedUrl } = await res.json();
8552
+ const { signedUrl, requestId } = await res.json();
8553
8553
  if (!signedUrl) {
8554
8554
  throw new Error("Unexpected error generating upload url");
8555
8555
  }
@@ -8571,6 +8571,21 @@ class TinaMediaStore {
8571
8571
  throw new Error(`Upload error: '${matches[2]}'`);
8572
8572
  }
8573
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
+ }
8574
8589
  const src = `https://assets.tina.io/${this.api.clientId}/${path}`;
8575
8590
  newFiles.push({
8576
8591
  directory: item.directory,
@@ -8756,9 +8771,34 @@ class TinaMediaStore {
8756
8771
  const path = `${media.directory ? `${media.directory}/${media.filename}` : media.filename}`;
8757
8772
  if (!this.isLocal) {
8758
8773
  if (await this.isAuthenticated()) {
8759
- await this.api.authProvider.fetchWithToken(`${this.url}/${path}`, {
8760
- method: "DELETE"
8761
- });
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
+ }
8762
8802
  } else {
8763
8803
  throw E_UNAUTHORIZED;
8764
8804
  }
@@ -10539,8 +10579,13 @@ const DeleteModal$1 = ({
10539
10579
  variant: "danger",
10540
10580
  onClick: async () => {
10541
10581
  setProcessing(true);
10542
- await deleteFunc();
10543
- close2();
10582
+ try {
10583
+ await deleteFunc();
10584
+ } catch (e) {
10585
+ console.error(e);
10586
+ } finally {
10587
+ close2();
10588
+ }
10544
10589
  }
10545
10590
  },
10546
10591
  /* @__PURE__ */ React__default.createElement("span", { className: "mr-1" }, "Delete"),
@@ -28491,6 +28536,16 @@ mutation addPendingDocumentMutation(
28491
28536
  const val = await res.json();
28492
28537
  return val;
28493
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
+ }
28494
28549
  async createPullRequest({
28495
28550
  baseBranch,
28496
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.3",
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",