@tinacms/graphql 2.4.10 → 3.0.0

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.
@@ -130,6 +130,7 @@ export declare const astBuilder: {
130
130
  SystemInfo: string;
131
131
  Boolean: string;
132
132
  JSON: string;
133
+ RichText: string;
133
134
  Node: string;
134
135
  PageInfo: string;
135
136
  Connection: string;
package/dist/index.js CHANGED
@@ -505,6 +505,7 @@ var astBuilder = {
505
505
  SystemInfo: "SystemInfo",
506
506
  Boolean: "Boolean",
507
507
  JSON: "JSON",
508
+ RichText: "RichText",
508
509
  Node: "Node",
509
510
  PageInfo: "PageInfo",
510
511
  Connection: "Connection",
@@ -1173,6 +1174,10 @@ var scalarDefinitions = [
1173
1174
  description: "References another document, used as a foreign key"
1174
1175
  }),
1175
1176
  astBuilder.ScalarTypeDefinition({ name: "JSON" }),
1177
+ astBuilder.ScalarTypeDefinition({
1178
+ name: "RichText",
1179
+ description: "A rich-text document, renderable by TinaMarkdown"
1180
+ }),
1176
1181
  astBuilder.ObjectTypeDefinition({
1177
1182
  name: "SystemInfo",
1178
1183
  fields: [
@@ -2550,7 +2555,7 @@ var Builder = class {
2550
2555
  return astBuilder.InputValueDefinition({
2551
2556
  name: field.name,
2552
2557
  list: field.list,
2553
- type: astBuilder.TYPES.JSON
2558
+ type: astBuilder.TYPES.RichText
2554
2559
  });
2555
2560
  case "reference":
2556
2561
  return astBuilder.InputValueDefinition({
@@ -2799,7 +2804,7 @@ Visit https://tina.io/docs/r/content-fields/#list-fields/ for more information
2799
2804
  name: field.name,
2800
2805
  list: field.list,
2801
2806
  required: field.required,
2802
- type: astBuilder.TYPES.JSON
2807
+ type: astBuilder.TYPES.RichText
2803
2808
  });
2804
2809
  case "reference":
2805
2810
  const name = NAMER.documentTypeName(field.namespace);
@@ -3053,7 +3058,7 @@ var assertCheckboxGroupIsList = (field) => {
3053
3058
  var package_default = {
3054
3059
  name: "@tinacms/graphql",
3055
3060
  type: "module",
3056
- version: "2.4.10",
3061
+ version: "3.0.0",
3057
3062
  main: "dist/index.js",
3058
3063
  module: "./dist/index.js",
3059
3064
  files: [
@@ -3351,7 +3356,11 @@ import { JSONPath as JSONPath2 } from "jsonpath-plus";
3351
3356
  import { parseMDX, serializeMDX } from "@tinacms/mdx";
3352
3357
 
3353
3358
  // src/resolver/index.ts
3354
- import { ERR_ALREADY_EXISTS, RELATIVE_PATH_REGEX } from "@tinacms/schema-tools";
3359
+ import {
3360
+ ERR_ALREADY_EXISTS,
3361
+ RELATIVE_PATH_REGEX,
3362
+ normalizePath as normalizePath2
3363
+ } from "@tinacms/schema-tools";
3355
3364
  import { GraphQLError as GraphQLError2 } from "graphql";
3356
3365
 
3357
3366
  // src/database/datalayer.ts
@@ -4884,6 +4893,7 @@ var resolveFieldData = async ({ namespace, ...field }, rawData, accumulator, tin
4884
4893
  };
4885
4894
  var transformDocumentIntoPayload = async (fullPath, rawData, tinaSchema, config, isAudit, hasReferences) => {
4886
4895
  const collection = tinaSchema.getCollection(rawData._collection);
4896
+ const normalizedPath = normalizePath2(fullPath);
4887
4897
  try {
4888
4898
  const template = tinaSchema.getTemplateForData({
4889
4899
  data: rawData,
@@ -4893,8 +4903,8 @@ var transformDocumentIntoPayload = async (fullPath, rawData, tinaSchema, config,
4893
4903
  base: basename,
4894
4904
  ext: extension,
4895
4905
  name: filename
4896
- } = path3.parse(fullPath);
4897
- const relativePath = fullPath.replace(/\\/g, "/").replace(collection.path, "").replace(/^\/|\/$/g, "");
4906
+ } = path3.parse(normalizedPath);
4907
+ const relativePath = normalizedPath.replace(collection.path, "").replace(/^\/|\/$/g, "");
4898
4908
  const breadcrumbs = relativePath.replace(extension, "").split("/");
4899
4909
  const data = {
4900
4910
  _collection: rawData._collection,
@@ -4928,7 +4938,7 @@ var transformDocumentIntoPayload = async (fullPath, rawData, tinaSchema, config,
4928
4938
  const title = data[titleFieldName || " "] || null;
4929
4939
  return {
4930
4940
  __typename: collection.fields ? NAMER.documentTypeName(collection.namespace) : NAMER.documentTypeName(template.namespace),
4931
- id: fullPath,
4941
+ id: normalizedPath,
4932
4942
  ...data,
4933
4943
  _sys: {
4934
4944
  title: title || "",
@@ -4936,7 +4946,7 @@ var transformDocumentIntoPayload = async (fullPath, rawData, tinaSchema, config,
4936
4946
  filename,
4937
4947
  extension,
4938
4948
  hasReferences,
4939
- path: fullPath,
4949
+ path: normalizedPath,
4940
4950
  relativePath,
4941
4951
  breadcrumbs,
4942
4952
  collection,
@@ -5315,7 +5325,9 @@ var Resolver = class _Resolver {
5315
5325
  * @param collectionName - Name of the collection
5316
5326
  * @param relativePath - Relative path within the collection
5317
5327
  * @param options - Optional configuration
5318
- * @returns Object containing the collection and validated real path
5328
+ * @returns Object containing the collection and the validated real path,
5329
+ * normalized to POSIX separators so it matches the document identities and
5330
+ * reference values stored in content files on every platform
5319
5331
  */
5320
5332
  getValidatedPath = (collectionName, relativePath, options) => {
5321
5333
  _Resolver.validateRelativePath(relativePath);
@@ -5325,7 +5337,7 @@ var Resolver = class _Resolver {
5325
5337
  if (options?.extraSegments) {
5326
5338
  pathSegments.push(...options.extraSegments.map(_Resolver.sanitizePath));
5327
5339
  }
5328
- const realPath = path3.join(...pathSegments);
5340
+ const realPath = normalizePath2(path3.join(...pathSegments));
5329
5341
  const shouldValidateExtension = options?.validateExtension !== false;
5330
5342
  this.validatePath(
5331
5343
  realPath,
@@ -5893,7 +5905,7 @@ var Resolver = class _Resolver {
5893
5905
  filterExpression: {
5894
5906
  _type: "string",
5895
5907
  _list: false,
5896
- eq: id
5908
+ eq: normalizePath2(id)
5897
5909
  }
5898
5910
  }
5899
5911
  ]
@@ -5928,7 +5940,7 @@ var Resolver = class _Resolver {
5928
5940
  filterExpression: {
5929
5941
  _type: "string",
5930
5942
  _list: false,
5931
- eq: id
5943
+ eq: normalizePath2(id)
5932
5944
  }
5933
5945
  }
5934
5946
  ]
@@ -7103,11 +7115,14 @@ var Database = class {
7103
7115
  if (error instanceof GraphQLError5) {
7104
7116
  throw error;
7105
7117
  }
7106
- throw new TinaFetchError(`Error in PUT for ${filepath}`, {
7107
- originalError: error,
7108
- file: filepath,
7109
- collection: collectionName
7110
- });
7118
+ throw new TinaFetchError(
7119
+ `Error in PUT for ${filepath}: ${error instanceof Error ? error.message : String(error)}`,
7120
+ {
7121
+ originalError: error,
7122
+ file: filepath,
7123
+ collection: collectionName
7124
+ }
7125
+ );
7111
7126
  }
7112
7127
  };
7113
7128
  async getTemplateDetailsForFile(collection, data) {
@@ -256,7 +256,9 @@ export declare class Resolver {
256
256
  * @param collectionName - Name of the collection
257
257
  * @param relativePath - Relative path within the collection
258
258
  * @param options - Optional configuration
259
- * @returns Object containing the collection and validated real path
259
+ * @returns Object containing the collection and the validated real path,
260
+ * normalized to POSIX separators so it matches the document identities and
261
+ * reference values stored in content files on every platform
260
262
  */
261
263
  private getValidatedPath;
262
264
  resolveRetrievedDocument: ({ collectionName, relativePath, }: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
3
  "type": "module",
4
- "version": "2.4.10",
4
+ "version": "3.0.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.js",
7
7
  "files": [
@@ -43,8 +43,8 @@
43
43
  "normalize-path": "^3.0.0",
44
44
  "readable-stream": "^4.7.0",
45
45
  "yup": "^1.6.1",
46
- "@tinacms/mdx": "^2.2.1",
47
- "@tinacms/schema-tools": "^2.9.0"
46
+ "@tinacms/mdx": "^2.2.3",
47
+ "@tinacms/schema-tools": "^2.10.0"
48
48
  },
49
49
  "publishConfig": {
50
50
  "registry": "https://registry.npmjs.org"
@@ -72,7 +72,7 @@
72
72
  "vite": "^4.5.9",
73
73
  "vitest": "^0.32.4",
74
74
  "zod": "^3.24.2",
75
- "@tinacms/schema-tools": "2.9.0",
75
+ "@tinacms/schema-tools": "2.10.0",
76
76
  "@tinacms/scripts": "1.6.4"
77
77
  },
78
78
  "scripts": {