@tinacms/graphql 0.0.0-20225820237 → 0.0.0-202258204527
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/CHANGELOG.md +12 -7
- package/dist/database/index.d.ts +4 -2
- package/dist/index.js +70 -96
- package/dist/mdx/parse.d.ts +4 -4
- package/dist/mdx/stringify.d.ts +3 -3
- package/dist/resolver/index.d.ts +0 -1
- package/package.json +5 -5
- package/dist/resolver/media-utils.d.ts +0 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
# tina-graphql
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-202258204527
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Updated dependencies [d9782ce8b]
|
|
8
|
+
- @tinacms/schema-tools@0.0.0-202258204527
|
|
9
|
+
- @tinacms/datalayer@0.0.0-202258204527
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## 0.60.5
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 57f09bdd7: Always use the query function when the dataLayer in enabled
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
## 0.60.4
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
- d103b27ad: Fix issue where new collections would not be added when CLI restarts
|
|
17
22
|
|
|
18
23
|
## 0.60.3
|
|
19
24
|
|
package/dist/database/index.d.ts
CHANGED
|
@@ -44,8 +44,6 @@ export declare class Database {
|
|
|
44
44
|
private tinaSchema;
|
|
45
45
|
private collectionIndexDefinitions;
|
|
46
46
|
private _lookup;
|
|
47
|
-
private _graphql;
|
|
48
|
-
private _tinaSchema;
|
|
49
47
|
constructor(config: CreateDatabase);
|
|
50
48
|
private collectionForPath;
|
|
51
49
|
private partitionPathsByCollection;
|
|
@@ -65,6 +63,10 @@ export declare class Database {
|
|
|
65
63
|
};
|
|
66
64
|
keepTemplateKey: boolean;
|
|
67
65
|
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Clears the internal cache of the tinaSchema and the lookup file. This allows the state to be reset
|
|
68
|
+
*/
|
|
69
|
+
clearCache(): void;
|
|
68
70
|
flush: (filepath: string) => Promise<string>;
|
|
69
71
|
getLookup: (returnType: string) => Promise<LookupMapType>;
|
|
70
72
|
getGraphQLSchema: () => Promise<DocumentNode>;
|
package/dist/index.js
CHANGED
|
@@ -12480,7 +12480,7 @@ var validateField = async (field) => {
|
|
|
12480
12480
|
|
|
12481
12481
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/package.json
|
|
12482
12482
|
var name = "@tinacms/graphql";
|
|
12483
|
-
var version = "0.60.
|
|
12483
|
+
var version = "0.60.5";
|
|
12484
12484
|
var main = "dist/index.js";
|
|
12485
12485
|
var typings = "dist/index.d.ts";
|
|
12486
12486
|
var files = [
|
|
@@ -20222,42 +20222,11 @@ var visit = function(tree, test, visitor, reverse) {
|
|
|
20222
20222
|
|
|
20223
20223
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/mdx/parse.ts
|
|
20224
20224
|
var import_lodash4 = __toModule(require("lodash"));
|
|
20225
|
-
|
|
20226
|
-
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/resolver/media-utils.ts
|
|
20227
|
-
var resolveMediaCloudToRelative = (value, config = { useRelativeMedia: true }) => {
|
|
20228
|
-
if (config) {
|
|
20229
|
-
if (config.useRelativeMedia === true) {
|
|
20230
|
-
return value;
|
|
20231
|
-
} else {
|
|
20232
|
-
const assetsURL = `https://${config.assetsHost}/${config.clientId}`;
|
|
20233
|
-
if (typeof value === "string" && value.includes(assetsURL)) {
|
|
20234
|
-
return value.replace(assetsURL, "");
|
|
20235
|
-
} else {
|
|
20236
|
-
return value;
|
|
20237
|
-
}
|
|
20238
|
-
}
|
|
20239
|
-
} else {
|
|
20240
|
-
return value;
|
|
20241
|
-
}
|
|
20242
|
-
};
|
|
20243
|
-
var resolveMediaRelativeToCloud = (value, config = { useRelativeMedia: true }) => {
|
|
20244
|
-
if (config) {
|
|
20245
|
-
if (config.useRelativeMedia === true) {
|
|
20246
|
-
return value;
|
|
20247
|
-
} else {
|
|
20248
|
-
return `https://${config.assetsHost}/${config.clientId}${value}`;
|
|
20249
|
-
}
|
|
20250
|
-
} else {
|
|
20251
|
-
return value;
|
|
20252
|
-
}
|
|
20253
|
-
};
|
|
20254
|
-
|
|
20255
|
-
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/mdx/parse.ts
|
|
20256
|
-
var parseMDX = (value, field, graphQLconfig) => {
|
|
20225
|
+
var parseMDX = (value, field) => {
|
|
20257
20226
|
const tree = unified().use(remark_parse_default).use(import_remark_mdx.default).parse(value);
|
|
20258
|
-
return parseMDXInner(tree, field
|
|
20227
|
+
return parseMDXInner(tree, field);
|
|
20259
20228
|
};
|
|
20260
|
-
var parseMDXInner = (tree, field
|
|
20229
|
+
var parseMDXInner = (tree, field) => {
|
|
20261
20230
|
visit(tree, (node) => {
|
|
20262
20231
|
delete node.position;
|
|
20263
20232
|
});
|
|
@@ -20265,7 +20234,7 @@ var parseMDXInner = (tree, field, graphQLconfig) => {
|
|
|
20265
20234
|
var _a;
|
|
20266
20235
|
let props = {};
|
|
20267
20236
|
if (!node.name) {
|
|
20268
|
-
props = parseMDXInner({ type: "root", children: node.children }, field
|
|
20237
|
+
props = parseMDXInner({ type: "root", children: node.children }, field);
|
|
20269
20238
|
}
|
|
20270
20239
|
const template = (_a = field.templates) == null ? void 0 : _a.find((template2) => {
|
|
20271
20240
|
const templateName = typeof template2 === "string" ? template2 : template2.name;
|
|
@@ -20296,7 +20265,7 @@ var parseMDXInner = (tree, field, graphQLconfig) => {
|
|
|
20296
20265
|
if (!field2) {
|
|
20297
20266
|
throw new Error(`Unknown property '${attribute.name}' for embedded structure '${node.name}'`);
|
|
20298
20267
|
}
|
|
20299
|
-
parseField(attribute, field2, props
|
|
20268
|
+
parseField(attribute, field2, props);
|
|
20300
20269
|
}
|
|
20301
20270
|
} else {
|
|
20302
20271
|
console.log(`Not sure what this is, type: ${attribute.type}`);
|
|
@@ -20305,19 +20274,15 @@ var parseMDXInner = (tree, field, graphQLconfig) => {
|
|
|
20305
20274
|
delete node.attributes;
|
|
20306
20275
|
node.props = props;
|
|
20307
20276
|
});
|
|
20308
|
-
const slateTree = tree.children.map(
|
|
20277
|
+
const slateTree = tree.children.map(remarkToSlate);
|
|
20309
20278
|
return { type: "root", children: slateTree };
|
|
20310
20279
|
};
|
|
20311
|
-
var parseField = (attribute, field, props
|
|
20280
|
+
var parseField = (attribute, field, props) => {
|
|
20312
20281
|
var _a, _b;
|
|
20313
20282
|
switch (field.type) {
|
|
20314
20283
|
case "boolean":
|
|
20315
20284
|
case "datetime":
|
|
20316
|
-
props[field.name] = attribute.value;
|
|
20317
|
-
break;
|
|
20318
20285
|
case "image":
|
|
20319
|
-
props[field.name] = resolveMediaRelativeToCloud(attribute.value, graphQLconfig);
|
|
20320
|
-
break;
|
|
20321
20286
|
case "number":
|
|
20322
20287
|
case "string":
|
|
20323
20288
|
if (field.list) {
|
|
@@ -20379,7 +20344,7 @@ var parseField = (attribute, field, props, graphQLconfig) => {
|
|
|
20379
20344
|
throw new Error(`Global fields not supported at this time`);
|
|
20380
20345
|
}
|
|
20381
20346
|
field.fields.forEach((field2) => {
|
|
20382
|
-
parseField(property, field2, objectProps
|
|
20347
|
+
parseField(property, field2, objectProps);
|
|
20383
20348
|
});
|
|
20384
20349
|
}
|
|
20385
20350
|
});
|
|
@@ -20401,7 +20366,7 @@ var parseField = (attribute, field, props, graphQLconfig) => {
|
|
|
20401
20366
|
throw new Error(`Global fields not supported at this time`);
|
|
20402
20367
|
}
|
|
20403
20368
|
field.fields.forEach((field2) => {
|
|
20404
|
-
parseField(property, field2, objectProps
|
|
20369
|
+
parseField(property, field2, objectProps);
|
|
20405
20370
|
});
|
|
20406
20371
|
}
|
|
20407
20372
|
if (field.templates) {
|
|
@@ -20410,7 +20375,7 @@ var parseField = (attribute, field, props, graphQLconfig) => {
|
|
|
20410
20375
|
throw new Error(`Global fields not supported at this time`);
|
|
20411
20376
|
}
|
|
20412
20377
|
fieldTemplate.fields.forEach((field2) => {
|
|
20413
|
-
parseField(property, field2, objectProps
|
|
20378
|
+
parseField(property, field2, objectProps);
|
|
20414
20379
|
});
|
|
20415
20380
|
});
|
|
20416
20381
|
}
|
|
@@ -20433,13 +20398,13 @@ var parseField = (attribute, field, props, graphQLconfig) => {
|
|
|
20433
20398
|
if (attribute.value) {
|
|
20434
20399
|
if (field.name === "children") {
|
|
20435
20400
|
if (Array.isArray(attribute.value)) {
|
|
20436
|
-
props[field.name] = parseMDXInner({ type: "root", children: attribute.value }, field
|
|
20401
|
+
props[field.name] = parseMDXInner({ type: "root", children: attribute.value }, field);
|
|
20437
20402
|
} else {
|
|
20438
20403
|
throw Error(`Expected an array of MDX strings for rich-text field with the special name 'children'`);
|
|
20439
20404
|
}
|
|
20440
20405
|
} else {
|
|
20441
20406
|
try {
|
|
20442
|
-
const mdx2 = parseMDX(attribute.value.value, field
|
|
20407
|
+
const mdx2 = parseMDX(attribute.value.value, field);
|
|
20443
20408
|
props[field.name] = mdx2.children[0].props;
|
|
20444
20409
|
} catch (e) {
|
|
20445
20410
|
console.log(e);
|
|
@@ -20510,7 +20475,7 @@ var defaultNodeTypes = {
|
|
|
20510
20475
|
break: "break",
|
|
20511
20476
|
image: plateElements.ELEMENT_IMAGE
|
|
20512
20477
|
};
|
|
20513
|
-
function remarkToSlate(node
|
|
20478
|
+
function remarkToSlate(node) {
|
|
20514
20479
|
const types = __spreadProps(__spreadValues({}, defaultNodeTypes), {
|
|
20515
20480
|
heading: __spreadValues({}, defaultNodeTypes.heading)
|
|
20516
20481
|
});
|
|
@@ -20518,12 +20483,12 @@ function remarkToSlate(node, graphQLconfig) {
|
|
|
20518
20483
|
case "heading":
|
|
20519
20484
|
return {
|
|
20520
20485
|
type: types.heading[node.depth],
|
|
20521
|
-
children: node.children.map(
|
|
20486
|
+
children: node.children.map(remarkToSlate)
|
|
20522
20487
|
};
|
|
20523
20488
|
case "list":
|
|
20524
20489
|
return {
|
|
20525
20490
|
type: node.ordered ? types.ol_list : types.ul_list,
|
|
20526
|
-
children: node.children.map(
|
|
20491
|
+
children: node.children.map(remarkToSlate)
|
|
20527
20492
|
};
|
|
20528
20493
|
case "listItem":
|
|
20529
20494
|
const realChildren = [];
|
|
@@ -20531,12 +20496,12 @@ function remarkToSlate(node, graphQLconfig) {
|
|
|
20531
20496
|
if (child.type === "list") {
|
|
20532
20497
|
realChildren.push({
|
|
20533
20498
|
type: child.ordered ? types.ol_list : types.ul_list,
|
|
20534
|
-
children: child.children.map(
|
|
20499
|
+
children: child.children.map(remarkToSlate)
|
|
20535
20500
|
});
|
|
20536
20501
|
} else {
|
|
20537
20502
|
realChildren.push({
|
|
20538
20503
|
type: plateElements.ELEMENT_LIC,
|
|
20539
|
-
children: child.children.map(
|
|
20504
|
+
children: child.children.map(remarkToSlate)
|
|
20540
20505
|
});
|
|
20541
20506
|
}
|
|
20542
20507
|
});
|
|
@@ -20547,26 +20512,25 @@ function remarkToSlate(node, graphQLconfig) {
|
|
|
20547
20512
|
case "paragraph":
|
|
20548
20513
|
return {
|
|
20549
20514
|
type: types.paragraph,
|
|
20550
|
-
children: node.children.map(
|
|
20515
|
+
children: node.children.map(remarkToSlate)
|
|
20551
20516
|
};
|
|
20552
20517
|
case "link":
|
|
20553
20518
|
return {
|
|
20554
20519
|
type: types.link,
|
|
20555
20520
|
url: node.url,
|
|
20556
|
-
children: node.children.map(
|
|
20521
|
+
children: node.children.map(remarkToSlate)
|
|
20557
20522
|
};
|
|
20558
20523
|
case "image":
|
|
20559
|
-
const url = resolveMediaRelativeToCloud(node.url, graphQLconfig);
|
|
20560
20524
|
return {
|
|
20561
20525
|
type: types.image,
|
|
20562
|
-
url,
|
|
20526
|
+
url: node.url,
|
|
20563
20527
|
alt: node.alt,
|
|
20564
20528
|
caption: node.title
|
|
20565
20529
|
};
|
|
20566
20530
|
case "blockquote":
|
|
20567
20531
|
return {
|
|
20568
20532
|
type: types.block_quote,
|
|
20569
|
-
children: node.children.map(
|
|
20533
|
+
children: node.children.map(remarkToSlate)
|
|
20570
20534
|
};
|
|
20571
20535
|
case "code":
|
|
20572
20536
|
return {
|
|
@@ -22027,10 +21991,10 @@ var mdxToMarkdown = {
|
|
|
22027
21991
|
};
|
|
22028
21992
|
|
|
22029
21993
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/mdx/stringify.ts
|
|
22030
|
-
var stringifyMDX = (value, field
|
|
21994
|
+
var stringifyMDX = (value, field) => {
|
|
22031
21995
|
const slateTree = value.children;
|
|
22032
21996
|
try {
|
|
22033
|
-
const tree = stringifyChildren(slateTree, field
|
|
21997
|
+
const tree = stringifyChildren(slateTree, field);
|
|
22034
21998
|
const out = toMarkdown({
|
|
22035
21999
|
type: "root",
|
|
22036
22000
|
children: tree
|
|
@@ -22048,13 +22012,13 @@ var allChildrenEmpty = (children) => {
|
|
|
22048
22012
|
}
|
|
22049
22013
|
return false;
|
|
22050
22014
|
};
|
|
22051
|
-
var stringifyChildren = (children, field
|
|
22015
|
+
var stringifyChildren = (children, field) => {
|
|
22052
22016
|
if (!children) {
|
|
22053
22017
|
return [];
|
|
22054
22018
|
}
|
|
22055
|
-
return children.map((child) => stringify(child, field
|
|
22019
|
+
return children.map((child) => stringify(child, field)).filter(Boolean);
|
|
22056
22020
|
};
|
|
22057
|
-
var stringify = (node, field
|
|
22021
|
+
var stringify = (node, field) => {
|
|
22058
22022
|
var _a;
|
|
22059
22023
|
if (!node.type) {
|
|
22060
22024
|
if (node == null ? void 0 : node.code) {
|
|
@@ -22080,40 +22044,40 @@ var stringify = (node, field, graphQLconfig) => {
|
|
|
22080
22044
|
return {
|
|
22081
22045
|
type: "heading",
|
|
22082
22046
|
depth: 1,
|
|
22083
|
-
children: stringifyChildren(node.children, field
|
|
22047
|
+
children: stringifyChildren(node.children, field)
|
|
22084
22048
|
};
|
|
22085
22049
|
case plateElements.ELEMENT_H2:
|
|
22086
22050
|
return {
|
|
22087
22051
|
type: "heading",
|
|
22088
22052
|
depth: 2,
|
|
22089
|
-
children: stringifyChildren(node.children, field
|
|
22053
|
+
children: stringifyChildren(node.children, field)
|
|
22090
22054
|
};
|
|
22091
22055
|
case plateElements.ELEMENT_H3:
|
|
22092
22056
|
return {
|
|
22093
22057
|
type: "heading",
|
|
22094
22058
|
depth: 3,
|
|
22095
|
-
children: stringifyChildren(node.children, field
|
|
22059
|
+
children: stringifyChildren(node.children, field)
|
|
22096
22060
|
};
|
|
22097
22061
|
case plateElements.ELEMENT_H4:
|
|
22098
22062
|
return {
|
|
22099
22063
|
type: "heading",
|
|
22100
22064
|
depth: 4,
|
|
22101
|
-
children: stringifyChildren(node.children, field
|
|
22065
|
+
children: stringifyChildren(node.children, field)
|
|
22102
22066
|
};
|
|
22103
22067
|
case plateElements.ELEMENT_H5:
|
|
22104
22068
|
return {
|
|
22105
22069
|
type: "heading",
|
|
22106
22070
|
depth: 5,
|
|
22107
|
-
children: stringifyChildren(node.children, field
|
|
22071
|
+
children: stringifyChildren(node.children, field)
|
|
22108
22072
|
};
|
|
22109
22073
|
case plateElements.ELEMENT_H6:
|
|
22110
22074
|
return {
|
|
22111
22075
|
type: "heading",
|
|
22112
22076
|
depth: 6,
|
|
22113
|
-
children: stringifyChildren(node.children, field
|
|
22077
|
+
children: stringifyChildren(node.children, field)
|
|
22114
22078
|
};
|
|
22115
22079
|
case plateElements.ELEMENT_PARAGRAPH:
|
|
22116
|
-
const children = stringifyChildren(node.children, field
|
|
22080
|
+
const children = stringifyChildren(node.children, field);
|
|
22117
22081
|
if (allChildrenEmpty(children)) {
|
|
22118
22082
|
return false;
|
|
22119
22083
|
}
|
|
@@ -22133,7 +22097,7 @@ var stringify = (node, field, graphQLconfig) => {
|
|
|
22133
22097
|
ordered: false,
|
|
22134
22098
|
spread: false,
|
|
22135
22099
|
check: null,
|
|
22136
|
-
children: stringifyChildren(node.children, field
|
|
22100
|
+
children: stringifyChildren(node.children, field)
|
|
22137
22101
|
};
|
|
22138
22102
|
case plateElements.ELEMENT_OL:
|
|
22139
22103
|
return {
|
|
@@ -22141,7 +22105,7 @@ var stringify = (node, field, graphQLconfig) => {
|
|
|
22141
22105
|
ordered: true,
|
|
22142
22106
|
spread: false,
|
|
22143
22107
|
check: null,
|
|
22144
|
-
children: stringifyChildren(node.children, field
|
|
22108
|
+
children: stringifyChildren(node.children, field)
|
|
22145
22109
|
};
|
|
22146
22110
|
case plateElements.ELEMENT_LI:
|
|
22147
22111
|
const realChildren = [];
|
|
@@ -22164,22 +22128,21 @@ var stringify = (node, field, graphQLconfig) => {
|
|
|
22164
22128
|
spread: false,
|
|
22165
22129
|
check: null,
|
|
22166
22130
|
children: [
|
|
22167
|
-
...stringifyChildren([p], field
|
|
22168
|
-
...stringifyChildren(extraChildren, field
|
|
22131
|
+
...stringifyChildren([p], field),
|
|
22132
|
+
...stringifyChildren(extraChildren, field)
|
|
22169
22133
|
]
|
|
22170
22134
|
};
|
|
22171
22135
|
case plateElements.ELEMENT_LIC:
|
|
22172
22136
|
return {
|
|
22173
22137
|
type: "paragraph",
|
|
22174
|
-
children: stringifyChildren(node.children, field
|
|
22138
|
+
children: stringifyChildren(node.children, field)
|
|
22175
22139
|
};
|
|
22176
22140
|
case plateElements.ELEMENT_IMAGE:
|
|
22177
|
-
const url = resolveMediaCloudToRelative(node.url, graphQLconfig);
|
|
22178
22141
|
return {
|
|
22179
22142
|
type: "image",
|
|
22180
22143
|
title: node.caption,
|
|
22181
22144
|
alt: node.alt,
|
|
22182
|
-
url
|
|
22145
|
+
url: node.url
|
|
22183
22146
|
};
|
|
22184
22147
|
case plateElements.ELEMENT_HR:
|
|
22185
22148
|
return {
|
|
@@ -22190,12 +22153,12 @@ var stringify = (node, field, graphQLconfig) => {
|
|
|
22190
22153
|
type: "link",
|
|
22191
22154
|
url: node.url,
|
|
22192
22155
|
title: node.title,
|
|
22193
|
-
children: stringifyChildren(node.children, field
|
|
22156
|
+
children: stringifyChildren(node.children, field)
|
|
22194
22157
|
};
|
|
22195
22158
|
case plateElements.ELEMENT_BLOCKQUOTE:
|
|
22196
22159
|
return {
|
|
22197
22160
|
type: "blockquote",
|
|
22198
|
-
children: stringifyChildren(node.children, field
|
|
22161
|
+
children: stringifyChildren(node.children, field)
|
|
22199
22162
|
};
|
|
22200
22163
|
case "mdxJsxTextElement":
|
|
22201
22164
|
case "mdxJsxFlowElement":
|
|
@@ -22360,7 +22323,7 @@ var stringify = (node, field, graphQLconfig) => {
|
|
|
22360
22323
|
}
|
|
22361
22324
|
break;
|
|
22362
22325
|
case "rich-text":
|
|
22363
|
-
const tree = stringifyChildren(value.children, field2
|
|
22326
|
+
const tree = stringifyChildren(value.children, field2);
|
|
22364
22327
|
if (field2.name === "children") {
|
|
22365
22328
|
children2 = tree;
|
|
22366
22329
|
} else {
|
|
@@ -22788,10 +22751,6 @@ var Resolver = class {
|
|
|
22788
22751
|
})
|
|
22789
22752
|
};
|
|
22790
22753
|
};
|
|
22791
|
-
this.getDocumentsForCollection = async (collectionName) => {
|
|
22792
|
-
const collection = this.tinaSchema.getCollection(collectionName);
|
|
22793
|
-
return this.database.store.glob(collection.path, this.getDocument);
|
|
22794
|
-
};
|
|
22795
22754
|
this.referenceResolver = async (filter, fieldDefinition) => {
|
|
22796
22755
|
const referencedCollection = this.tinaSchema.getCollection(fieldDefinition.collections[0]);
|
|
22797
22756
|
if (!referencedCollection) {
|
|
@@ -22816,9 +22775,11 @@ var Resolver = class {
|
|
|
22816
22775
|
collection,
|
|
22817
22776
|
hydrator
|
|
22818
22777
|
}) => {
|
|
22778
|
+
var _a, _b, _c, _d;
|
|
22819
22779
|
let edges;
|
|
22820
22780
|
let pageInfo;
|
|
22821
|
-
|
|
22781
|
+
const useDataLayer = Boolean((_d = (_c = (_b = (_a = this.tinaSchema) == null ? void 0 : _a.config) == null ? void 0 : _b.meta) == null ? void 0 : _c.flags) == null ? void 0 : _d.find((x) => x === "experimentalData"));
|
|
22782
|
+
if (useDataLayer) {
|
|
22822
22783
|
let conditions;
|
|
22823
22784
|
if (args.filter) {
|
|
22824
22785
|
if (collection.fields) {
|
|
@@ -22883,16 +22844,15 @@ var Resolver = class {
|
|
|
22883
22844
|
case "string":
|
|
22884
22845
|
case "boolean":
|
|
22885
22846
|
case "number":
|
|
22886
|
-
accum[fieldName] = fieldValue;
|
|
22887
|
-
break;
|
|
22888
22847
|
case "image":
|
|
22889
|
-
accum[fieldName] =
|
|
22848
|
+
accum[fieldName] = fieldValue;
|
|
22890
22849
|
break;
|
|
22891
22850
|
case "object":
|
|
22892
22851
|
accum[fieldName] = this.buildObjectMutations(fieldValue, field);
|
|
22893
22852
|
break;
|
|
22894
22853
|
case "rich-text":
|
|
22895
|
-
|
|
22854
|
+
field;
|
|
22855
|
+
accum[fieldName] = stringifyMDX(fieldValue, field);
|
|
22896
22856
|
break;
|
|
22897
22857
|
case "reference":
|
|
22898
22858
|
accum[fieldName] = fieldValue;
|
|
@@ -22925,10 +22885,18 @@ var Resolver = class {
|
|
|
22925
22885
|
accumulator[field.name] = value;
|
|
22926
22886
|
break;
|
|
22927
22887
|
case "image":
|
|
22928
|
-
|
|
22888
|
+
if (this.config) {
|
|
22889
|
+
if (this.config.useRelativeMedia === true) {
|
|
22890
|
+
accumulator[field.name] = value;
|
|
22891
|
+
} else {
|
|
22892
|
+
accumulator[field.name] = `https://${this.config.assetsHost}/${this.config.clientId}/${value}`;
|
|
22893
|
+
}
|
|
22894
|
+
} else {
|
|
22895
|
+
accumulator[field.name] = value;
|
|
22896
|
+
}
|
|
22929
22897
|
break;
|
|
22930
22898
|
case "rich-text":
|
|
22931
|
-
const tree = parseMDX(value, field
|
|
22899
|
+
const tree = parseMDX(value, field);
|
|
22932
22900
|
accumulator[field.name] = tree;
|
|
22933
22901
|
break;
|
|
22934
22902
|
case "object":
|
|
@@ -23035,12 +23003,14 @@ var resolve = async ({
|
|
|
23035
23003
|
database,
|
|
23036
23004
|
silenceErrors
|
|
23037
23005
|
}) => {
|
|
23006
|
+
var _a;
|
|
23038
23007
|
try {
|
|
23039
23008
|
const graphQLSchemaAst = await database.getGraphQLSchema();
|
|
23040
23009
|
const graphQLSchema = (0, import_graphql3.buildASTSchema)(graphQLSchemaAst);
|
|
23041
23010
|
const tinaConfig = await database.getTinaSchema();
|
|
23042
23011
|
const tinaSchema = await createSchema({
|
|
23043
|
-
schema: tinaConfig
|
|
23012
|
+
schema: tinaConfig,
|
|
23013
|
+
flags: (_a = tinaConfig == null ? void 0 : tinaConfig.meta) == null ? void 0 : _a.flags
|
|
23044
23014
|
});
|
|
23045
23015
|
const resolver2 = await createResolver2({ config, database, tinaSchema });
|
|
23046
23016
|
const res = await (0, import_graphql3.graphql)({
|
|
@@ -23074,8 +23044,8 @@ var resolve = async ({
|
|
|
23074
23044
|
if (info.fieldName === "collections") {
|
|
23075
23045
|
const collectionNode2 = info.fieldNodes.find((x) => x.name.value === "collections");
|
|
23076
23046
|
const hasDocuments2 = collectionNode2.selectionSet.selections.find((x) => {
|
|
23077
|
-
var
|
|
23078
|
-
return ((
|
|
23047
|
+
var _a2;
|
|
23048
|
+
return ((_a2 = x == null ? void 0 : x.name) == null ? void 0 : _a2.value) === "documents";
|
|
23079
23049
|
});
|
|
23080
23050
|
return tinaSchema.getCollections().map((collection) => {
|
|
23081
23051
|
return resolver2.resolveCollection(args, collection.name, Boolean(hasDocuments2));
|
|
@@ -23083,8 +23053,8 @@ var resolve = async ({
|
|
|
23083
23053
|
}
|
|
23084
23054
|
const collectionNode = info.fieldNodes.find((x) => x.name.value === "collection");
|
|
23085
23055
|
const hasDocuments = collectionNode.selectionSet.selections.find((x) => {
|
|
23086
|
-
var
|
|
23087
|
-
return ((
|
|
23056
|
+
var _a2;
|
|
23057
|
+
return ((_a2 = x == null ? void 0 : x.name) == null ? void 0 : _a2.value) === "documents";
|
|
23088
23058
|
});
|
|
23089
23059
|
return resolver2.resolveCollection(args, args.collection, Boolean(hasDocuments));
|
|
23090
23060
|
}
|
|
@@ -23658,6 +23628,10 @@ var Database = class {
|
|
|
23658
23628
|
}
|
|
23659
23629
|
return { pathsByCollection, nonCollectionPaths, collections };
|
|
23660
23630
|
}
|
|
23631
|
+
clearCache() {
|
|
23632
|
+
this.tinaSchema = null;
|
|
23633
|
+
this._lookup = null;
|
|
23634
|
+
}
|
|
23661
23635
|
async indexStatusCallbackWrapper(fn) {
|
|
23662
23636
|
await this.indexStatusCallback({ status: "inprogress" });
|
|
23663
23637
|
try {
|
package/dist/mdx/parse.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ limitations under the License.
|
|
|
16
16
|
|
|
17
17
|
*/
|
|
18
18
|
import type { Content } from 'mdast';
|
|
19
|
-
import type {
|
|
20
|
-
export declare const parseMDX: (value: string, field: RichTypeInner
|
|
19
|
+
import type { RichTypeInner } from '../types';
|
|
20
|
+
export declare const parseMDX: (value: string, field: RichTypeInner) => {
|
|
21
21
|
type: string;
|
|
22
22
|
children: any;
|
|
23
23
|
};
|
|
@@ -70,7 +70,7 @@ export declare const parseMDX: (value: string, field: RichTypeInner, graphQLconf
|
|
|
70
70
|
* 2. We don't need to do any client-side parsing. Since TinaMarkdown and the slate editor work with the same
|
|
71
71
|
* format we can just allow Tina to do it's thing and update the form valuse with no additional work.
|
|
72
72
|
*/
|
|
73
|
-
export declare const parseMDXInner: (tree: any, field: RichTypeInner
|
|
73
|
+
export declare const parseMDXInner: (tree: any, field: RichTypeInner) => {
|
|
74
74
|
type: string;
|
|
75
75
|
children: any;
|
|
76
76
|
};
|
|
@@ -226,5 +226,5 @@ export declare const plateElements: {
|
|
|
226
226
|
MARK_UNDERLINE: string;
|
|
227
227
|
};
|
|
228
228
|
export declare const defaultNodeTypes: NodeTypes;
|
|
229
|
-
export default function remarkToSlate(node: MdxAstNode
|
|
229
|
+
export default function remarkToSlate(node: MdxAstNode): any;
|
|
230
230
|
export {};
|
package/dist/mdx/stringify.d.ts
CHANGED
|
@@ -15,10 +15,10 @@ See the License for the specific language governing permissions and
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
|
|
17
17
|
*/
|
|
18
|
-
import type {
|
|
18
|
+
import type { RichTypeInner } from '../types';
|
|
19
19
|
import { plateElements } from './parse';
|
|
20
20
|
import type { Content } from 'mdast';
|
|
21
|
-
export declare const stringifyMDX: (value: unknown, field: RichTypeInner
|
|
21
|
+
export declare const stringifyMDX: (value: unknown, field: RichTypeInner) => string;
|
|
22
22
|
export declare const stringify: (node: {
|
|
23
23
|
type: typeof plateElements;
|
|
24
|
-
}, field: RichTypeInner
|
|
24
|
+
}, field: RichTypeInner) => Content;
|
package/dist/resolver/index.d.ts
CHANGED
|
@@ -203,7 +203,6 @@ export declare class Resolver {
|
|
|
203
203
|
};
|
|
204
204
|
}[];
|
|
205
205
|
}>;
|
|
206
|
-
getDocumentsForCollection: (collectionName: string) => Promise<string[]>;
|
|
207
206
|
private referenceResolver;
|
|
208
207
|
private resolveFilterConditions;
|
|
209
208
|
resolveCollectionConnection: ({ args, collection, hydrator, }: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/graphql",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-202258204527",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@graphql-tools/relay-operation-optimizer": "^6.4.1",
|
|
50
|
-
"@tinacms/datalayer": "0.
|
|
50
|
+
"@tinacms/datalayer": "0.0.0-202258204527",
|
|
51
51
|
"body-parser": "^1.19.0",
|
|
52
52
|
"cors": "^2.8.5",
|
|
53
53
|
"dataloader": "^2.0.0",
|
|
@@ -97,9 +97,9 @@
|
|
|
97
97
|
"directory": "packages/tina-graphql"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
|
-
"@tinacms/datalayer": "0.
|
|
101
|
-
"@tinacms/schema-tools": "0.0.
|
|
102
|
-
"@tinacms/scripts": "0.
|
|
100
|
+
"@tinacms/datalayer": "0.0.0-202258204527",
|
|
101
|
+
"@tinacms/schema-tools": "0.0.0-202258204527",
|
|
102
|
+
"@tinacms/scripts": "0.0.0-202258204527",
|
|
103
103
|
"@types/cors": "^2.8.7",
|
|
104
104
|
"@types/estree": "^0.0.50",
|
|
105
105
|
"@types/express": "^4.17.8",
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Copyright 2021 Forestry.io Holdings, Inc.
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software
|
|
8
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
-
See the License for the specific language governing permissions and
|
|
11
|
-
limitations under the License.
|
|
12
|
-
*/
|
|
13
|
-
import { GraphQLConfig } from '../types';
|
|
14
|
-
/**
|
|
15
|
-
* Strips away the Tina Cloud Asset URL from an `image` value
|
|
16
|
-
*
|
|
17
|
-
* @param {string} value
|
|
18
|
-
* @param {GraphQLConfig} config
|
|
19
|
-
* @returns {string}
|
|
20
|
-
*/
|
|
21
|
-
export declare const resolveMediaCloudToRelative: (value: string, config?: GraphQLConfig) => string;
|
|
22
|
-
/**
|
|
23
|
-
* Adds Tina Cloud Asset URL to an `image` value
|
|
24
|
-
*
|
|
25
|
-
* @param {string} value
|
|
26
|
-
* @param {GraphQLConfig} config
|
|
27
|
-
* @returns {string}
|
|
28
|
-
*/
|
|
29
|
-
export declare const resolveMediaRelativeToCloud: (value: string, config?: GraphQLConfig) => string;
|