tinacms 0.68.13 → 0.68.14

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/client.es.js CHANGED
@@ -36,9 +36,7 @@ class TinaClient {
36
36
  };
37
37
  this.apiUrl = url;
38
38
  this.readonlyToken = token;
39
- if (queries) {
40
- this.queries = queries(this);
41
- }
39
+ this.queries = queries(this);
42
40
  }
43
41
  async request(args) {
44
42
  const headers = new Headers();
@@ -57,9 +55,18 @@ class TinaClient {
57
55
  body: bodyString,
58
56
  redirect: "follow"
59
57
  });
58
+ if (!res.ok) {
59
+ let additionalInfo = "";
60
+ if (res.status === 401) {
61
+ additionalInfo = "Please check that your client ID, URL and read only token are configured properly.";
62
+ }
63
+ throw new Error(`Server responded with status code ${res.status}, ${res.statusText}. ${additionalInfo ? additionalInfo : ""} Please see our FAQ for more information: https://tina.io/docs/errors/faq/`);
64
+ }
60
65
  const json = await res.json();
61
66
  if (json.errors) {
62
- throw new Error(`Unable to fetch, errors:
67
+ throw new Error(`Unable to fetch, please see our FAQ for more information: https://tina.io/docs/errors/faq/
68
+
69
+ Errors:
63
70
  ${json.errors.map((error) => error.message).join("\n")}`);
64
71
  }
65
72
  return {
package/dist/client.js CHANGED
@@ -43,9 +43,7 @@
43
43
  };
44
44
  this.apiUrl = url;
45
45
  this.readonlyToken = token;
46
- if (queries) {
47
- this.queries = queries(this);
48
- }
46
+ this.queries = queries(this);
49
47
  }
50
48
  async request(args) {
51
49
  const headers = new Headers();
@@ -64,9 +62,18 @@
64
62
  body: bodyString,
65
63
  redirect: "follow"
66
64
  });
65
+ if (!res.ok) {
66
+ let additionalInfo = "";
67
+ if (res.status === 401) {
68
+ additionalInfo = "Please check that your client ID, URL and read only token are configured properly.";
69
+ }
70
+ throw new Error(`Server responded with status code ${res.status}, ${res.statusText}. ${additionalInfo ? additionalInfo : ""} Please see our FAQ for more information: https://tina.io/docs/errors/faq/`);
71
+ }
67
72
  const json = await res.json();
68
73
  if (json.errors) {
69
- throw new Error(`Unable to fetch, errors:
74
+ throw new Error(`Unable to fetch, please see our FAQ for more information: https://tina.io/docs/errors/faq/
75
+
76
+ Errors:
70
77
  ${json.errors.map((error) => error.message).join("\n")}`);
71
78
  }
72
79
  return {
package/dist/index.es.js CHANGED
@@ -2459,7 +2459,6 @@ class TinaAdminApi {
2459
2459
  constructor(cms) {
2460
2460
  this.api = cms.api.tina;
2461
2461
  this.schema = cms.api.tina.schema;
2462
- this.useDataLayer = cms.flags.get("experimentalData");
2463
2462
  }
2464
2463
  async isAuthenticated() {
2465
2464
  return await this.api.isAuthenticated();
@@ -2486,9 +2485,8 @@ class TinaAdminApi {
2486
2485
  }
2487
2486
  async fetchCollection(collectionName, includeDocuments, after) {
2488
2487
  if (includeDocuments === true) {
2489
- if (this.useDataLayer) {
2490
- const sort = this.schema.getIsTitleFieldName(collectionName);
2491
- const response = await this.api.request(`#graphql
2488
+ const sort = this.schema.getIsTitleFieldName(collectionName);
2489
+ const response = await this.api.request(`#graphql
2492
2490
  query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String){
2493
2491
  collection(collection: $collection){
2494
2492
  name
@@ -2522,45 +2520,15 @@ class TinaAdminApi {
2522
2520
  }
2523
2521
  }
2524
2522
  }`, {
2525
- variables: {
2526
- collection: collectionName,
2527
- includeDocuments,
2528
- sort,
2529
- limit: 10,
2530
- after
2531
- }
2532
- });
2533
- return response.collection;
2534
- } else {
2535
- const response = await this.api.request(`#graphql
2536
- query($collection: String!, $includeDocuments: Boolean!){
2537
- collection(collection: $collection){
2538
- name
2539
- label
2540
- format
2541
- templates
2542
- documents @include(if: $includeDocuments) {
2543
- totalCount
2544
- edges {
2545
- node {
2546
- ... on Document {
2547
- _sys {
2548
- template
2549
- breadcrumbs
2550
- path
2551
- basename
2552
- relativePath
2553
- filename
2554
- extension
2555
- }
2556
- }
2557
- }
2558
- }
2523
+ variables: {
2524
+ collection: collectionName,
2525
+ includeDocuments,
2526
+ sort,
2527
+ limit: 10,
2528
+ after
2559
2529
  }
2560
- }
2561
- }`, { variables: { collection: collectionName, includeDocuments } });
2562
- return response.collection;
2563
- }
2530
+ });
2531
+ return response.collection;
2564
2532
  } else {
2565
2533
  try {
2566
2534
  const collection = this.schema.getCollection(collectionName);
@@ -4825,7 +4793,6 @@ const CollectionListPage = () => {
4825
4793
  const documents = collection.documents.edges;
4826
4794
  const admin = cms.api.admin;
4827
4795
  const pageInfo = collection.documents.pageInfo;
4828
- const useDataFlag = cms.flags.get("experimentalData");
4829
4796
  return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, open && /* @__PURE__ */ React.createElement(DeleteModal, {
4830
4797
  filename: vars.relativePath,
4831
4798
  deleteFunc: async () => {
@@ -4928,7 +4895,7 @@ const CollectionListPage = () => {
4928
4895
  }
4929
4896
  ]
4930
4897
  })));
4931
- }))), useDataFlag && /* @__PURE__ */ React.createElement("div", {
4898
+ }))), /* @__PURE__ */ React.createElement("div", {
4932
4899
  className: "pt-3"
4933
4900
  }, /* @__PURE__ */ React.createElement(CursorPaginator, {
4934
4901
  variant: "white",
package/dist/index.js CHANGED
@@ -2477,7 +2477,6 @@ mutation addPendingDocumentMutation(
2477
2477
  constructor(cms) {
2478
2478
  this.api = cms.api.tina;
2479
2479
  this.schema = cms.api.tina.schema;
2480
- this.useDataLayer = cms.flags.get("experimentalData");
2481
2480
  }
2482
2481
  async isAuthenticated() {
2483
2482
  return await this.api.isAuthenticated();
@@ -2504,9 +2503,8 @@ mutation addPendingDocumentMutation(
2504
2503
  }
2505
2504
  async fetchCollection(collectionName, includeDocuments, after) {
2506
2505
  if (includeDocuments === true) {
2507
- if (this.useDataLayer) {
2508
- const sort = this.schema.getIsTitleFieldName(collectionName);
2509
- const response = await this.api.request(`#graphql
2506
+ const sort = this.schema.getIsTitleFieldName(collectionName);
2507
+ const response = await this.api.request(`#graphql
2510
2508
  query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String){
2511
2509
  collection(collection: $collection){
2512
2510
  name
@@ -2540,45 +2538,15 @@ mutation addPendingDocumentMutation(
2540
2538
  }
2541
2539
  }
2542
2540
  }`, {
2543
- variables: {
2544
- collection: collectionName,
2545
- includeDocuments,
2546
- sort,
2547
- limit: 10,
2548
- after
2549
- }
2550
- });
2551
- return response.collection;
2552
- } else {
2553
- const response = await this.api.request(`#graphql
2554
- query($collection: String!, $includeDocuments: Boolean!){
2555
- collection(collection: $collection){
2556
- name
2557
- label
2558
- format
2559
- templates
2560
- documents @include(if: $includeDocuments) {
2561
- totalCount
2562
- edges {
2563
- node {
2564
- ... on Document {
2565
- _sys {
2566
- template
2567
- breadcrumbs
2568
- path
2569
- basename
2570
- relativePath
2571
- filename
2572
- extension
2573
- }
2574
- }
2575
- }
2541
+ variables: {
2542
+ collection: collectionName,
2543
+ includeDocuments,
2544
+ sort,
2545
+ limit: 10,
2546
+ after
2576
2547
  }
2577
- }
2578
- }
2579
- }`, { variables: { collection: collectionName, includeDocuments } });
2580
- return response.collection;
2581
- }
2548
+ });
2549
+ return response.collection;
2582
2550
  } else {
2583
2551
  try {
2584
2552
  const collection = this.schema.getCollection(collectionName);
@@ -4843,7 +4811,6 @@ This will work when developing locally but NOT when deployed to production.
4843
4811
  const documents = collection.documents.edges;
4844
4812
  const admin = cms.api.admin;
4845
4813
  const pageInfo = collection.documents.pageInfo;
4846
- const useDataFlag = cms.flags.get("experimentalData");
4847
4814
  return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, open && /* @__PURE__ */ React__default["default"].createElement(DeleteModal, {
4848
4815
  filename: vars.relativePath,
4849
4816
  deleteFunc: async () => {
@@ -4946,7 +4913,7 @@ This will work when developing locally but NOT when deployed to production.
4946
4913
  }
4947
4914
  ]
4948
4915
  })));
4949
- }))), useDataFlag && /* @__PURE__ */ React__default["default"].createElement("div", {
4916
+ }))), /* @__PURE__ */ React__default["default"].createElement("div", {
4950
4917
  className: "pt-3"
4951
4918
  }, /* @__PURE__ */ React__default["default"].createElement(toolkit.CursorPaginator, {
4952
4919
  variant: "white",
@@ -43,7 +43,7 @@ declare type APIProviderProps = {
43
43
  */
44
44
  branch?: never;
45
45
  /**
46
- * Your clientID from tina.aio
46
+ * Your clientId from tina.io
47
47
  *
48
48
  * @deprecated use apiURL instead
49
49
  */
@@ -73,41 +73,11 @@ declare type APIProviderProps = {
73
73
  */
74
74
  branch?: never;
75
75
  /**
76
- * Your clientID from tina.aio
76
+ * Your clientId from tina.io
77
77
  *
78
78
  * @deprecated use apiURL instead
79
79
  */
80
80
  clientId?: never;
81
- } | {
82
- /**
83
- * Content API URL
84
- *
85
- */
86
- apiURL?: never;
87
- /**
88
- * Point to the local version of GraphQL instead of tina.io
89
- * https://tina.io/docs/tinacms-context/#adding-tina-to-the-sites-frontend
90
- *
91
- * @deprecated use apiURL instead
92
- */
93
- isLocalClient?: boolean;
94
- /**
95
- * The base branch to pull content from. Note that this is ignored for local development
96
- *
97
- * @deprecated use apiURL instead
98
- */
99
- branch?: string;
100
- /**
101
- * Your clientID from tina.aio
102
- *
103
- * @deprecated use apiURL instead
104
- */
105
- clientId?: string;
106
- /**
107
- * The API url From this client will be used to make requests.
108
- *
109
- */
110
- client: never;
111
81
  };
112
82
  interface BaseProviderProps {
113
83
  /** Callback if you need access to the TinaCMS instance */
@@ -14,7 +14,7 @@ export declare const TINA_HOST = "content.tinajs.io";
14
14
  export interface TinaClientArgs<GenQueries = Record<string, unknown>> {
15
15
  url: string;
16
16
  token?: string;
17
- queries?: (client: TinaClient<GenQueries>) => GenQueries;
17
+ queries: (client: TinaClient<GenQueries>) => GenQueries;
18
18
  }
19
19
  export declare type TinaClientRequestArgs = {
20
20
  variables?: Record<string, any>;
@@ -32,7 +32,7 @@ export declare class TinaClient<GenQueries> {
32
32
  /**
33
33
  *
34
34
  */
35
- queries?: GenQueries;
35
+ queries: GenQueries;
36
36
  constructor({ token, url, queries }: TinaClientArgs<GenQueries>);
37
37
  request<DataType extends Record<string, any> = any>(args: TinaClientRequestArgs): Promise<{
38
38
  data: DataType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.68.13",
3
+ "version": "0.68.14",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {
@@ -43,9 +43,9 @@
43
43
  "@headlessui/react": "^1.5.0",
44
44
  "@heroicons/react": "^1.0.4",
45
45
  "@react-hook/window-size": "^3.0.7",
46
- "@tinacms/schema-tools": "0.0.8",
46
+ "@tinacms/schema-tools": "0.0.9",
47
47
  "@tinacms/sharedctx": "0.1.2",
48
- "@tinacms/toolkit": "0.56.35",
48
+ "@tinacms/toolkit": "0.56.36",
49
49
  "crypto-js": "^4.0.0",
50
50
  "fetch-ponyfill": "^7.1.0",
51
51
  "final-form": "4.20.1",