@tinacms/graphql 0.0.0-202251418421 → 0.0.0-2022514212340

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/CHANGELOG.md CHANGED
@@ -1,13 +1,16 @@
1
1
  # tina-graphql
2
2
 
3
- ## 0.0.0-202251418421
3
+ ## 0.0.0-2022514212340
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - f6cb634c2: Added an optional config key to the schema that will be used for tina cloud media store
8
+ - b1a4290e6: Use media config from the schema in the local media server
9
+ - 1955b8842: Uses new `schema.config` when resolving media/asset urls
10
+ - 8b81c3cf3: Added more context to error messages to help to user debug issues
8
11
  - Updated dependencies [f6cb634c2]
9
- - @tinacms/schema-tools@0.0.0-202251418421
10
- - @tinacms/datalayer@0.0.0-202251418421
12
+ - @tinacms/schema-tools@0.0.0-2022514212340
13
+ - @tinacms/datalayer@0.0.0-2022514212340
11
14
 
12
15
  ## 0.60.6
13
16
 
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ limitations under the License.
12
12
  */
13
13
  export { indexDB } from './build';
14
14
  export { resolve } from './resolve';
15
+ export * from './resolver/error';
15
16
  export { createDatabase } from './database';
16
17
  export type { QueryOptions } from './database';
17
18
  import type { Database } from './database';
package/dist/index.js CHANGED
@@ -10384,9 +10384,14 @@ var require_remark_mdx = __commonJS({
10384
10384
 
10385
10385
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/index.ts
10386
10386
  __export(exports, {
10387
+ TinaFetchError: () => TinaFetchError,
10388
+ TinaGraphQLError: () => TinaGraphQLError,
10389
+ TinaParseDocumentError: () => TinaParseDocumentError,
10390
+ TinaQueryError: () => TinaQueryError,
10387
10391
  assertShape: () => assertShape,
10388
10392
  buildSchema: () => buildSchema,
10389
10393
  createDatabase: () => createDatabase,
10394
+ handleFetchErrorError: () => handleFetchErrorError,
10390
10395
  indexDB: () => indexDB,
10391
10396
  parseFile: () => parseFile,
10392
10397
  resolve: () => resolve,
@@ -12830,15 +12835,52 @@ var package_default = {
12830
12835
  };
12831
12836
 
12832
12837
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/resolver/error.ts
12833
- var TinaError = class extends Error {
12838
+ var TinaGraphQLError = class extends Error {
12834
12839
  constructor(message, extensions) {
12835
12840
  super(message);
12836
12841
  if (!this.name) {
12837
- Object.defineProperty(this, "name", { value: "TinaError" });
12842
+ Object.defineProperty(this, "name", { value: "TinaGraphQLError" });
12838
12843
  }
12839
12844
  this.extensions = __spreadValues({}, extensions);
12840
12845
  }
12841
12846
  };
12847
+ var TinaFetchError = class extends Error {
12848
+ constructor(message, args) {
12849
+ super(message);
12850
+ this.name = "TinaFetchError";
12851
+ this.collection = args.collection;
12852
+ this.stack = args.stack;
12853
+ this.file = args.file;
12854
+ this.originalError = args.originalError;
12855
+ }
12856
+ };
12857
+ var TinaQueryError = class extends TinaFetchError {
12858
+ constructor(args) {
12859
+ super(`Error querying file ${args.file} collection ${args.collection}. Please run "tinacms audit" or add the --verbose option for more info`, args);
12860
+ }
12861
+ };
12862
+ var TinaParseDocumentError = class extends TinaFetchError {
12863
+ constructor(args) {
12864
+ super(`Error Parsing file ${args.file} collection ${args.collection}. Please run "tinacms audit" or add the --verbose option for more info`, args);
12865
+ }
12866
+ toString() {
12867
+ return super.toString() + "\n OriginalError: \n" + this.originalError.toString();
12868
+ }
12869
+ };
12870
+ var handleFetchErrorError = (e, verbose) => {
12871
+ if (e instanceof Error) {
12872
+ if (e instanceof TinaFetchError) {
12873
+ if (verbose) {
12874
+ console.log(e.toString());
12875
+ console.log(e);
12876
+ console.log(e.stack);
12877
+ }
12878
+ }
12879
+ } else {
12880
+ console.error(e);
12881
+ }
12882
+ throw e;
12883
+ };
12842
12884
 
12843
12885
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/schema/index.ts
12844
12886
  var createSchema = async ({
@@ -12951,7 +12993,7 @@ var TinaSchema = class {
12951
12993
  assertShape(data, (yup3) => yup3.object({ _template: yup3.string().required() }));
12952
12994
  const template = templateInfo.templates.find((template2) => template2.namespace[template2.namespace.length - 1] === data._template);
12953
12995
  if (!template) {
12954
- throw new TinaError(`Expected to find template named '${data._template}' for collection '${lastItem(collection.namespace)}'`, {
12996
+ throw new TinaGraphQLError(`Expected to find template named '${data._template}' for collection '${lastItem(collection.namespace)}'`, {
12955
12997
  collection: lastItem(collection.namespace),
12956
12998
  possibleTemplates: templateInfo.templates.map((template2) => lastItem(template2.namespace)),
12957
12999
  data
@@ -20436,40 +20478,60 @@ var visit = function(tree, test, visitor, reverse) {
20436
20478
  var import_lodash4 = __toModule(require("lodash"));
20437
20479
 
20438
20480
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/resolver/media-utils.ts
20439
- var resolveMediaCloudToRelative = (value, config = { useRelativeMedia: true }) => {
20481
+ var resolveMediaCloudToRelative = (value, config = { useRelativeMedia: true }, schema) => {
20440
20482
  if (config && value) {
20441
20483
  if (config.useRelativeMedia === true) {
20442
20484
  return value;
20443
- } else {
20485
+ }
20486
+ if (hasTinaMediaConfig(schema) === true) {
20444
20487
  const assetsURL = `https://${config.assetsHost}/${config.clientId}`;
20445
20488
  if (typeof value === "string" && value.includes(assetsURL)) {
20446
- return value.replace(assetsURL, "");
20447
- } else {
20448
- return value;
20489
+ const cleanSyncFolder = cleanUpSlashes(schema.config.media.tina.syncFolder);
20490
+ const strippedURL = value.replace(assetsURL, "");
20491
+ return `${cleanSyncFolder}${strippedURL}`;
20449
20492
  }
20493
+ return value;
20450
20494
  }
20495
+ return value;
20451
20496
  } else {
20452
20497
  return value;
20453
20498
  }
20454
20499
  };
20455
- var resolveMediaRelativeToCloud = (value, config = { useRelativeMedia: true }) => {
20500
+ var resolveMediaRelativeToCloud = (value, config = { useRelativeMedia: true }, schema) => {
20456
20501
  if (config && value) {
20457
20502
  if (config.useRelativeMedia === true) {
20458
20503
  return value;
20459
- } else {
20460
- return `https://${config.assetsHost}/${config.clientId}${value}`;
20461
20504
  }
20505
+ if (hasTinaMediaConfig(schema) === true) {
20506
+ const cleanSyncFolder = cleanUpSlashes(schema.config.media.tina.syncFolder);
20507
+ const strippedValue = value.replace(cleanSyncFolder, "");
20508
+ return `https://${config.assetsHost}/${config.clientId}${strippedValue}`;
20509
+ }
20510
+ return value;
20462
20511
  } else {
20463
20512
  return value;
20464
20513
  }
20465
20514
  };
20515
+ var cleanUpSlashes = (path6) => {
20516
+ if (path6) {
20517
+ return `/${path6.replace(/^\/+|\/+$/gm, "")}`;
20518
+ }
20519
+ return "";
20520
+ };
20521
+ var hasTinaMediaConfig = (schema) => {
20522
+ var _a, _b, _c, _d, _e, _f;
20523
+ if (((_c = (_b = (_a = schema.config) == null ? void 0 : _a.media) == null ? void 0 : _b.tina) == null ? void 0 : _c.publicFolder) && ((_f = (_e = (_d = schema.config) == null ? void 0 : _d.media) == null ? void 0 : _e.tina) == null ? void 0 : _f.syncFolder)) {
20524
+ return true;
20525
+ }
20526
+ return false;
20527
+ };
20466
20528
 
20467
20529
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/mdx/parse.ts
20468
- var parseMDX = (value, field, graphQLconfig) => {
20530
+ var parseMDX = (value, field, graphQLconfig, schema) => {
20469
20531
  const tree = unified().use(remark_parse_default).use(import_remark_mdx.default).parse(value);
20470
- return parseMDXInner(tree, field, graphQLconfig);
20532
+ return parseMDXInner(tree, field, graphQLconfig, schema);
20471
20533
  };
20472
- var parseMDXInner = (tree, field, graphQLconfig) => {
20534
+ var parseMDXInner = (tree, field, graphQLconfig, schema) => {
20473
20535
  visit(tree, (node) => {
20474
20536
  delete node.position;
20475
20537
  });
@@ -20477,7 +20539,7 @@ var parseMDXInner = (tree, field, graphQLconfig) => {
20477
20539
  var _a;
20478
20540
  let props = {};
20479
20541
  if (!node.name) {
20480
- props = parseMDXInner({ type: "root", children: node.children }, field, graphQLconfig);
20542
+ props = parseMDXInner({ type: "root", children: node.children }, field, graphQLconfig, schema);
20481
20543
  }
20482
20544
  const template = (_a = field.templates) == null ? void 0 : _a.find((template2) => {
20483
20545
  const templateName = typeof template2 === "string" ? template2 : template2.name;
@@ -20508,7 +20570,7 @@ var parseMDXInner = (tree, field, graphQLconfig) => {
20508
20570
  if (!field2) {
20509
20571
  throw new Error(`Unknown property '${attribute.name}' for embedded structure '${node.name}'`);
20510
20572
  }
20511
- parseField(attribute, field2, props, graphQLconfig);
20573
+ parseField(attribute, field2, props, graphQLconfig, schema);
20512
20574
  }
20513
20575
  } else {
20514
20576
  console.log(`Not sure what this is, type: ${attribute.type}`);
@@ -20517,10 +20579,10 @@ var parseMDXInner = (tree, field, graphQLconfig) => {
20517
20579
  delete node.attributes;
20518
20580
  node.props = props;
20519
20581
  });
20520
- const slateTree = tree.children.map((node) => remarkToSlate(node, graphQLconfig));
20582
+ const slateTree = tree.children.map((node) => remarkToSlate(node, graphQLconfig, schema));
20521
20583
  return { type: "root", children: slateTree };
20522
20584
  };
20523
- var parseField = (attribute, field, props, graphQLconfig) => {
20585
+ var parseField = (attribute, field, props, graphQLconfig, schema) => {
20524
20586
  var _a, _b;
20525
20587
  switch (field.type) {
20526
20588
  case "boolean":
@@ -20528,7 +20590,7 @@ var parseField = (attribute, field, props, graphQLconfig) => {
20528
20590
  props[field.name] = attribute.value;
20529
20591
  break;
20530
20592
  case "image":
20531
- props[field.name] = resolveMediaRelativeToCloud(attribute.value, graphQLconfig);
20593
+ props[field.name] = resolveMediaRelativeToCloud(attribute.value, graphQLconfig, schema);
20532
20594
  break;
20533
20595
  case "number":
20534
20596
  case "string":
@@ -20591,7 +20653,7 @@ var parseField = (attribute, field, props, graphQLconfig) => {
20591
20653
  throw new Error(`Global fields not supported at this time`);
20592
20654
  }
20593
20655
  field.fields.forEach((field2) => {
20594
- parseField(property, field2, objectProps, graphQLconfig);
20656
+ parseField(property, field2, objectProps, graphQLconfig, schema);
20595
20657
  });
20596
20658
  }
20597
20659
  });
@@ -20613,7 +20675,7 @@ var parseField = (attribute, field, props, graphQLconfig) => {
20613
20675
  throw new Error(`Global fields not supported at this time`);
20614
20676
  }
20615
20677
  field.fields.forEach((field2) => {
20616
- parseField(property, field2, objectProps, graphQLconfig);
20678
+ parseField(property, field2, objectProps, graphQLconfig, schema);
20617
20679
  });
20618
20680
  }
20619
20681
  if (field.templates) {
@@ -20622,7 +20684,7 @@ var parseField = (attribute, field, props, graphQLconfig) => {
20622
20684
  throw new Error(`Global fields not supported at this time`);
20623
20685
  }
20624
20686
  fieldTemplate.fields.forEach((field2) => {
20625
- parseField(property, field2, objectProps, graphQLconfig);
20687
+ parseField(property, field2, objectProps, graphQLconfig, schema);
20626
20688
  });
20627
20689
  });
20628
20690
  }
@@ -20645,13 +20707,13 @@ var parseField = (attribute, field, props, graphQLconfig) => {
20645
20707
  if (attribute.value) {
20646
20708
  if (field.name === "children") {
20647
20709
  if (Array.isArray(attribute.value)) {
20648
- props[field.name] = parseMDXInner({ type: "root", children: attribute.value }, field, graphQLconfig);
20710
+ props[field.name] = parseMDXInner({ type: "root", children: attribute.value }, field, graphQLconfig, schema);
20649
20711
  } else {
20650
20712
  throw Error(`Expected an array of MDX strings for rich-text field with the special name 'children'`);
20651
20713
  }
20652
20714
  } else {
20653
20715
  try {
20654
- const mdx2 = parseMDX(attribute.value.value, field, graphQLconfig);
20716
+ const mdx2 = parseMDX(attribute.value.value, field, graphQLconfig, schema);
20655
20717
  props[field.name] = mdx2.children[0].props;
20656
20718
  } catch (e) {
20657
20719
  console.log(e);
@@ -20722,7 +20784,7 @@ var defaultNodeTypes = {
20722
20784
  break: "break",
20723
20785
  image: plateElements.ELEMENT_IMAGE
20724
20786
  };
20725
- function remarkToSlate(node, graphQLconfig) {
20787
+ function remarkToSlate(node, graphQLconfig, schema) {
20726
20788
  const types = __spreadProps(__spreadValues({}, defaultNodeTypes), {
20727
20789
  heading: __spreadValues({}, defaultNodeTypes.heading)
20728
20790
  });
@@ -20730,12 +20792,12 @@ function remarkToSlate(node, graphQLconfig) {
20730
20792
  case "heading":
20731
20793
  return {
20732
20794
  type: types.heading[node.depth],
20733
- children: node.children.map((node2) => remarkToSlate(node2, graphQLconfig))
20795
+ children: node.children.map((node2) => remarkToSlate(node2, graphQLconfig, schema))
20734
20796
  };
20735
20797
  case "list":
20736
20798
  return {
20737
20799
  type: node.ordered ? types.ol_list : types.ul_list,
20738
- children: node.children.map((node2) => remarkToSlate(node2, graphQLconfig))
20800
+ children: node.children.map((node2) => remarkToSlate(node2, graphQLconfig, schema))
20739
20801
  };
20740
20802
  case "listItem":
20741
20803
  const realChildren = [];
@@ -20743,12 +20805,12 @@ function remarkToSlate(node, graphQLconfig) {
20743
20805
  if (child.type === "list") {
20744
20806
  realChildren.push({
20745
20807
  type: child.ordered ? types.ol_list : types.ul_list,
20746
- children: child.children.map((node2) => remarkToSlate(node2, graphQLconfig))
20808
+ children: child.children.map((node2) => remarkToSlate(node2, graphQLconfig, schema))
20747
20809
  });
20748
20810
  } else {
20749
20811
  realChildren.push({
20750
20812
  type: plateElements.ELEMENT_LIC,
20751
- children: child.children.map((node2) => remarkToSlate(node2, graphQLconfig))
20813
+ children: child.children.map((node2) => remarkToSlate(node2, graphQLconfig, schema))
20752
20814
  });
20753
20815
  }
20754
20816
  });
@@ -20759,16 +20821,16 @@ function remarkToSlate(node, graphQLconfig) {
20759
20821
  case "paragraph":
20760
20822
  return {
20761
20823
  type: types.paragraph,
20762
- children: node.children.map((node2) => remarkToSlate(node2, graphQLconfig))
20824
+ children: node.children.map((node2) => remarkToSlate(node2, graphQLconfig, schema))
20763
20825
  };
20764
20826
  case "link":
20765
20827
  return {
20766
20828
  type: types.link,
20767
20829
  url: node.url,
20768
- children: node.children.map((node2) => remarkToSlate(node2, graphQLconfig))
20830
+ children: node.children.map((node2) => remarkToSlate(node2, graphQLconfig, schema))
20769
20831
  };
20770
20832
  case "image":
20771
- const url = resolveMediaRelativeToCloud(node.url, graphQLconfig);
20833
+ const url = resolveMediaRelativeToCloud(node.url, graphQLconfig, schema);
20772
20834
  return {
20773
20835
  type: types.image,
20774
20836
  url,
@@ -20778,7 +20840,7 @@ function remarkToSlate(node, graphQLconfig) {
20778
20840
  case "blockquote":
20779
20841
  return {
20780
20842
  type: types.block_quote,
20781
- children: node.children.map((node2) => remarkToSlate(node2, graphQLconfig))
20843
+ children: node.children.map((node2) => remarkToSlate(node2, graphQLconfig, schema))
20782
20844
  };
20783
20845
  case "code":
20784
20846
  return {
@@ -22239,10 +22301,10 @@ var mdxToMarkdown = {
22239
22301
  };
22240
22302
 
22241
22303
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/mdx/stringify.ts
22242
- var stringifyMDX = (value, field, graphQLconfig) => {
22304
+ var stringifyMDX = (value, field, graphQLconfig, schema) => {
22243
22305
  const slateTree = value.children;
22244
22306
  try {
22245
- const tree = stringifyChildren(slateTree, field, graphQLconfig);
22307
+ const tree = stringifyChildren(slateTree, field, graphQLconfig, schema);
22246
22308
  const out = toMarkdown({
22247
22309
  type: "root",
22248
22310
  children: tree
@@ -22260,13 +22322,13 @@ var allChildrenEmpty = (children) => {
22260
22322
  }
22261
22323
  return false;
22262
22324
  };
22263
- var stringifyChildren = (children, field, graphQLconfig) => {
22325
+ var stringifyChildren = (children, field, graphQLconfig, schema) => {
22264
22326
  if (!children) {
22265
22327
  return [];
22266
22328
  }
22267
- return children.map((child) => stringify(child, field, graphQLconfig)).filter(Boolean);
22329
+ return children.map((child) => stringify(child, field, graphQLconfig, schema)).filter(Boolean);
22268
22330
  };
22269
- var stringify = (node, field, graphQLconfig) => {
22331
+ var stringify = (node, field, graphQLconfig, schema) => {
22270
22332
  var _a;
22271
22333
  if (!node.type) {
22272
22334
  if (node == null ? void 0 : node.code) {
@@ -22292,40 +22354,40 @@ var stringify = (node, field, graphQLconfig) => {
22292
22354
  return {
22293
22355
  type: "heading",
22294
22356
  depth: 1,
22295
- children: stringifyChildren(node.children, field, graphQLconfig)
22357
+ children: stringifyChildren(node.children, field, graphQLconfig, schema)
22296
22358
  };
22297
22359
  case plateElements.ELEMENT_H2:
22298
22360
  return {
22299
22361
  type: "heading",
22300
22362
  depth: 2,
22301
- children: stringifyChildren(node.children, field, graphQLconfig)
22363
+ children: stringifyChildren(node.children, field, graphQLconfig, schema)
22302
22364
  };
22303
22365
  case plateElements.ELEMENT_H3:
22304
22366
  return {
22305
22367
  type: "heading",
22306
22368
  depth: 3,
22307
- children: stringifyChildren(node.children, field, graphQLconfig)
22369
+ children: stringifyChildren(node.children, field, graphQLconfig, schema)
22308
22370
  };
22309
22371
  case plateElements.ELEMENT_H4:
22310
22372
  return {
22311
22373
  type: "heading",
22312
22374
  depth: 4,
22313
- children: stringifyChildren(node.children, field, graphQLconfig)
22375
+ children: stringifyChildren(node.children, field, graphQLconfig, schema)
22314
22376
  };
22315
22377
  case plateElements.ELEMENT_H5:
22316
22378
  return {
22317
22379
  type: "heading",
22318
22380
  depth: 5,
22319
- children: stringifyChildren(node.children, field, graphQLconfig)
22381
+ children: stringifyChildren(node.children, field, graphQLconfig, schema)
22320
22382
  };
22321
22383
  case plateElements.ELEMENT_H6:
22322
22384
  return {
22323
22385
  type: "heading",
22324
22386
  depth: 6,
22325
- children: stringifyChildren(node.children, field, graphQLconfig)
22387
+ children: stringifyChildren(node.children, field, graphQLconfig, schema)
22326
22388
  };
22327
22389
  case plateElements.ELEMENT_PARAGRAPH:
22328
- const children = stringifyChildren(node.children, field, graphQLconfig);
22390
+ const children = stringifyChildren(node.children, field, graphQLconfig, schema);
22329
22391
  if (allChildrenEmpty(children)) {
22330
22392
  return false;
22331
22393
  }
@@ -22345,7 +22407,7 @@ var stringify = (node, field, graphQLconfig) => {
22345
22407
  ordered: false,
22346
22408
  spread: false,
22347
22409
  check: null,
22348
- children: stringifyChildren(node.children, field, graphQLconfig)
22410
+ children: stringifyChildren(node.children, field, graphQLconfig, schema)
22349
22411
  };
22350
22412
  case plateElements.ELEMENT_OL:
22351
22413
  return {
@@ -22353,7 +22415,7 @@ var stringify = (node, field, graphQLconfig) => {
22353
22415
  ordered: true,
22354
22416
  spread: false,
22355
22417
  check: null,
22356
- children: stringifyChildren(node.children, field, graphQLconfig)
22418
+ children: stringifyChildren(node.children, field, graphQLconfig, schema)
22357
22419
  };
22358
22420
  case plateElements.ELEMENT_LI:
22359
22421
  const realChildren = [];
@@ -22376,17 +22438,17 @@ var stringify = (node, field, graphQLconfig) => {
22376
22438
  spread: false,
22377
22439
  check: null,
22378
22440
  children: [
22379
- ...stringifyChildren([p], field, graphQLconfig),
22380
- ...stringifyChildren(extraChildren, field, graphQLconfig)
22441
+ ...stringifyChildren([p], field, graphQLconfig, schema),
22442
+ ...stringifyChildren(extraChildren, field, graphQLconfig, schema)
22381
22443
  ]
22382
22444
  };
22383
22445
  case plateElements.ELEMENT_LIC:
22384
22446
  return {
22385
22447
  type: "paragraph",
22386
- children: stringifyChildren(node.children, field, graphQLconfig)
22448
+ children: stringifyChildren(node.children, field, graphQLconfig, schema)
22387
22449
  };
22388
22450
  case plateElements.ELEMENT_IMAGE:
22389
- const url = resolveMediaCloudToRelative(node.url, graphQLconfig);
22451
+ const url = resolveMediaCloudToRelative(node.url, graphQLconfig, schema);
22390
22452
  return {
22391
22453
  type: "image",
22392
22454
  title: node.caption,
@@ -22402,12 +22464,12 @@ var stringify = (node, field, graphQLconfig) => {
22402
22464
  type: "link",
22403
22465
  url: node.url,
22404
22466
  title: node.title,
22405
- children: stringifyChildren(node.children, field, graphQLconfig)
22467
+ children: stringifyChildren(node.children, field, graphQLconfig, schema)
22406
22468
  };
22407
22469
  case plateElements.ELEMENT_BLOCKQUOTE:
22408
22470
  return {
22409
22471
  type: "blockquote",
22410
- children: stringifyChildren(node.children, field, graphQLconfig)
22472
+ children: stringifyChildren(node.children, field, graphQLconfig, schema)
22411
22473
  };
22412
22474
  case "mdxJsxTextElement":
22413
22475
  case "mdxJsxFlowElement":
@@ -22572,7 +22634,7 @@ var stringify = (node, field, graphQLconfig) => {
22572
22634
  }
22573
22635
  break;
22574
22636
  case "rich-text":
22575
- const tree = stringifyChildren(value.children, field2, graphQLconfig);
22637
+ const tree = stringifyChildren(value.children, field2, graphQLconfig, schema);
22576
22638
  if (field2.name === "children") {
22577
22639
  children2 = tree;
22578
22640
  } else {
@@ -22775,7 +22837,18 @@ var Resolver = class {
22775
22837
  _collection: rawData._collection,
22776
22838
  _template: rawData._template
22777
22839
  };
22778
- await sequential(template.fields, async (field) => this.resolveFieldData(field, rawData, data));
22840
+ try {
22841
+ await sequential(template.fields, async (field) => {
22842
+ return this.resolveFieldData(field, rawData, data);
22843
+ });
22844
+ } catch (e) {
22845
+ throw new TinaParseDocumentError({
22846
+ originalError: e,
22847
+ collection: collection.name,
22848
+ file: relativePath,
22849
+ stack: e.stack
22850
+ });
22851
+ }
22779
22852
  const titleField = template.fields.find((x) => {
22780
22853
  if (x.type === "string" && (x == null ? void 0 : x.isTitle)) {
22781
22854
  return true;
@@ -22801,8 +22874,8 @@ var Resolver = class {
22801
22874
  _values: data
22802
22875
  });
22803
22876
  } catch (e) {
22804
- if (e instanceof TinaError) {
22805
- throw new TinaError(e.message, __spreadValues({
22877
+ if (e instanceof TinaGraphQLError) {
22878
+ throw new TinaGraphQLError(e.message, __spreadValues({
22806
22879
  requestedDocument: fullPath
22807
22880
  }, e.extensions));
22808
22881
  }
@@ -23096,13 +23169,13 @@ var Resolver = class {
23096
23169
  accum[fieldName] = fieldValue;
23097
23170
  break;
23098
23171
  case "image":
23099
- accum[fieldName] = resolveMediaCloudToRelative(fieldValue, this.config);
23172
+ accum[fieldName] = resolveMediaCloudToRelative(fieldValue, this.config, this.tinaSchema.schema);
23100
23173
  break;
23101
23174
  case "object":
23102
23175
  accum[fieldName] = this.buildObjectMutations(fieldValue, field);
23103
23176
  break;
23104
23177
  case "rich-text":
23105
- accum[fieldName] = stringifyMDX(fieldValue, field, this.config);
23178
+ accum[fieldName] = stringifyMDX(fieldValue, field, this.config, this.tinaSchema.schema);
23106
23179
  break;
23107
23180
  case "reference":
23108
23181
  accum[fieldName] = fieldValue;
@@ -23135,10 +23208,10 @@ var Resolver = class {
23135
23208
  accumulator[field.name] = value;
23136
23209
  break;
23137
23210
  case "image":
23138
- accumulator[field.name] = resolveMediaRelativeToCloud(value, this.config);
23211
+ accumulator[field.name] = resolveMediaRelativeToCloud(value, this.config, this.tinaSchema.schema);
23139
23212
  break;
23140
23213
  case "rich-text":
23141
- const tree = parseMDX(value, field, this.config);
23214
+ const tree = parseMDX(value, field, this.config, this.tinaSchema.schema);
23142
23215
  accumulator[field.name] = tree;
23143
23216
  break;
23144
23217
  case "object":
@@ -23243,10 +23316,12 @@ var resolve = async ({
23243
23316
  query,
23244
23317
  variables,
23245
23318
  database,
23246
- silenceErrors
23319
+ silenceErrors,
23320
+ verbose
23247
23321
  }) => {
23248
23322
  var _a;
23249
23323
  try {
23324
+ const verboseValue = verbose != null ? verbose : true;
23250
23325
  const graphQLSchemaAst = await database.getGraphQLSchema();
23251
23326
  const graphQLSchema = (0, import_graphql3.buildASTSchema)(graphQLSchemaAst);
23252
23327
  const tinaConfig = await database.getTinaSchema();
@@ -23274,141 +23349,152 @@ var resolve = async ({
23274
23349
  }
23275
23350
  },
23276
23351
  fieldResolver: async (source = {}, _args = {}, _context, info) => {
23277
- const args = JSON.parse(JSON.stringify(_args));
23278
- const returnType = (0, import_graphql3.getNamedType)(info.returnType).toString();
23279
- const lookup = await database.getLookup(returnType);
23280
- const isMutation = info.parentType.toString() === "Mutation";
23281
- const value = source[info.fieldName];
23282
- if (returnType === "Collection") {
23283
- if (value) {
23284
- return value;
23285
- }
23286
- if (info.fieldName === "collections") {
23287
- const collectionNode2 = info.fieldNodes.find((x) => x.name.value === "collections");
23288
- const hasDocuments2 = collectionNode2.selectionSet.selections.find((x) => {
23289
- var _a2;
23290
- return ((_a2 = x == null ? void 0 : x.name) == null ? void 0 : _a2.value) === "documents";
23291
- });
23292
- return tinaSchema.getCollections().map((collection) => {
23293
- return resolver2.resolveCollection(args, collection.name, Boolean(hasDocuments2));
23294
- });
23295
- }
23296
- const collectionNode = info.fieldNodes.find((x) => x.name.value === "collection");
23297
- const hasDocuments = collectionNode.selectionSet.selections.find((x) => {
23298
- var _a2;
23299
- return ((_a2 = x == null ? void 0 : x.name) == null ? void 0 : _a2.value) === "documents";
23300
- });
23301
- return resolver2.resolveCollection(args, args.collection, Boolean(hasDocuments));
23302
- }
23303
- if (info.fieldName === "getOptimizedQuery") {
23304
- try {
23305
- const [optimizedQuery] = (0, import_relay_operation_optimizer.optimizeDocuments)(info.schema, [(0, import_graphql3.parse)(args.queryString)], {
23306
- assumeValid: true,
23307
- includeFragments: false,
23308
- noLocation: true
23309
- });
23310
- return (0, import_graphql3.print)(optimizedQuery);
23311
- } catch (e) {
23312
- throw new Error(`Invalid query provided, Error message: ${e.message}`);
23313
- }
23314
- }
23315
- if (!lookup) {
23316
- return value;
23317
- }
23318
- const isCreation = lookup[info.fieldName] === "create";
23319
- switch (lookup.resolveType) {
23320
- case "nodeDocument":
23321
- assertShape(args, (yup3) => yup3.object({ id: yup3.string().required() }));
23322
- return resolver2.getDocument(args.id);
23323
- case "multiCollectionDocument":
23324
- if (typeof value === "string") {
23325
- return resolver2.getDocument(value);
23352
+ try {
23353
+ const args = JSON.parse(JSON.stringify(_args));
23354
+ const returnType = (0, import_graphql3.getNamedType)(info.returnType).toString();
23355
+ const lookup = await database.getLookup(returnType);
23356
+ const isMutation = info.parentType.toString() === "Mutation";
23357
+ const value = source[info.fieldName];
23358
+ if (returnType === "Collection") {
23359
+ if (value) {
23360
+ return value;
23326
23361
  }
23327
- if (args && args.collection && info.fieldName === "addPendingDocument") {
23328
- return resolver2.resolveDocument({
23329
- args: __spreadProps(__spreadValues({}, args), { params: {} }),
23330
- collection: args.collection,
23331
- isMutation,
23332
- isCreation: true,
23333
- isAddPendingDocument: true
23362
+ if (info.fieldName === "collections") {
23363
+ const collectionNode2 = info.fieldNodes.find((x) => x.name.value === "collections");
23364
+ const hasDocuments2 = collectionNode2.selectionSet.selections.find((x) => {
23365
+ var _a2;
23366
+ return ((_a2 = x == null ? void 0 : x.name) == null ? void 0 : _a2.value) === "documents";
23334
23367
  });
23335
- }
23336
- if ([
23337
- NAMER.documentQueryName(),
23338
- "createDocument",
23339
- "updateDocument",
23340
- "deleteDocument"
23341
- ].includes(info.fieldName)) {
23342
- const result2 = await resolver2.resolveDocument({
23343
- args,
23344
- collection: args.collection,
23345
- isMutation,
23346
- isCreation,
23347
- isDeletion: info.fieldName === "deleteDocument",
23348
- isAddPendingDocument: false,
23349
- isCollectionSpecific: false
23368
+ return tinaSchema.getCollections().map((collection) => {
23369
+ return resolver2.resolveCollection(args, collection.name, Boolean(hasDocuments2));
23350
23370
  });
23351
- return result2;
23352
23371
  }
23353
- return value;
23354
- case "multiCollectionDocumentList":
23355
- if (Array.isArray(value)) {
23356
- return {
23357
- totalCount: value.length,
23358
- edges: value.map((document3) => {
23359
- return { node: document3 };
23360
- })
23361
- };
23362
- } else if (info.fieldName === "documents" && (value == null ? void 0 : value.collection) && (value == null ? void 0 : value.hasDocuments)) {
23363
- return resolver2.resolveCollectionConnection({
23364
- args,
23365
- collection: value.collection
23372
+ const collectionNode = info.fieldNodes.find((x) => x.name.value === "collection");
23373
+ const hasDocuments = collectionNode.selectionSet.selections.find((x) => {
23374
+ var _a2;
23375
+ return ((_a2 = x == null ? void 0 : x.name) == null ? void 0 : _a2.value) === "documents";
23376
+ });
23377
+ return resolver2.resolveCollection(args, args.collection, Boolean(hasDocuments));
23378
+ }
23379
+ if (info.fieldName === "getOptimizedQuery") {
23380
+ try {
23381
+ const [optimizedQuery] = (0, import_relay_operation_optimizer.optimizeDocuments)(info.schema, [(0, import_graphql3.parse)(args.queryString)], {
23382
+ assumeValid: true,
23383
+ includeFragments: false,
23384
+ noLocation: true
23366
23385
  });
23367
- } else {
23368
- throw new Error(`Expected an array for result of ${info.fieldName} at ${info.path}`);
23386
+ return (0, import_graphql3.print)(optimizedQuery);
23387
+ } catch (e) {
23388
+ throw new Error(`Invalid query provided, Error message: ${e.message}`);
23369
23389
  }
23370
- case "collectionDocument":
23371
- if (value) {
23372
- return value;
23373
- }
23374
- const result = value || await resolver2.resolveDocument({
23375
- args,
23376
- collection: lookup.collection,
23377
- isMutation,
23378
- isCreation,
23379
- isAddPendingDocument: false,
23380
- isCollectionSpecific: true
23381
- });
23382
- return result;
23383
- case "collectionDocumentList":
23384
- return resolver2.resolveCollectionConnection({
23385
- args,
23386
- collection: tinaSchema.getCollection(lookup.collection)
23387
- });
23388
- case "unionData":
23389
- if (!value) {
23390
- if (args.relativePath) {
23390
+ }
23391
+ if (!lookup) {
23392
+ return value;
23393
+ }
23394
+ const isCreation = lookup[info.fieldName] === "create";
23395
+ switch (lookup.resolveType) {
23396
+ case "nodeDocument":
23397
+ assertShape(args, (yup3) => yup3.object({ id: yup3.string().required() }));
23398
+ return resolver2.getDocument(args.id);
23399
+ case "multiCollectionDocument":
23400
+ if (typeof value === "string") {
23401
+ return resolver2.getDocument(value);
23402
+ }
23403
+ if (args && args.collection && info.fieldName === "addPendingDocument") {
23404
+ return resolver2.resolveDocument({
23405
+ args: __spreadProps(__spreadValues({}, args), { params: {} }),
23406
+ collection: args.collection,
23407
+ isMutation,
23408
+ isCreation: true,
23409
+ isAddPendingDocument: true
23410
+ });
23411
+ }
23412
+ if ([
23413
+ NAMER.documentQueryName(),
23414
+ "createDocument",
23415
+ "updateDocument",
23416
+ "deleteDocument"
23417
+ ].includes(info.fieldName)) {
23391
23418
  const result2 = await resolver2.resolveDocument({
23392
23419
  args,
23393
- collection: lookup.collection,
23420
+ collection: args.collection,
23394
23421
  isMutation,
23395
23422
  isCreation,
23423
+ isDeletion: info.fieldName === "deleteDocument",
23396
23424
  isAddPendingDocument: false,
23397
- isCollectionSpecific: true
23425
+ isCollectionSpecific: false
23398
23426
  });
23399
23427
  return result2;
23400
23428
  }
23401
- }
23402
- return value;
23403
- default:
23404
- console.error(lookup);
23405
- throw new Error(`Unexpected resolve type`);
23429
+ return value;
23430
+ case "multiCollectionDocumentList":
23431
+ if (Array.isArray(value)) {
23432
+ return {
23433
+ totalCount: value.length,
23434
+ edges: value.map((document3) => {
23435
+ return { node: document3 };
23436
+ })
23437
+ };
23438
+ } else if (info.fieldName === "documents" && (value == null ? void 0 : value.collection) && (value == null ? void 0 : value.hasDocuments)) {
23439
+ return resolver2.resolveCollectionConnection({
23440
+ args,
23441
+ collection: value.collection
23442
+ });
23443
+ } else {
23444
+ throw new Error(`Expected an array for result of ${info.fieldName} at ${info.path}`);
23445
+ }
23446
+ case "collectionDocument":
23447
+ if (value) {
23448
+ return value;
23449
+ }
23450
+ const result = value || await resolver2.resolveDocument({
23451
+ args,
23452
+ collection: lookup.collection,
23453
+ isMutation,
23454
+ isCreation,
23455
+ isAddPendingDocument: false,
23456
+ isCollectionSpecific: true
23457
+ });
23458
+ return result;
23459
+ case "collectionDocumentList":
23460
+ return resolver2.resolveCollectionConnection({
23461
+ args,
23462
+ collection: tinaSchema.getCollection(lookup.collection)
23463
+ });
23464
+ case "unionData":
23465
+ if (!value) {
23466
+ if (args.relativePath) {
23467
+ const result2 = await resolver2.resolveDocument({
23468
+ args,
23469
+ collection: lookup.collection,
23470
+ isMutation,
23471
+ isCreation,
23472
+ isAddPendingDocument: false,
23473
+ isCollectionSpecific: true
23474
+ });
23475
+ return result2;
23476
+ }
23477
+ }
23478
+ return value;
23479
+ default:
23480
+ console.error(lookup);
23481
+ throw new Error(`Unexpected resolve type`);
23482
+ }
23483
+ } catch (e) {
23484
+ handleFetchErrorError(e, verboseValue);
23406
23485
  }
23407
23486
  }
23408
23487
  });
23409
23488
  if (res.errors) {
23410
23489
  if (!silenceErrors) {
23411
- console.error(res.errors);
23490
+ res.errors.map((e) => {
23491
+ console.error(e.toString());
23492
+ if (verboseValue) {
23493
+ console.error("More error context below");
23494
+ console.error(e.message);
23495
+ console.error(e);
23496
+ }
23497
+ });
23412
23498
  }
23413
23499
  }
23414
23500
  return res;
@@ -23561,25 +23647,34 @@ var Database = class {
23561
23647
  });
23562
23648
  };
23563
23649
  this.put = async (filepath, data, collection) => {
23564
- if (SYSTEM_FILES.includes(filepath)) {
23565
- throw new Error(`Unexpected put for config file ${filepath}`);
23566
- } else {
23567
- let collectionIndexDefinitions;
23568
- if (collection) {
23569
- const indexDefinitions = await this.getIndexDefinitions();
23570
- collectionIndexDefinitions = indexDefinitions == null ? void 0 : indexDefinitions[collection];
23571
- }
23572
- const { stringifiedFile, payload, keepTemplateKey } = await this.stringifyFile(filepath, data);
23573
- if (this.store.supportsSeeding()) {
23574
- await this.bridge.put(normalizePath(filepath), stringifiedFile);
23650
+ try {
23651
+ if (SYSTEM_FILES.includes(filepath)) {
23652
+ throw new Error(`Unexpected put for config file ${filepath}`);
23653
+ } else {
23654
+ let collectionIndexDefinitions;
23655
+ if (collection) {
23656
+ const indexDefinitions = await this.getIndexDefinitions();
23657
+ collectionIndexDefinitions = indexDefinitions == null ? void 0 : indexDefinitions[collection];
23658
+ }
23659
+ const { stringifiedFile, payload, keepTemplateKey } = await this.stringifyFile(filepath, data);
23660
+ if (this.store.supportsSeeding()) {
23661
+ await this.bridge.put(normalizePath(filepath), stringifiedFile);
23662
+ }
23663
+ await this.store.put(normalizePath(filepath), payload, {
23664
+ keepTemplateKey,
23665
+ collection,
23666
+ indexDefinitions: collectionIndexDefinitions
23667
+ });
23575
23668
  }
23576
- await this.store.put(normalizePath(filepath), payload, {
23577
- keepTemplateKey,
23669
+ return true;
23670
+ } catch (error) {
23671
+ throw new TinaFetchError(`Error in PUT for ${filepath}`, {
23672
+ originalError: error,
23673
+ file: filepath,
23578
23674
  collection,
23579
- indexDefinitions: collectionIndexDefinitions
23675
+ stack: error.stack
23580
23676
  });
23581
23677
  }
23582
- return true;
23583
23678
  };
23584
23679
  this.stringifyFile = async (filepath, data) => {
23585
23680
  if (SYSTEM_FILES.includes(filepath)) {
@@ -23755,11 +23850,24 @@ var Database = class {
23755
23850
  } = await this.store.query(storeQueryOptions);
23756
23851
  return {
23757
23852
  edges: await sequential(edges, async (edge) => {
23758
- const node = await hydrator(edge.path);
23759
- return {
23760
- node,
23761
- cursor: (0, import_datalayer2.btoa)(edge.cursor)
23762
- };
23853
+ try {
23854
+ const node = await hydrator(edge.path);
23855
+ return {
23856
+ node,
23857
+ cursor: (0, import_datalayer2.btoa)(edge.cursor)
23858
+ };
23859
+ } catch (error) {
23860
+ if (error instanceof Error) {
23861
+ throw new TinaQueryError({
23862
+ originalError: error,
23863
+ file: edge.path,
23864
+ collection,
23865
+ stack: error.stack
23866
+ });
23867
+ } else {
23868
+ throw error;
23869
+ }
23870
+ }
23763
23871
  }),
23764
23872
  pageInfo: {
23765
23873
  hasPreviousPage,
@@ -23906,10 +24014,19 @@ var _indexContent = async (database, documentPaths, collection) => {
23906
24014
  };
23907
24015
  }
23908
24016
  await sequential(documentPaths, async (filepath) => {
23909
- const dataString = await database.bridge.get(normalizePath(filepath));
23910
- const data = parseFile(dataString, import_path4.default.extname(filepath), (yup3) => yup3.object({}));
23911
- if (database.store.supportsSeeding()) {
23912
- await database.store.seed(normalizePath(filepath), data, seedOptions);
24017
+ try {
24018
+ const dataString = await database.bridge.get(normalizePath(filepath));
24019
+ const data = parseFile(dataString, import_path4.default.extname(filepath), (yup3) => yup3.object({}));
24020
+ if (database.store.supportsSeeding()) {
24021
+ await database.store.seed(normalizePath(filepath), data, seedOptions);
24022
+ }
24023
+ } catch (error) {
24024
+ throw new TinaFetchError(`Unable to seed ${filepath}`, {
24025
+ originalError: error,
24026
+ file: filepath,
24027
+ collection: collection.name,
24028
+ stack: error.stack
24029
+ });
23913
24030
  }
23914
24031
  });
23915
24032
  };
@@ -23942,9 +24059,14 @@ var buildSchema = async (rootPath, database, flags) => {
23942
24059
  };
23943
24060
  // Annotate the CommonJS export names for ESM import in node:
23944
24061
  0 && (module.exports = {
24062
+ TinaFetchError,
24063
+ TinaGraphQLError,
24064
+ TinaParseDocumentError,
24065
+ TinaQueryError,
23945
24066
  assertShape,
23946
24067
  buildSchema,
23947
24068
  createDatabase,
24069
+ handleFetchErrorError,
23948
24070
  indexDB,
23949
24071
  parseFile,
23950
24072
  resolve,
@@ -17,7 +17,8 @@ limitations under the License.
17
17
  */
18
18
  import type { Content } from 'mdast';
19
19
  import type { GraphQLConfig, RichTypeInner } from '../types';
20
- export declare const parseMDX: (value: string, field: RichTypeInner, graphQLconfig: GraphQLConfig) => {
20
+ import type { TinaCloudSchemaEnriched } from '@tinacms/schema-tools';
21
+ export declare const parseMDX: (value: string, field: RichTypeInner, graphQLconfig: GraphQLConfig, schema: TinaCloudSchemaEnriched) => {
21
22
  type: string;
22
23
  children: any;
23
24
  };
@@ -70,7 +71,7 @@ export declare const parseMDX: (value: string, field: RichTypeInner, graphQLconf
70
71
  * 2. We don't need to do any client-side parsing. Since TinaMarkdown and the slate editor work with the same
71
72
  * format we can just allow Tina to do it's thing and update the form valuse with no additional work.
72
73
  */
73
- export declare const parseMDXInner: (tree: any, field: RichTypeInner, graphQLconfig: GraphQLConfig) => {
74
+ export declare const parseMDXInner: (tree: any, field: RichTypeInner, graphQLconfig: GraphQLConfig, schema: TinaCloudSchemaEnriched) => {
74
75
  type: string;
75
76
  children: any;
76
77
  };
@@ -226,5 +227,5 @@ export declare const plateElements: {
226
227
  MARK_UNDERLINE: string;
227
228
  };
228
229
  export declare const defaultNodeTypes: NodeTypes;
229
- export default function remarkToSlate(node: MdxAstNode, graphQLconfig: GraphQLConfig): any;
230
+ export default function remarkToSlate(node: MdxAstNode, graphQLconfig: GraphQLConfig, schema: TinaCloudSchemaEnriched): any;
230
231
  export {};
@@ -16,9 +16,10 @@ limitations under the License.
16
16
 
17
17
  */
18
18
  import type { GraphQLConfig, RichTypeInner } from '../types';
19
+ import type { TinaCloudSchemaEnriched } from '@tinacms/schema-tools';
19
20
  import { plateElements } from './parse';
20
21
  import type { Content } from 'mdast';
21
- export declare const stringifyMDX: (value: unknown, field: RichTypeInner, graphQLconfig: GraphQLConfig) => string;
22
+ export declare const stringifyMDX: (value: unknown, field: RichTypeInner, graphQLconfig: GraphQLConfig, schema: TinaCloudSchemaEnriched) => string;
22
23
  export declare const stringify: (node: {
23
24
  type: typeof plateElements;
24
- }, field: RichTypeInner, graphQLconfig: GraphQLConfig) => Content;
25
+ }, field: RichTypeInner, graphQLconfig: GraphQLConfig, schema: TinaCloudSchemaEnriched) => Content;
package/dist/resolve.d.ts CHANGED
@@ -12,12 +12,13 @@ limitations under the License.
12
12
  */
13
13
  import type { Database } from './database';
14
14
  import type { GraphQLConfig } from './types';
15
- export declare const resolve: ({ config, query, variables, database, silenceErrors, }: {
15
+ export declare const resolve: ({ config, query, variables, database, silenceErrors, verbose, }: {
16
16
  config?: GraphQLConfig;
17
17
  query: string;
18
18
  variables: object;
19
19
  database: Database;
20
20
  silenceErrors?: boolean;
21
+ verbose?: boolean;
21
22
  }) => Promise<import("graphql").ExecutionResult<{
22
23
  [key: string]: any;
23
24
  }, {
@@ -11,7 +11,7 @@ See the License for the specific language governing permissions and
11
11
  limitations under the License.
12
12
  */
13
13
  import { ASTNode, GraphQLError, Source, SourceLocation } from 'graphql';
14
- export declare class TinaError extends Error implements GraphQLError {
14
+ export declare class TinaGraphQLError extends Error implements GraphQLError {
15
15
  extensions: Record<string, any>;
16
16
  readonly name: string;
17
17
  readonly locations: ReadonlyArray<SourceLocation> | undefined;
@@ -23,3 +23,32 @@ export declare class TinaError extends Error implements GraphQLError {
23
23
  [key: string]: any;
24
24
  constructor(message: string, extensions?: Record<string, any>);
25
25
  }
26
+ export declare type TypeFetchErrorArgs = {
27
+ stack?: string;
28
+ file?: string;
29
+ originalError: Error;
30
+ collection?: string;
31
+ };
32
+ export declare class TinaFetchError extends Error {
33
+ stack?: string;
34
+ collection?: string;
35
+ file?: string;
36
+ originalError: Error;
37
+ constructor(message: string, args: TypeFetchErrorArgs);
38
+ }
39
+ export declare class TinaQueryError extends TinaFetchError {
40
+ stack?: string;
41
+ collection?: string;
42
+ file?: string;
43
+ originalError: Error;
44
+ constructor(args: TypeFetchErrorArgs);
45
+ }
46
+ export declare class TinaParseDocumentError extends TinaFetchError {
47
+ stack?: string;
48
+ collection?: string;
49
+ file?: string;
50
+ originalError: Error;
51
+ constructor(args: TypeFetchErrorArgs);
52
+ toString(): string;
53
+ }
54
+ export declare const handleFetchErrorError: (e: unknown, verbose: any) => never;
@@ -10,7 +10,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
10
  See the License for the specific language governing permissions and
11
11
  limitations under the License.
12
12
  */
13
- import { GraphQLConfig } from '../types';
13
+ import type { GraphQLConfig } from '../types';
14
+ import type { TinaCloudSchemaEnriched } from '@tinacms/schema-tools';
14
15
  /**
15
16
  * Strips away the Tina Cloud Asset URL from an `image` value
16
17
  *
@@ -18,7 +19,7 @@ import { GraphQLConfig } from '../types';
18
19
  * @param {GraphQLConfig} config
19
20
  * @returns {string}
20
21
  */
21
- export declare const resolveMediaCloudToRelative: (value: string, config?: GraphQLConfig) => string;
22
+ export declare const resolveMediaCloudToRelative: (value: string, config: GraphQLConfig, schema: TinaCloudSchemaEnriched) => string;
22
23
  /**
23
24
  * Adds Tina Cloud Asset URL to an `image` value
24
25
  *
@@ -26,4 +27,4 @@ export declare const resolveMediaCloudToRelative: (value: string, config?: Graph
26
27
  * @param {GraphQLConfig} config
27
28
  * @returns {string}
28
29
  */
29
- export declare const resolveMediaRelativeToCloud: (value: string, config?: GraphQLConfig) => string;
30
+ export declare const resolveMediaRelativeToCloud: (value: string, config: GraphQLConfig, schema: TinaCloudSchemaEnriched) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "0.0.0-202251418421",
3
+ "version": "0.0.0-2022514212340",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@graphql-tools/relay-operation-optimizer": "^6.4.1",
50
- "@tinacms/datalayer": "0.0.0-202251418421",
50
+ "@tinacms/datalayer": "0.0.0-2022514212340",
51
51
  "body-parser": "^1.19.0",
52
52
  "cors": "^2.8.5",
53
53
  "dataloader": "^2.0.0",
@@ -97,9 +97,9 @@
97
97
  "directory": "packages/tina-graphql"
98
98
  },
99
99
  "devDependencies": {
100
- "@tinacms/datalayer": "0.0.0-202251418421",
101
- "@tinacms/schema-tools": "0.0.0-202251418421",
102
- "@tinacms/scripts": "0.0.0-202251418421",
100
+ "@tinacms/datalayer": "0.0.0-2022514212340",
101
+ "@tinacms/schema-tools": "0.0.0-2022514212340",
102
+ "@tinacms/scripts": "0.0.0-2022514212340",
103
103
  "@types/cors": "^2.8.7",
104
104
  "@types/estree": "^0.0.50",
105
105
  "@types/express": "^4.17.8",