@tinacms/graphql 1.4.24 → 1.4.25

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
@@ -2585,7 +2585,7 @@ var validateField = async (field) => {
2585
2585
  // package.json
2586
2586
  var package_default = {
2587
2587
  name: "@tinacms/graphql",
2588
- version: "1.4.24",
2588
+ version: "1.4.25",
2589
2589
  main: "dist/index.js",
2590
2590
  module: "dist/index.mjs",
2591
2591
  typings: "dist/index.d.ts",
@@ -5134,7 +5134,18 @@ var Database = class {
5134
5134
  if (this.bridge) {
5135
5135
  await this.bridge.put(normalizedPath, stringifiedFile);
5136
5136
  }
5137
- await this.onPut(normalizedPath, stringifiedFile);
5137
+ try {
5138
+ await this.onPut(normalizedPath, stringifiedFile);
5139
+ } catch (e) {
5140
+ throw new import_graphql5.GraphQLError(
5141
+ `Error running onPut hook for ${filepath}: ${e}`,
5142
+ null,
5143
+ null,
5144
+ null,
5145
+ null,
5146
+ e
5147
+ );
5148
+ }
5138
5149
  const folderTreeBuilder = new FolderTreeBuilder();
5139
5150
  const folderKey = folderTreeBuilder.update(filepath, collection.path || "");
5140
5151
  const putOps = [
@@ -5229,7 +5240,18 @@ var Database = class {
5229
5240
  if (this.bridge) {
5230
5241
  await this.bridge.put(normalizedPath, stringifiedFile);
5231
5242
  }
5232
- await this.onPut(normalizedPath, stringifiedFile);
5243
+ try {
5244
+ await this.onPut(normalizedPath, stringifiedFile);
5245
+ } catch (e) {
5246
+ throw new import_graphql5.GraphQLError(
5247
+ `Error running onPut hook for ${filepath}: ${e}`,
5248
+ null,
5249
+ null,
5250
+ null,
5251
+ null,
5252
+ e
5253
+ );
5254
+ }
5233
5255
  const folderTreeBuilder = new FolderTreeBuilder();
5234
5256
  const folderKey = folderTreeBuilder.update(
5235
5257
  filepath,
@@ -5292,6 +5314,9 @@ var Database = class {
5292
5314
  }
5293
5315
  return true;
5294
5316
  } catch (error) {
5317
+ if (error instanceof import_graphql5.GraphQLError) {
5318
+ throw error;
5319
+ }
5295
5320
  throw new TinaFetchError(`Error in PUT for ${filepath}`, {
5296
5321
  originalError: error,
5297
5322
  file: filepath,
@@ -5794,7 +5819,18 @@ var Database = class {
5794
5819
  if (this.bridge) {
5795
5820
  await this.bridge.delete((0, import_schema_tools3.normalizePath)(filepath));
5796
5821
  }
5797
- await this.onDelete((0, import_schema_tools3.normalizePath)(filepath));
5822
+ try {
5823
+ await this.onDelete((0, import_schema_tools3.normalizePath)(filepath));
5824
+ } catch (e) {
5825
+ throw new import_graphql5.GraphQLError(
5826
+ `Error running onDelete hook for ${filepath}: ${e}`,
5827
+ null,
5828
+ null,
5829
+ null,
5830
+ null,
5831
+ e
5832
+ );
5833
+ }
5798
5834
  };
5799
5835
  this._indexAllContent = async (level, schema) => {
5800
5836
  const tinaSchema = await this.getSchema(level, schema);
package/dist/index.mjs CHANGED
@@ -2526,7 +2526,7 @@ var validateField = async (field) => {
2526
2526
  // package.json
2527
2527
  var package_default = {
2528
2528
  name: "@tinacms/graphql",
2529
- version: "1.4.24",
2529
+ version: "1.4.25",
2530
2530
  main: "dist/index.js",
2531
2531
  module: "dist/index.mjs",
2532
2532
  typings: "dist/index.d.ts",
@@ -5066,7 +5066,18 @@ var Database = class {
5066
5066
  if (this.bridge) {
5067
5067
  await this.bridge.put(normalizedPath, stringifiedFile);
5068
5068
  }
5069
- await this.onPut(normalizedPath, stringifiedFile);
5069
+ try {
5070
+ await this.onPut(normalizedPath, stringifiedFile);
5071
+ } catch (e) {
5072
+ throw new GraphQLError4(
5073
+ `Error running onPut hook for ${filepath}: ${e}`,
5074
+ null,
5075
+ null,
5076
+ null,
5077
+ null,
5078
+ e
5079
+ );
5080
+ }
5070
5081
  const folderTreeBuilder = new FolderTreeBuilder();
5071
5082
  const folderKey = folderTreeBuilder.update(filepath, collection.path || "");
5072
5083
  const putOps = [
@@ -5160,7 +5171,18 @@ var Database = class {
5160
5171
  if (this.bridge) {
5161
5172
  await this.bridge.put(normalizedPath, stringifiedFile);
5162
5173
  }
5163
- await this.onPut(normalizedPath, stringifiedFile);
5174
+ try {
5175
+ await this.onPut(normalizedPath, stringifiedFile);
5176
+ } catch (e) {
5177
+ throw new GraphQLError4(
5178
+ `Error running onPut hook for ${filepath}: ${e}`,
5179
+ null,
5180
+ null,
5181
+ null,
5182
+ null,
5183
+ e
5184
+ );
5185
+ }
5164
5186
  const folderTreeBuilder = new FolderTreeBuilder();
5165
5187
  const folderKey = folderTreeBuilder.update(
5166
5188
  filepath,
@@ -5223,6 +5245,9 @@ var Database = class {
5223
5245
  }
5224
5246
  return true;
5225
5247
  } catch (error) {
5248
+ if (error instanceof GraphQLError4) {
5249
+ throw error;
5250
+ }
5226
5251
  throw new TinaFetchError(`Error in PUT for ${filepath}`, {
5227
5252
  originalError: error,
5228
5253
  file: filepath,
@@ -5724,7 +5749,18 @@ var Database = class {
5724
5749
  if (this.bridge) {
5725
5750
  await this.bridge.delete(normalizePath(filepath));
5726
5751
  }
5727
- await this.onDelete(normalizePath(filepath));
5752
+ try {
5753
+ await this.onDelete(normalizePath(filepath));
5754
+ } catch (e) {
5755
+ throw new GraphQLError4(
5756
+ `Error running onDelete hook for ${filepath}: ${e}`,
5757
+ null,
5758
+ null,
5759
+ null,
5760
+ null,
5761
+ e
5762
+ );
5763
+ }
5728
5764
  };
5729
5765
  this._indexAllContent = async (level, schema) => {
5730
5766
  const tinaSchema = await this.getSchema(level, schema);
@@ -52,9 +52,7 @@ export declare class Resolver {
52
52
  constructor(init: ResolverConfig);
53
53
  resolveCollection: (args: any, collectionName: string, hasDocuments?: boolean) => Promise<{
54
54
  fields: TinaField<true>[];
55
- templates?: undefined; /**
56
- * updateDocument, update<Collection>Document
57
- */
55
+ templates?: undefined;
58
56
  label?: string;
59
57
  name: string;
60
58
  path: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "1.4.24",
3
+ "version": "1.4.25",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "typings": "dist/index.d.ts",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@iarna/toml": "^2.2.5",
27
- "@tinacms/mdx": "1.3.17",
28
- "@tinacms/schema-tools": "1.4.11",
27
+ "@tinacms/mdx": "1.3.18",
28
+ "@tinacms/schema-tools": "1.4.12",
29
29
  "abstract-level": "^1.0.3",
30
30
  "body-parser": "^1.19.0",
31
31
  "cors": "^2.8.5",
@@ -57,7 +57,7 @@
57
57
  "directory": "packages/tina-graphql"
58
58
  },
59
59
  "devDependencies": {
60
- "@tinacms/schema-tools": "1.4.11",
60
+ "@tinacms/schema-tools": "1.4.12",
61
61
  "@tinacms/scripts": "1.1.2",
62
62
  "@types/cors": "^2.8.7",
63
63
  "@types/estree": "^0.0.50",