@tinacms/graphql 2.4.6 → 2.4.7

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -6
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -3052,7 +3052,7 @@ var assertCheckboxGroupIsList = (field) => {
3052
3052
  var package_default = {
3053
3053
  name: "@tinacms/graphql",
3054
3054
  type: "module",
3055
- version: "2.4.6",
3055
+ version: "2.4.7",
3056
3056
  main: "dist/index.js",
3057
3057
  module: "./dist/index.js",
3058
3058
  files: [
@@ -3351,6 +3351,7 @@ import { JSONPath as JSONPath2 } from "jsonpath-plus";
3351
3351
  import { parseMDX, serializeMDX } from "@tinacms/mdx";
3352
3352
 
3353
3353
  // src/resolver/index.ts
3354
+ import { ERR_ALREADY_EXISTS, RELATIVE_PATH_REGEX } from "@tinacms/schema-tools";
3354
3355
  import { GraphQLError as GraphQLError2 } from "graphql";
3355
3356
 
3356
3357
  // src/database/datalayer.ts
@@ -5172,7 +5173,9 @@ var Resolver = class _Resolver {
5172
5173
  );
5173
5174
  const alreadyExists = await this.database.documentExists(realPath);
5174
5175
  if (alreadyExists) {
5175
- throw new Error(`Unable to add document, ${realPath} already exists`);
5176
+ throw new Error(
5177
+ `Unable to add document, ${realPath} ${ERR_ALREADY_EXISTS}`
5178
+ );
5176
5179
  }
5177
5180
  const templateInfo = this.tinaSchema.getTemplatesForCollectable(collection);
5178
5181
  switch (templateInfo.type) {
@@ -5275,7 +5278,7 @@ var Resolver = class _Resolver {
5275
5278
  "Invalid path: relativePath cannot have leading or trailing whitespace"
5276
5279
  );
5277
5280
  }
5278
- if (!/^[a-zA-Z0-9\-_./]+$/.test(relativePath)) {
5281
+ if (!RELATIVE_PATH_REGEX.test(relativePath)) {
5279
5282
  throw new Error("Invalid path: relativePath contains invalid characters");
5280
5283
  }
5281
5284
  }
@@ -5363,7 +5366,9 @@ var Resolver = class _Resolver {
5363
5366
  this.validatePath(realPath, collection);
5364
5367
  const alreadyExists = await this.database.documentExists(realPath);
5365
5368
  if (alreadyExists) {
5366
- throw new Error(`Unable to add folder, ${realPath} already exists`);
5369
+ throw new Error(
5370
+ `Unable to add folder, ${realPath} ${ERR_ALREADY_EXISTS}`
5371
+ );
5367
5372
  }
5368
5373
  await this.database.put(
5369
5374
  realPath,
@@ -5383,7 +5388,9 @@ var Resolver = class _Resolver {
5383
5388
  );
5384
5389
  const alreadyExists = await this.database.documentExists(realPath);
5385
5390
  if (alreadyExists) {
5386
- throw new Error(`Unable to add document, ${realPath} already exists`);
5391
+ throw new Error(
5392
+ `Unable to add document, ${realPath} ${ERR_ALREADY_EXISTS}`
5393
+ );
5387
5394
  }
5388
5395
  const params = await this.buildObjectMutations(body, collection);
5389
5396
  await this.database.put(realPath, params, collection.name);
@@ -5415,7 +5422,7 @@ var Resolver = class _Resolver {
5415
5422
  const newPathAlreadyExists = await this.database.documentExists(newRealPath);
5416
5423
  if (newPathAlreadyExists) {
5417
5424
  throw new Error(
5418
- `Unable to rename document, ${newRealPath} already exists`
5425
+ `Unable to rename document, ${newRealPath} ${ERR_ALREADY_EXISTS}`
5419
5426
  );
5420
5427
  }
5421
5428
  await this.database.put(newRealPath, doc._rawData, collection.name);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
3
  "type": "module",
4
- "version": "2.4.6",
4
+ "version": "2.4.7",
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.1.8",
47
- "@tinacms/schema-tools": "2.8.2"
46
+ "@tinacms/schema-tools": "2.8.3",
47
+ "@tinacms/mdx": "2.1.9"
48
48
  },
49
49
  "publishConfig": {
50
50
  "registry": "https://registry.npmjs.org"
@@ -72,8 +72,8 @@
72
72
  "vite": "^4.5.9",
73
73
  "vitest": "^0.32.4",
74
74
  "zod": "^3.24.2",
75
- "@tinacms/schema-tools": "2.8.2",
76
- "@tinacms/scripts": "1.6.2"
75
+ "@tinacms/scripts": "1.6.2",
76
+ "@tinacms/schema-tools": "2.8.3"
77
77
  },
78
78
  "scripts": {
79
79
  "types": "pnpm tsc",