@tinacms/graphql 1.4.3 → 1.4.4

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.es.js CHANGED
@@ -2491,7 +2491,7 @@ var validateField = async (field) => {
2491
2491
  // package.json
2492
2492
  var package_default = {
2493
2493
  name: "@tinacms/graphql",
2494
- version: "1.4.3",
2494
+ version: "1.4.4",
2495
2495
  main: "dist/index.js",
2496
2496
  module: "dist/index.es.js",
2497
2497
  typings: "dist/index.d.ts",
@@ -3000,6 +3000,17 @@ var resolveMediaCloudToRelative = (value, config = { useRelativeMedia: true }, s
3000
3000
  const strippedURL = value.replace(assetsURL, "");
3001
3001
  return `${cleanMediaRoot}${strippedURL}`;
3002
3002
  }
3003
+ if (Array.isArray(value)) {
3004
+ return value.map((v) => {
3005
+ if (!v || typeof v !== "string")
3006
+ return v;
3007
+ const cleanMediaRoot = cleanUpSlashes(
3008
+ schema.config.media.tina.mediaRoot
3009
+ );
3010
+ const strippedURL = v.replace(assetsURL, "");
3011
+ return `${cleanMediaRoot}${strippedURL}`;
3012
+ });
3013
+ }
3003
3014
  return value;
3004
3015
  }
3005
3016
  return value;
@@ -3014,8 +3025,18 @@ var resolveMediaRelativeToCloud = (value, config = { useRelativeMedia: true }, s
3014
3025
  }
3015
3026
  if (hasTinaMediaConfig(schema) === true) {
3016
3027
  const cleanMediaRoot = cleanUpSlashes(schema.config.media.tina.mediaRoot);
3017
- const strippedValue = value.replace(cleanMediaRoot, "");
3018
- return `https://${config.assetsHost}/${config.clientId}${strippedValue}`;
3028
+ if (typeof value === "string") {
3029
+ const strippedValue = value.replace(cleanMediaRoot, "");
3030
+ return `https://${config.assetsHost}/${config.clientId}${strippedValue}`;
3031
+ }
3032
+ if (Array.isArray(value)) {
3033
+ return value.map((v) => {
3034
+ if (!v || typeof v !== "string")
3035
+ return v;
3036
+ const strippedValue = v.replace(cleanMediaRoot, "");
3037
+ return `https://${config.assetsHost}/${config.clientId}${strippedValue}`;
3038
+ });
3039
+ }
3019
3040
  }
3020
3041
  return value;
3021
3042
  } else {
package/dist/index.js CHANGED
@@ -2542,7 +2542,7 @@ var validateField = async (field) => {
2542
2542
  // package.json
2543
2543
  var package_default = {
2544
2544
  name: "@tinacms/graphql",
2545
- version: "1.4.3",
2545
+ version: "1.4.4",
2546
2546
  main: "dist/index.js",
2547
2547
  module: "dist/index.es.js",
2548
2548
  typings: "dist/index.d.ts",
@@ -3045,6 +3045,17 @@ var resolveMediaCloudToRelative = (value, config = { useRelativeMedia: true }, s
3045
3045
  const strippedURL = value.replace(assetsURL, "");
3046
3046
  return `${cleanMediaRoot}${strippedURL}`;
3047
3047
  }
3048
+ if (Array.isArray(value)) {
3049
+ return value.map((v) => {
3050
+ if (!v || typeof v !== "string")
3051
+ return v;
3052
+ const cleanMediaRoot = cleanUpSlashes(
3053
+ schema.config.media.tina.mediaRoot
3054
+ );
3055
+ const strippedURL = v.replace(assetsURL, "");
3056
+ return `${cleanMediaRoot}${strippedURL}`;
3057
+ });
3058
+ }
3048
3059
  return value;
3049
3060
  }
3050
3061
  return value;
@@ -3059,8 +3070,18 @@ var resolveMediaRelativeToCloud = (value, config = { useRelativeMedia: true }, s
3059
3070
  }
3060
3071
  if (hasTinaMediaConfig(schema) === true) {
3061
3072
  const cleanMediaRoot = cleanUpSlashes(schema.config.media.tina.mediaRoot);
3062
- const strippedValue = value.replace(cleanMediaRoot, "");
3063
- return `https://${config.assetsHost}/${config.clientId}${strippedValue}`;
3073
+ if (typeof value === "string") {
3074
+ const strippedValue = value.replace(cleanMediaRoot, "");
3075
+ return `https://${config.assetsHost}/${config.clientId}${strippedValue}`;
3076
+ }
3077
+ if (Array.isArray(value)) {
3078
+ return value.map((v) => {
3079
+ if (!v || typeof v !== "string")
3080
+ return v;
3081
+ const strippedValue = v.replace(cleanMediaRoot, "");
3082
+ return `https://${config.assetsHost}/${config.clientId}${strippedValue}`;
3083
+ });
3084
+ }
3064
3085
  }
3065
3086
  return value;
3066
3087
  } else {
@@ -6,16 +6,16 @@ import type { Schema } from '@tinacms/schema-tools';
6
6
  /**
7
7
  * Strips away the Tina Cloud Asset URL from an `image` value
8
8
  *
9
- * @param {string} value
9
+ * @param {string | string[]} value
10
10
  * @param {GraphQLConfig} config
11
11
  * @returns {string}
12
12
  */
13
- export declare const resolveMediaCloudToRelative: (value: string, config: GraphQLConfig, schema: Schema<true>) => string;
13
+ export declare const resolveMediaCloudToRelative: (value: string | string[], config: GraphQLConfig, schema: Schema<true>) => string | string[];
14
14
  /**
15
15
  * Adds Tina Cloud Asset URL to an `image` value
16
16
  *
17
- * @param {string} value
17
+ * @param {string | string[]} value
18
18
  * @param {GraphQLConfig} config
19
19
  * @returns {string}
20
20
  */
21
- export declare const resolveMediaRelativeToCloud: (value: string, config: GraphQLConfig, schema: Schema<true>) => string;
21
+ export declare const resolveMediaRelativeToCloud: (value: string | string[], config: GraphQLConfig, schema: Schema<true>) => string | string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "typings": "dist/index.d.ts",
@@ -25,6 +25,8 @@
25
25
  "dependencies": {
26
26
  "@graphql-tools/relay-operation-optimizer": "^6.4.1",
27
27
  "@iarna/toml": "^2.2.5",
28
+ "@tinacms/mdx": "1.3.7",
29
+ "@tinacms/schema-tools": "1.4.2",
28
30
  "abstract-level": "^1.0.3",
29
31
  "body-parser": "^1.19.0",
30
32
  "cors": "^2.8.5",
@@ -71,9 +73,7 @@
71
73
  "unist-util-visit": "^4.0.0",
72
74
  "vfile": "^4.2.0",
73
75
  "ws": "^7.3.1",
74
- "yup": "^0.32.9",
75
- "@tinacms/mdx": "1.3.7",
76
- "@tinacms/schema-tools": "1.4.2"
76
+ "yup": "^0.32.9"
77
77
  },
78
78
  "publishConfig": {
79
79
  "registry": "https://registry.npmjs.org"
@@ -83,6 +83,8 @@
83
83
  "directory": "packages/tina-graphql"
84
84
  },
85
85
  "devDependencies": {
86
+ "@tinacms/schema-tools": "1.4.2",
87
+ "@tinacms/scripts": "1.1.0",
86
88
  "@types/cors": "^2.8.7",
87
89
  "@types/estree": "^0.0.50",
88
90
  "@types/express": "^4.17.8",
@@ -105,9 +107,7 @@
105
107
  "jest-matcher-utils": "27.0.6",
106
108
  "memory-level": "^1.0.0",
107
109
  "nodemon": "2.0.19",
108
- "typescript": "4.3.5",
109
- "@tinacms/schema-tools": "1.4.2",
110
- "@tinacms/scripts": "1.1.0"
110
+ "typescript": "4.3.5"
111
111
  },
112
112
  "scripts": {
113
113
  "types": "pnpm tsc",