@tinacms/graphql 2.4.0 → 2.4.1

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 +6 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -3035,7 +3035,7 @@ var validateField = async (field) => {
3035
3035
  var package_default = {
3036
3036
  name: "@tinacms/graphql",
3037
3037
  type: "module",
3038
- version: "2.4.0",
3038
+ version: "2.4.1",
3039
3039
  main: "dist/index.js",
3040
3040
  module: "./dist/index.js",
3041
3041
  files: [
@@ -4671,13 +4671,17 @@ var resolveMediaRelativeToCloud = (value, config = { useRelativeMedia: true }, s
4671
4671
  const cleanMediaRoot = cleanUpSlashes(schema.config.media.tina.mediaRoot);
4672
4672
  const prefix = stagingPrefix(config);
4673
4673
  if (typeof value === "string") {
4674
+ if (ABSOLUTE_URL.test(value)) return value;
4674
4675
  const strippedValue = value.replace(cleanMediaRoot, "");
4676
+ if (ABSOLUTE_URL.test(strippedValue)) return strippedValue;
4675
4677
  return `https://${config.assetsHost}/${config.clientId}${prefix}${strippedValue}`;
4676
4678
  }
4677
4679
  if (Array.isArray(value)) {
4678
4680
  return value.map((v) => {
4679
4681
  if (!v || typeof v !== "string") return v;
4682
+ if (ABSOLUTE_URL.test(v)) return v;
4680
4683
  const strippedValue = v.replace(cleanMediaRoot, "");
4684
+ if (ABSOLUTE_URL.test(strippedValue)) return strippedValue;
4681
4685
  return `https://${config.assetsHost}/${config.clientId}${prefix}${strippedValue}`;
4682
4686
  });
4683
4687
  }
@@ -4693,6 +4697,7 @@ var stripStagingPrefix = (path9) => {
4693
4697
  const match = path9.match(STAGING_SEGMENT);
4694
4698
  return match ? match[1] : path9;
4695
4699
  };
4700
+ var ABSOLUTE_URL = /^[a-z][a-z0-9+.\-]*:|^\/\//i;
4696
4701
  var escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4697
4702
  var cloudUrlPattern = (clientId) => new RegExp(`^https://[^/]+/${escapeRegExp(clientId)}`);
4698
4703
  var cleanUpSlashes = (path9) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
3
  "type": "module",
4
- "version": "2.4.0",
4
+ "version": "2.4.1",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.js",
7
7
  "files": [
@@ -72,8 +72,8 @@
72
72
  "vite": "^4.5.9",
73
73
  "vitest": "^0.32.4",
74
74
  "zod": "^3.24.2",
75
- "@tinacms/scripts": "1.6.1",
76
- "@tinacms/schema-tools": "2.7.4"
75
+ "@tinacms/schema-tools": "2.7.4",
76
+ "@tinacms/scripts": "1.6.1"
77
77
  },
78
78
  "scripts": {
79
79
  "types": "pnpm tsc",