@tinacms/graphql 2.2.5 → 2.3.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.
- package/dist/index.js +20 -12
- package/dist/resolver/media-utils.d.ts +4 -2
- package/dist/types.d.ts +2 -0
- package/package.json +5 -5
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.
|
|
3038
|
+
version: "2.3.0",
|
|
3039
3039
|
main: "dist/index.js",
|
|
3040
3040
|
module: "./dist/index.js",
|
|
3041
3041
|
files: [
|
|
@@ -4638,21 +4638,17 @@ var resolveMediaCloudToRelative = (value, config = { useRelativeMedia: true }, s
|
|
|
4638
4638
|
}
|
|
4639
4639
|
if (hasTinaMediaConfig(schema) === true) {
|
|
4640
4640
|
const assetsURL = `https://${config.assetsHost}/${config.clientId}`;
|
|
4641
|
+
const cleanMediaRoot = cleanUpSlashes(schema.config.media.tina.mediaRoot);
|
|
4641
4642
|
if (typeof value === "string" && value.includes(assetsURL)) {
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
)
|
|
4645
|
-
const strippedURL = value.replace(assetsURL, "");
|
|
4646
|
-
return `${cleanMediaRoot}${strippedURL}`;
|
|
4643
|
+
return `${cleanMediaRoot}${stripStagingPrefix(
|
|
4644
|
+
value.replace(assetsURL, "")
|
|
4645
|
+
)}`;
|
|
4647
4646
|
}
|
|
4648
4647
|
if (Array.isArray(value)) {
|
|
4649
4648
|
return value.map((v) => {
|
|
4650
4649
|
if (!v || typeof v !== "string") return v;
|
|
4651
|
-
const cleanMediaRoot = cleanUpSlashes(
|
|
4652
|
-
schema.config.media.tina.mediaRoot
|
|
4653
|
-
);
|
|
4654
4650
|
const strippedURL = v.replace(assetsURL, "");
|
|
4655
|
-
return `${cleanMediaRoot}${strippedURL}`;
|
|
4651
|
+
return `${cleanMediaRoot}${stripStagingPrefix(strippedURL)}`;
|
|
4656
4652
|
});
|
|
4657
4653
|
}
|
|
4658
4654
|
return value;
|
|
@@ -4669,15 +4665,16 @@ var resolveMediaRelativeToCloud = (value, config = { useRelativeMedia: true }, s
|
|
|
4669
4665
|
}
|
|
4670
4666
|
if (hasTinaMediaConfig(schema) === true) {
|
|
4671
4667
|
const cleanMediaRoot = cleanUpSlashes(schema.config.media.tina.mediaRoot);
|
|
4668
|
+
const prefix = stagingPrefix(config);
|
|
4672
4669
|
if (typeof value === "string") {
|
|
4673
4670
|
const strippedValue = value.replace(cleanMediaRoot, "");
|
|
4674
|
-
return `https://${config.assetsHost}/${config.clientId}${strippedValue}`;
|
|
4671
|
+
return `https://${config.assetsHost}/${config.clientId}${prefix}${strippedValue}`;
|
|
4675
4672
|
}
|
|
4676
4673
|
if (Array.isArray(value)) {
|
|
4677
4674
|
return value.map((v) => {
|
|
4678
4675
|
if (!v || typeof v !== "string") return v;
|
|
4679
4676
|
const strippedValue = v.replace(cleanMediaRoot, "");
|
|
4680
|
-
return `https://${config.assetsHost}/${config.clientId}${strippedValue}`;
|
|
4677
|
+
return `https://${config.assetsHost}/${config.clientId}${prefix}${strippedValue}`;
|
|
4681
4678
|
});
|
|
4682
4679
|
}
|
|
4683
4680
|
}
|
|
@@ -4686,6 +4683,12 @@ var resolveMediaRelativeToCloud = (value, config = { useRelativeMedia: true }, s
|
|
|
4686
4683
|
return value;
|
|
4687
4684
|
}
|
|
4688
4685
|
};
|
|
4686
|
+
var stagingPrefix = (config) => config.branch && config.branch !== config.mediaBranch ? `/__staging/${encodeURIComponent(config.branch)}` : "";
|
|
4687
|
+
var STAGING_SEGMENT = /^\/__staging\/[^/]+(\/.*)$/;
|
|
4688
|
+
var stripStagingPrefix = (path9) => {
|
|
4689
|
+
const match = path9.match(STAGING_SEGMENT);
|
|
4690
|
+
return match ? match[1] : path9;
|
|
4691
|
+
};
|
|
4689
4692
|
var cleanUpSlashes = (path9) => {
|
|
4690
4693
|
if (path9) {
|
|
4691
4694
|
return `/${path9.replace(/^\/+|\/+$/gm, "")}`;
|
|
@@ -8648,3 +8651,8 @@ export {
|
|
|
8648
8651
|
};
|
|
8649
8652
|
//! Replaces _.get()
|
|
8650
8653
|
//! Replaces _.flattenDeep()
|
|
8654
|
+
/**
|
|
8655
|
+
* @license
|
|
8656
|
+
* Copyright 2023 Forestry.io Holdings, Inc.
|
|
8657
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8658
|
+
*/
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/graphql",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.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/
|
|
47
|
-
"@tinacms/
|
|
46
|
+
"@tinacms/schema-tools": "2.7.3",
|
|
47
|
+
"@tinacms/mdx": "2.1.3"
|
|
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/
|
|
76
|
-
"@tinacms/
|
|
75
|
+
"@tinacms/schema-tools": "2.7.3",
|
|
76
|
+
"@tinacms/scripts": "1.6.0"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
79
|
"types": "pnpm tsc",
|