@tinacms/graphql 0.0.0-eb519f2-20241015053224 → 0.0.0-ebe1b69-20250211022853

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 CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -130,6 +134,15 @@ var SysFieldDefinition = {
130
134
  selectionSet: {
131
135
  kind: "SelectionSet",
132
136
  selections: [
137
+ // {
138
+ // kind: 'Field' as const,
139
+ // name: {
140
+ // kind: 'Name' as const,
141
+ // value: 'title',
142
+ // },
143
+ // arguments: [],
144
+ // directives: [],
145
+ // },
133
146
  {
134
147
  kind: "Field",
135
148
  name: {
@@ -148,6 +161,15 @@ var SysFieldDefinition = {
148
161
  arguments: [],
149
162
  directives: []
150
163
  },
164
+ {
165
+ kind: "Field",
166
+ name: {
167
+ kind: "Name",
168
+ value: "hasReferences"
169
+ },
170
+ arguments: [],
171
+ directives: []
172
+ },
151
173
  {
152
174
  kind: "Field",
153
175
  name: {
@@ -188,6 +210,10 @@ var SysFieldDefinition = {
188
210
  }
189
211
  };
190
212
  var astBuilder = {
213
+ /**
214
+ * `FormFieldBuilder` acts as a shortcut to building an entire `ObjectTypeDefinition`, we use this
215
+ * because all Tina field objects share a common set of fields ('name', 'label', 'component')
216
+ */
191
217
  FormFieldBuilder: ({
192
218
  name,
193
219
  additionalFields
@@ -411,6 +437,8 @@ var astBuilder = {
411
437
  kind: "Name",
412
438
  value: name
413
439
  },
440
+ // @ts-ignore FIXME; this is being handled properly but we're lying to
441
+ // ts and then fixing it in the `extractInlineTypes` function
414
442
  fields
415
443
  }),
416
444
  UnionTypeDefinition: ({
@@ -423,6 +451,8 @@ var astBuilder = {
423
451
  value: name
424
452
  },
425
453
  directives: [],
454
+ // @ts-ignore FIXME; this is being handled properly but we're lying to
455
+ // ts and then fixing it in the `extractInlineTypes` function
426
456
  types: types.map((name2) => ({
427
457
  kind: "NamedType",
428
458
  name: {
@@ -519,8 +549,11 @@ var astBuilder = {
519
549
  string: "String",
520
550
  boolean: "Boolean",
521
551
  number: "Float",
552
+ // FIXME - needs to be float or int
522
553
  datetime: "String",
554
+ // FIXME
523
555
  image: "String",
556
+ // FIXME
524
557
  text: "String"
525
558
  };
526
559
  return scalars[type];
@@ -1019,8 +1052,7 @@ var astBuilder = {
1019
1052
  }
1020
1053
  };
1021
1054
  var capitalize = (s) => {
1022
- if (typeof s !== "string")
1023
- return "";
1055
+ if (typeof s !== "string") return "";
1024
1056
  return s.charAt(0).toUpperCase() + s.slice(1);
1025
1057
  };
1026
1058
  var extractInlineTypes = (item) => {
@@ -1063,41 +1095,6 @@ function* walk(maybeNode, visited = /* @__PURE__ */ new WeakSet()) {
1063
1095
  yield maybeNode;
1064
1096
  visited.add(maybeNode);
1065
1097
  }
1066
- function addNamespaceToSchema(maybeNode, namespace = []) {
1067
- if (typeof maybeNode === "string") {
1068
- return maybeNode;
1069
- }
1070
- if (typeof maybeNode === "boolean") {
1071
- return maybeNode;
1072
- }
1073
- const newNode = maybeNode;
1074
- const keys = Object.keys(maybeNode);
1075
- Object.values(maybeNode).map((m, index) => {
1076
- const key = keys[index];
1077
- if (Array.isArray(m)) {
1078
- newNode[key] = m.map((element) => {
1079
- if (!element) {
1080
- return;
1081
- }
1082
- if (!element.hasOwnProperty("name")) {
1083
- return element;
1084
- }
1085
- const value = element.name || element.value;
1086
- return addNamespaceToSchema(element, [...namespace, value]);
1087
- });
1088
- } else {
1089
- if (!m) {
1090
- return;
1091
- }
1092
- if (!m.hasOwnProperty("name")) {
1093
- newNode[key] = m;
1094
- } else {
1095
- newNode[key] = addNamespaceToSchema(m, [...namespace, m.name]);
1096
- }
1097
- }
1098
- });
1099
- return { ...newNode, namespace };
1100
- }
1101
1098
  var generateNamespacedFieldName = (names, suffix = "") => {
1102
1099
  return (suffix ? [...names, suffix] : names).map(capitalize).join("");
1103
1100
  };
@@ -1257,6 +1254,11 @@ var scalarDefinitions = [
1257
1254
  required: true,
1258
1255
  type: astBuilder.TYPES.String
1259
1256
  }),
1257
+ astBuilder.FieldDefinition({
1258
+ name: "hasReferences",
1259
+ required: false,
1260
+ type: astBuilder.TYPES.Boolean
1261
+ }),
1260
1262
  astBuilder.FieldDefinition({
1261
1263
  name: "breadcrumbs",
1262
1264
  required: true,
@@ -1471,6 +1473,19 @@ var Builder = class {
1471
1473
  this.addToLookupMap = (lookup) => {
1472
1474
  this.lookupMap[lookup.type] = lookup;
1473
1475
  };
1476
+ /**
1477
+ * ```graphql
1478
+ * # ex.
1479
+ * {
1480
+ * getCollection(collection: $collection) {
1481
+ * name
1482
+ * documents {...}
1483
+ * }
1484
+ * }
1485
+ * ```
1486
+ *
1487
+ * @param collections
1488
+ */
1474
1489
  this.buildCollectionDefinition = async (collections) => {
1475
1490
  const name = "collection";
1476
1491
  const typeName = "Collection";
@@ -1541,6 +1556,19 @@ var Builder = class {
1541
1556
  required: true
1542
1557
  });
1543
1558
  };
1559
+ /**
1560
+ * ```graphql
1561
+ * # ex.
1562
+ * {
1563
+ * getCollections {
1564
+ * name
1565
+ * documents {...}
1566
+ * }
1567
+ * }
1568
+ * ```
1569
+ *
1570
+ * @param collections
1571
+ */
1544
1572
  this.buildMultiCollectionDefinition = async (collections) => {
1545
1573
  const name = "collections";
1546
1574
  const typeName = "Collection";
@@ -1551,6 +1579,17 @@ var Builder = class {
1551
1579
  required: true
1552
1580
  });
1553
1581
  };
1582
+ /**
1583
+ * ```graphql
1584
+ * # ex.
1585
+ * {
1586
+ * node(id: $id) {
1587
+ * id
1588
+ * data {...}
1589
+ * }
1590
+ * }
1591
+ * ```
1592
+ */
1554
1593
  this.multiNodeDocument = async () => {
1555
1594
  const name = "node";
1556
1595
  const args = [
@@ -1571,6 +1610,19 @@ var Builder = class {
1571
1610
  required: true
1572
1611
  });
1573
1612
  };
1613
+ /**
1614
+ * ```graphql
1615
+ * # ex.
1616
+ * {
1617
+ * getDocument(collection: $collection, relativePath: $relativePath) {
1618
+ * id
1619
+ * data {...}
1620
+ * }
1621
+ * }
1622
+ * ```
1623
+ *
1624
+ * @param collections
1625
+ */
1574
1626
  this.multiCollectionDocument = async (collections) => {
1575
1627
  const name = "document";
1576
1628
  const args = [
@@ -1596,6 +1648,19 @@ var Builder = class {
1596
1648
  required: true
1597
1649
  });
1598
1650
  };
1651
+ /**
1652
+ * ```graphql
1653
+ * # ex.
1654
+ * {
1655
+ * addPendingDocument(collection: $collection, relativePath: $relativePath, params: $params) {
1656
+ * id
1657
+ * data {...}
1658
+ * }
1659
+ * }
1660
+ * ```
1661
+ *
1662
+ * @param collections
1663
+ */
1599
1664
  this.addMultiCollectionDocumentMutation = async () => {
1600
1665
  return astBuilder.FieldDefinition({
1601
1666
  name: "addPendingDocument",
@@ -1620,6 +1685,19 @@ var Builder = class {
1620
1685
  type: astBuilder.TYPES.MultiCollectionDocument
1621
1686
  });
1622
1687
  };
1688
+ /**
1689
+ * ```graphql
1690
+ * # ex.
1691
+ * {
1692
+ * createDocument(relativePath: $relativePath, params: $params) {
1693
+ * id
1694
+ * data {...}
1695
+ * }
1696
+ * }
1697
+ * ```
1698
+ *
1699
+ * @param collections
1700
+ */
1623
1701
  this.buildCreateCollectionDocumentMutation = async (collections) => {
1624
1702
  return astBuilder.FieldDefinition({
1625
1703
  name: "createDocument",
@@ -1647,6 +1725,19 @@ var Builder = class {
1647
1725
  type: astBuilder.TYPES.MultiCollectionDocument
1648
1726
  });
1649
1727
  };
1728
+ /**
1729
+ * ```graphql
1730
+ * # ex.
1731
+ * {
1732
+ * updateDocument(relativePath: $relativePath, params: $params) {
1733
+ * id
1734
+ * data {...}
1735
+ * }
1736
+ * }
1737
+ * ```
1738
+ *
1739
+ * @param collections
1740
+ */
1650
1741
  this.buildUpdateCollectionDocumentMutation = async (collections) => {
1651
1742
  return astBuilder.FieldDefinition({
1652
1743
  name: "updateDocument",
@@ -1674,6 +1765,19 @@ var Builder = class {
1674
1765
  type: astBuilder.TYPES.MultiCollectionDocument
1675
1766
  });
1676
1767
  };
1768
+ /**
1769
+ * ```graphql
1770
+ * # ex.
1771
+ * {
1772
+ * deleteDocument(relativePath: $relativePath, params: $params) {
1773
+ * id
1774
+ * data {...}
1775
+ * }
1776
+ * }
1777
+ * ```
1778
+ *
1779
+ * @param collections
1780
+ */
1677
1781
  this.buildDeleteCollectionDocumentMutation = async (collections) => {
1678
1782
  return astBuilder.FieldDefinition({
1679
1783
  name: "deleteDocument",
@@ -1693,6 +1797,19 @@ var Builder = class {
1693
1797
  type: astBuilder.TYPES.MultiCollectionDocument
1694
1798
  });
1695
1799
  };
1800
+ /**
1801
+ * ```graphql
1802
+ * # ex.
1803
+ * {
1804
+ * createFolder(folderName: $folderName, params: $params) {
1805
+ * id
1806
+ * data {...}
1807
+ * }
1808
+ * }
1809
+ * ```
1810
+ *
1811
+ * @param collections
1812
+ */
1696
1813
  this.buildCreateCollectionFolderMutation = async () => {
1697
1814
  return astBuilder.FieldDefinition({
1698
1815
  name: "createFolder",
@@ -1712,6 +1829,19 @@ var Builder = class {
1712
1829
  type: astBuilder.TYPES.MultiCollectionDocument
1713
1830
  });
1714
1831
  };
1832
+ /**
1833
+ * ```graphql
1834
+ * # ex.
1835
+ * {
1836
+ * getPostDocument(relativePath: $relativePath) {
1837
+ * id
1838
+ * data {...}
1839
+ * }
1840
+ * }
1841
+ * ```
1842
+ *
1843
+ * @param collection
1844
+ */
1715
1845
  this.collectionDocument = async (collection) => {
1716
1846
  const name = NAMER.queryName([collection.name]);
1717
1847
  const type = await this._buildCollectionDocumentType(collection);
@@ -1772,6 +1902,20 @@ var Builder = class {
1772
1902
  const args = [];
1773
1903
  return astBuilder.FieldDefinition({ type, name, args, required: false });
1774
1904
  };
1905
+ /**
1906
+ * Turns a collection into a fragment that gets updated on build. This fragment does not resolve references
1907
+ * ```graphql
1908
+ * # ex.
1909
+ * fragment AuthorsParts on Authors {
1910
+ * name
1911
+ * avatar
1912
+ * ...
1913
+ * }
1914
+ * ```
1915
+ *
1916
+ * @public
1917
+ * @param collection a Tina Cloud collection
1918
+ */
1775
1919
  this.collectionFragment = async (collection) => {
1776
1920
  const name = NAMER.dataTypeName(collection.namespace);
1777
1921
  const fragmentName = NAMER.fragmentName(collection.namespace);
@@ -1785,6 +1929,20 @@ var Builder = class {
1785
1929
  selections: filterSelections(selections)
1786
1930
  });
1787
1931
  };
1932
+ /**
1933
+ * Given a collection this function returns its selections set. For example for Post this would return
1934
+ *
1935
+ * "
1936
+ * body
1937
+ * title
1938
+ * ... on Author {
1939
+ * name
1940
+ * heroImg
1941
+ * }
1942
+ *
1943
+ * But in the AST format
1944
+ *
1945
+ * */
1788
1946
  this._getCollectionFragmentSelections = async (collection, depth) => {
1789
1947
  var _a;
1790
1948
  const selections = [];
@@ -1868,9 +2026,9 @@ var Builder = class {
1868
2026
  ]
1869
2027
  });
1870
2028
  }
2029
+ // TODO: Should we throw here?
1871
2030
  case "reference":
1872
- if (depth >= this.maxDepth)
1873
- return false;
2031
+ if (depth >= this.maxDepth) return false;
1874
2032
  if (!("collections" in field)) {
1875
2033
  return false;
1876
2034
  }
@@ -1902,6 +2060,7 @@ var Builder = class {
1902
2060
  name: field.name,
1903
2061
  selections: [
1904
2062
  ...selections,
2063
+ // This is ... on Document { id }
1905
2064
  {
1906
2065
  kind: "InlineFragment",
1907
2066
  typeCondition: {
@@ -1932,6 +2091,19 @@ var Builder = class {
1932
2091
  });
1933
2092
  }
1934
2093
  };
2094
+ /**
2095
+ * ```graphql
2096
+ * # ex.
2097
+ * mutation {
2098
+ * updatePostDocument(relativePath: $relativePath, params: $params) {
2099
+ * id
2100
+ * data {...}
2101
+ * }
2102
+ * }
2103
+ * ```
2104
+ *
2105
+ * @param collection
2106
+ */
1935
2107
  this.updateCollectionDocumentMutation = async (collection) => {
1936
2108
  return astBuilder.FieldDefinition({
1937
2109
  type: await this._buildCollectionDocumentType(collection),
@@ -1951,6 +2123,19 @@ var Builder = class {
1951
2123
  ]
1952
2124
  });
1953
2125
  };
2126
+ /**
2127
+ * ```graphql
2128
+ * # ex.
2129
+ * mutation {
2130
+ * createPostDocument(relativePath: $relativePath, params: $params) {
2131
+ * id
2132
+ * data {...}
2133
+ * }
2134
+ * }
2135
+ * ```
2136
+ *
2137
+ * @param collection
2138
+ */
1954
2139
  this.createCollectionDocumentMutation = async (collection) => {
1955
2140
  return astBuilder.FieldDefinition({
1956
2141
  type: await this._buildCollectionDocumentType(collection),
@@ -1970,6 +2155,22 @@ var Builder = class {
1970
2155
  ]
1971
2156
  });
1972
2157
  };
2158
+ /**
2159
+ * ```graphql
2160
+ * # ex.
2161
+ * {
2162
+ * getPostList(first: 10) {
2163
+ * edges {
2164
+ * node {
2165
+ * id
2166
+ * }
2167
+ * }
2168
+ * }
2169
+ * }
2170
+ * ```
2171
+ *
2172
+ * @param collection
2173
+ */
1973
2174
  this.collectionDocumentList = async (collection) => {
1974
2175
  const connectionName = NAMER.referenceConnectionType(collection.namespace);
1975
2176
  this.addToLookupMap({
@@ -1985,6 +2186,10 @@ var Builder = class {
1985
2186
  collection
1986
2187
  });
1987
2188
  };
2189
+ /**
2190
+ * GraphQL type definitions which remain unchanged regardless
2191
+ * of the supplied Tina schema. Ex. "node" interface
2192
+ */
1988
2193
  this.buildStaticDefinitions = () => staticDefinitions;
1989
2194
  this._buildCollectionDocumentType = async (collection, suffix = "", extraFields = [], extraInterfaces = []) => {
1990
2195
  const documentTypeName = NAMER.documentTypeName(collection.namespace);
@@ -2489,6 +2694,7 @@ var Builder = class {
2489
2694
  name: NAMER.dataFilterTypeName(namespace),
2490
2695
  fields: await sequential(collections, async (collection2) => {
2491
2696
  return astBuilder.InputValueDefinition({
2697
+ // @ts-ignore
2492
2698
  name: collection2.name,
2493
2699
  type: NAMER.dataFilterTypeName(collection2.namespace)
2494
2700
  });
@@ -2678,7 +2884,8 @@ Visit https://tina.io/docs/errors/ui-not-supported/ for more information
2678
2884
  });
2679
2885
  };
2680
2886
  var _a, _b, _c, _d;
2681
- this.maxDepth = (_d = (_c = (_b = (_a = config == null ? void 0 : config.tinaSchema.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.client) == null ? void 0 : _c.referenceDepth) != null ? _d : 2;
2887
+ this.maxDepth = // @ts-ignore
2888
+ (_d = (_c = (_b = (_a = config == null ? void 0 : config.tinaSchema.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.client) == null ? void 0 : _c.referenceDepth) != null ? _d : 2;
2682
2889
  this.tinaSchema = config.tinaSchema;
2683
2890
  this.lookupMap = {};
2684
2891
  }
@@ -2689,8 +2896,7 @@ Visit https://tina.io/docs/errors/ui-not-supported/ for more information
2689
2896
  selections.push(field);
2690
2897
  });
2691
2898
  const filteredSelections = filterSelections(selections);
2692
- if (!filteredSelections.length)
2693
- return false;
2899
+ if (!filteredSelections.length) return false;
2694
2900
  return astBuilder.InlineFragmentDefinition({
2695
2901
  selections: filteredSelections,
2696
2902
  name: NAMER.dataTypeName(template.namespace)
@@ -2724,12 +2930,13 @@ var filterSelections = (arr) => {
2724
2930
  };
2725
2931
 
2726
2932
  // src/schema/createSchema.ts
2727
- var import_schema_tools2 = require("@tinacms/schema-tools");
2933
+ var import_schema_tools3 = require("@tinacms/schema-tools");
2728
2934
 
2729
2935
  // src/schema/validate.ts
2936
+ var import_schema_tools = require("@tinacms/schema-tools");
2730
2937
  var import_lodash2 = __toESM(require("lodash.clonedeep"));
2731
2938
  var yup2 = __toESM(require("yup"));
2732
- var import_schema_tools = require("@tinacms/schema-tools");
2939
+ var import_schema_tools2 = require("@tinacms/schema-tools");
2733
2940
  var FIELD_TYPES = [
2734
2941
  "string",
2735
2942
  "number",
@@ -2742,7 +2949,7 @@ var FIELD_TYPES = [
2742
2949
  "password"
2743
2950
  ];
2744
2951
  var validateSchema = async (schema) => {
2745
- const schema2 = addNamespaceToSchema(
2952
+ const schema2 = (0, import_schema_tools.addNamespaceToSchema)(
2746
2953
  (0, import_lodash2.default)(schema)
2747
2954
  );
2748
2955
  const collections = await sequential(
@@ -2751,7 +2958,7 @@ var validateSchema = async (schema) => {
2751
2958
  );
2752
2959
  validationCollectionsPathAndMatch(collections);
2753
2960
  if (schema2.config) {
2754
- const config = (0, import_schema_tools.validateTinaCloudSchemaConfig)(schema2.config);
2961
+ const config = (0, import_schema_tools2.validateTinaCloudSchemaConfig)(schema2.config);
2755
2962
  return {
2756
2963
  collections,
2757
2964
  config
@@ -2771,6 +2978,7 @@ var validationCollectionsPathAndMatch = (collections) => {
2771
2978
  }).map((x) => `${x.path}${x.format || "md"}`);
2772
2979
  if (noMatchCollections.length !== new Set(noMatchCollections).size) {
2773
2980
  throw new Error(
2981
+ // TODO: add a link to the docs
2774
2982
  "Two collections without match can not have the same `path`. Please make the `path` unique or add a matches property to the collection."
2775
2983
  );
2776
2984
  }
@@ -2882,7 +3090,7 @@ var validateField = async (field) => {
2882
3090
  // package.json
2883
3091
  var package_default = {
2884
3092
  name: "@tinacms/graphql",
2885
- version: "1.5.5",
3093
+ version: "1.5.11",
2886
3094
  main: "dist/index.js",
2887
3095
  module: "dist/index.mjs",
2888
3096
  typings: "dist/index.d.ts",
@@ -2909,8 +3117,8 @@ var package_default = {
2909
3117
  build: "tinacms-scripts build",
2910
3118
  docs: "pnpm typedoc",
2911
3119
  serve: "pnpm nodemon dist/server.js",
2912
- test: "jest",
2913
- "test-watch": "jest --watch"
3120
+ test: "vitest run",
3121
+ "test-watch": "vitest"
2914
3122
  },
2915
3123
  dependencies: {
2916
3124
  "@iarna/toml": "^2.2.5",
@@ -2926,7 +3134,7 @@ var package_default = {
2926
3134
  "isomorphic-git": "^1.27.1",
2927
3135
  "js-sha1": "^0.6.0",
2928
3136
  "js-yaml": "^3.14.1",
2929
- "jsonpath-plus": "^6.0.1",
3137
+ "jsonpath-plus": "10.1.0",
2930
3138
  "lodash.clonedeep": "^4.5.0",
2931
3139
  "lodash.set": "^4.3.2",
2932
3140
  "lodash.uniqby": "^4.7.0",
@@ -2951,24 +3159,23 @@ var package_default = {
2951
3159
  "@types/estree": "^0.0.50",
2952
3160
  "@types/express": "^4.17.21",
2953
3161
  "@types/fs-extra": "^9.0.13",
2954
- "@types/jest": "^26.0.24",
2955
3162
  "@types/js-yaml": "^3.12.10",
2956
3163
  "@types/lodash.camelcase": "^4.3.9",
2957
3164
  "@types/lodash.upperfirst": "^4.3.9",
2958
3165
  "@types/lru-cache": "^5.1.1",
2959
3166
  "@types/mdast": "^3.0.15",
2960
3167
  "@types/micromatch": "^4.0.9",
2961
- "@types/node": "^22.7.4",
3168
+ "@types/node": "^22.9.0",
2962
3169
  "@types/normalize-path": "^3.0.2",
2963
3170
  "@types/ws": "^7.4.7",
2964
3171
  "@types/yup": "^0.29.14",
2965
- jest: "^29.7.0",
2966
- "jest-diff": "^29.7.0",
2967
3172
  "jest-file-snapshot": "^0.5.0",
2968
- "jest-matcher-utils": "^29.7.0",
2969
3173
  "memory-level": "^1.0.0",
2970
3174
  nodemon: "3.1.4",
2971
- typescript: "^5.6.2"
3175
+ typescript: "^5.6.3",
3176
+ vite: "^4.3.9",
3177
+ vitest: "^0.32.2",
3178
+ zod: "^3.23.8"
2972
3179
  }
2973
3180
  };
2974
3181
 
@@ -2983,7 +3190,7 @@ var createSchema = async ({
2983
3190
  if (flags && flags.length > 0) {
2984
3191
  meta["flags"] = flags;
2985
3192
  }
2986
- return new import_schema_tools2.TinaSchema({
3193
+ return new import_schema_tools3.TinaSchema({
2987
3194
  version: {
2988
3195
  fullVersion: package_default.version,
2989
3196
  major,
@@ -3039,6 +3246,7 @@ var _buildFragments = async (builder, tinaSchema) => {
3039
3246
  const fragDoc = {
3040
3247
  kind: "Document",
3041
3248
  definitions: (0, import_lodash3.default)(
3249
+ // @ts-ignore
3042
3250
  extractInlineTypes(fragmentDefinitionsFields),
3043
3251
  (node) => node.name.value
3044
3252
  )
@@ -3062,6 +3270,7 @@ var _buildQueries = async (builder, tinaSchema) => {
3062
3270
  fragName,
3063
3271
  queryName: queryListName,
3064
3272
  filterType: queryFilterTypeName,
3273
+ // look for flag to see if the data layer is enabled
3065
3274
  dataLayer: Boolean(
3066
3275
  (_c = (_b = (_a = tinaSchema.config) == null ? void 0 : _a.meta) == null ? void 0 : _b.flags) == null ? void 0 : _c.find((x) => x === "experimentalData")
3067
3276
  )
@@ -3071,6 +3280,7 @@ var _buildQueries = async (builder, tinaSchema) => {
3071
3280
  const queryDoc = {
3072
3281
  kind: "Document",
3073
3282
  definitions: (0, import_lodash3.default)(
3283
+ // @ts-ignore
3074
3284
  extractInlineTypes(operationsDefinitions),
3075
3285
  (node) => node.name.value
3076
3286
  )
@@ -3159,6 +3369,7 @@ var _buildSchema = async (builder, tinaSchema) => {
3159
3369
  return {
3160
3370
  kind: "Document",
3161
3371
  definitions: (0, import_lodash3.default)(
3372
+ // @ts-ignore
3162
3373
  extractInlineTypes(definitions),
3163
3374
  (node) => node.name.value
3164
3375
  )
@@ -3175,6 +3386,9 @@ var import_isValid = __toESM(require("date-fns/isValid/index.js"));
3175
3386
  // src/mdx/index.ts
3176
3387
  var import_mdx = require("@tinacms/mdx");
3177
3388
 
3389
+ // src/resolver/index.ts
3390
+ var import_jsonpath_plus2 = require("jsonpath-plus");
3391
+
3178
3392
  // src/resolver/error.ts
3179
3393
  var TinaGraphQLError = class extends Error {
3180
3394
  constructor(message, extensions) {
@@ -3360,8 +3574,7 @@ var resolveMediaCloudToRelative = (value, config = { useRelativeMedia: true }, s
3360
3574
  }
3361
3575
  if (Array.isArray(value)) {
3362
3576
  return value.map((v) => {
3363
- if (!v || typeof v !== "string")
3364
- return v;
3577
+ if (!v || typeof v !== "string") return v;
3365
3578
  const cleanMediaRoot = cleanUpSlashes(
3366
3579
  schema.config.media.tina.mediaRoot
3367
3580
  );
@@ -3389,8 +3602,7 @@ var resolveMediaRelativeToCloud = (value, config = { useRelativeMedia: true }, s
3389
3602
  }
3390
3603
  if (Array.isArray(value)) {
3391
3604
  return value.map((v) => {
3392
- if (!v || typeof v !== "string")
3393
- return v;
3605
+ if (!v || typeof v !== "string") return v;
3394
3606
  const strippedValue = v.replace(cleanMediaRoot, "");
3395
3607
  return `https://${config.assetsHost}/${config.clientId}${strippedValue}`;
3396
3608
  });
@@ -3409,8 +3621,7 @@ var cleanUpSlashes = (path7) => {
3409
3621
  };
3410
3622
  var hasTinaMediaConfig = (schema) => {
3411
3623
  var _a, _b, _c, _d, _e, _f, _g, _h;
3412
- if (!((_b = (_a = schema.config) == null ? void 0 : _a.media) == null ? void 0 : _b.tina))
3413
- return false;
3624
+ if (!((_b = (_a = schema.config) == null ? void 0 : _a.media) == null ? void 0 : _b.tina)) return false;
3414
3625
  if (typeof ((_e = (_d = (_c = schema.config) == null ? void 0 : _c.media) == null ? void 0 : _d.tina) == null ? void 0 : _e.publicFolder) !== "string" && typeof ((_h = (_g = (_f = schema.config) == null ? void 0 : _f.media) == null ? void 0 : _g.tina) == null ? void 0 : _h.mediaRoot) !== "string")
3415
3626
  return false;
3416
3627
  return true;
@@ -3454,6 +3665,7 @@ var LevelProxyHandler = {
3454
3665
  } else if (property === "sublevel") {
3455
3666
  return (...args) => {
3456
3667
  return new Proxy(
3668
+ // eslint-disable-next-line prefer-spread
3457
3669
  target[property].apply(target, args),
3458
3670
  LevelProxyHandler
3459
3671
  );
@@ -3476,7 +3688,7 @@ var import_path2 = __toESM(require("path"));
3476
3688
  var import_toml = __toESM(require("@iarna/toml"));
3477
3689
  var import_js_yaml = __toESM(require("js-yaml"));
3478
3690
  var import_gray_matter = __toESM(require("gray-matter"));
3479
- var import_schema_tools3 = require("@tinacms/schema-tools");
3691
+ var import_schema_tools4 = require("@tinacms/schema-tools");
3480
3692
  var import_micromatch = __toESM(require("micromatch"));
3481
3693
  var import_path = __toESM(require("path"));
3482
3694
 
@@ -3689,7 +3901,7 @@ var scanAllContent = async (tinaSchema, bridge, callback) => {
3689
3901
  const filesSeen = /* @__PURE__ */ new Map();
3690
3902
  const duplicateFiles = /* @__PURE__ */ new Set();
3691
3903
  await sequential(tinaSchema.getCollections(), async (collection) => {
3692
- const normalPath = (0, import_schema_tools3.normalizePath)(collection.path);
3904
+ const normalPath = (0, import_schema_tools4.normalizePath)(collection.path);
3693
3905
  const format = collection.format || "md";
3694
3906
  const documentPaths = await bridge.glob(normalPath, format);
3695
3907
  const matches = tinaSchema.getMatches({ collection });
@@ -3801,7 +4013,7 @@ var getTemplateForFile = (templateInfo, data) => {
3801
4013
  throw new Error(`Unable to determine template`);
3802
4014
  };
3803
4015
  var loadAndParseWithAliases = async (bridge, filepath, collection, templateInfo) => {
3804
- const dataString = await bridge.get((0, import_schema_tools3.normalizePath)(filepath));
4016
+ const dataString = await bridge.get((0, import_schema_tools4.normalizePath)(filepath));
3805
4017
  const data = parseFile(
3806
4018
  dataString,
3807
4019
  import_path.default.extname(filepath),
@@ -4280,7 +4492,7 @@ var FolderTreeBuilder = class {
4280
4492
  return this._tree;
4281
4493
  }
4282
4494
  update(documentPath, collectionPath) {
4283
- let folderPath = import_path2.default.dirname((0, import_schema_tools3.normalizePath)(documentPath));
4495
+ let folderPath = import_path2.default.dirname((0, import_schema_tools4.normalizePath)(documentPath));
4284
4496
  if (folderPath === ".") {
4285
4497
  folderPath = "";
4286
4498
  }
@@ -4293,7 +4505,7 @@ var FolderTreeBuilder = class {
4293
4505
  if (!this._tree[current2]) {
4294
4506
  this._tree[current2] = /* @__PURE__ */ new Set();
4295
4507
  }
4296
- this._tree[current2].add((0, import_schema_tools3.normalizePath)(import_path2.default.join(current2, part)));
4508
+ this._tree[current2].add((0, import_schema_tools4.normalizePath)(import_path2.default.join(current2, part)));
4297
4509
  parent.push(part);
4298
4510
  });
4299
4511
  const current = parent.join("/");
@@ -4332,6 +4544,7 @@ var makeFolderOpsForCollection = (folderTree, collection, indexDefinitions, opTy
4332
4544
  result.push({
4333
4545
  type: opType,
4334
4546
  key: `${collection.path}/${subFolderKey}.${collection.format}`,
4547
+ // replace the root with the collection path
4335
4548
  sublevel: indexSublevel,
4336
4549
  value: {}
4337
4550
  });
@@ -4447,6 +4660,7 @@ var resolveFieldData = async ({ namespace, ...field }, rawData, accumulator, tin
4447
4660
  case "password":
4448
4661
  accumulator[field.name] = {
4449
4662
  value: void 0,
4663
+ // never resolve the password hash
4450
4664
  passwordChangeRequired: (_a = value["passwordChangeRequired"]) != null ? _a : false
4451
4665
  };
4452
4666
  break;
@@ -4541,7 +4755,7 @@ var resolveFieldData = async ({ namespace, ...field }, rawData, accumulator, tin
4541
4755
  }
4542
4756
  return accumulator;
4543
4757
  };
4544
- var transformDocumentIntoPayload = async (fullPath, rawData, tinaSchema, config, isAudit) => {
4758
+ var transformDocumentIntoPayload = async (fullPath, rawData, tinaSchema, config, isAudit, hasReferences) => {
4545
4759
  const collection = tinaSchema.getCollection(rawData._collection);
4546
4760
  try {
4547
4761
  const template = tinaSchema.getTemplateForData({
@@ -4595,6 +4809,7 @@ var transformDocumentIntoPayload = async (fullPath, rawData, tinaSchema, config,
4595
4809
  basename,
4596
4810
  filename,
4597
4811
  extension,
4812
+ hasReferences,
4598
4813
  path: fullPath,
4599
4814
  relativePath,
4600
4815
  breadcrumbs,
@@ -4614,6 +4829,25 @@ var transformDocumentIntoPayload = async (fullPath, rawData, tinaSchema, config,
4614
4829
  throw e;
4615
4830
  }
4616
4831
  };
4832
+ var updateObjectWithJsonPath = (obj, path7, newValue) => {
4833
+ if (!path7.includes(".") && !path7.includes("[")) {
4834
+ if (path7 in obj) {
4835
+ obj[path7] = newValue;
4836
+ }
4837
+ return obj;
4838
+ }
4839
+ const parentPath = path7.replace(/\.[^.]+$/, "");
4840
+ const keyToUpdate = path7.match(/[^.]+$/)[0];
4841
+ const parents = (0, import_jsonpath_plus2.JSONPath)({ path: parentPath, json: obj, resultType: "value" });
4842
+ if (parents.length > 0) {
4843
+ parents.forEach((parent) => {
4844
+ if (parent && typeof parent === "object" && keyToUpdate in parent) {
4845
+ parent[keyToUpdate] = newValue;
4846
+ }
4847
+ });
4848
+ }
4849
+ return obj;
4850
+ };
4617
4851
  var Resolver = class {
4618
4852
  constructor(init) {
4619
4853
  this.init = init;
@@ -4621,6 +4855,7 @@ var Resolver = class {
4621
4855
  const collection = this.tinaSchema.getCollection(collectionName);
4622
4856
  const extraFields = {};
4623
4857
  return {
4858
+ // return the collection and hasDocuments to resolve documents at a lower level
4624
4859
  documents: { collection, hasDocuments },
4625
4860
  ...collection,
4626
4861
  ...extraFields
@@ -4655,17 +4890,19 @@ var Resolver = class {
4655
4890
  );
4656
4891
  }
4657
4892
  };
4658
- this.getDocument = async (fullPath) => {
4893
+ this.getDocument = async (fullPath, opts = {}) => {
4659
4894
  if (typeof fullPath !== "string") {
4660
4895
  throw new Error(`fullPath must be of type string for getDocument request`);
4661
4896
  }
4662
4897
  const rawData = await this.getRaw(fullPath);
4898
+ const hasReferences = (opts == null ? void 0 : opts.checkReferences) ? await this.hasReferences(fullPath, opts.collection) : void 0;
4663
4899
  return transformDocumentIntoPayload(
4664
4900
  fullPath,
4665
4901
  rawData,
4666
4902
  this.tinaSchema,
4667
4903
  this.config,
4668
- this.isAudit
4904
+ this.isAudit,
4905
+ hasReferences
4669
4906
  );
4670
4907
  };
4671
4908
  this.deleteDocument = async (fullPath) => {
@@ -4705,7 +4942,9 @@ var Resolver = class {
4705
4942
  );
4706
4943
  } else {
4707
4944
  return this.buildFieldMutations(
4945
+ // @ts-ignore FIXME Argument of type 'string | object' is not assignable to parameter of type '{ [fieldName: string]: string | object | (string | object)[]; }'
4708
4946
  fieldValue,
4947
+ //@ts-ignore
4709
4948
  objectTemplate,
4710
4949
  existingData
4711
4950
  );
@@ -4717,6 +4956,7 @@ var Resolver = class {
4717
4956
  fieldValue.map(async (item) => {
4718
4957
  if (typeof item === "string") {
4719
4958
  throw new Error(
4959
+ //@ts-ignore
4720
4960
  `Expected object for template value for field ${field.name}`
4721
4961
  );
4722
4962
  }
@@ -4725,16 +4965,19 @@ var Resolver = class {
4725
4965
  });
4726
4966
  const [templateName] = Object.entries(item)[0];
4727
4967
  const template = templates.find(
4968
+ //@ts-ignore
4728
4969
  (template2) => template2.name === templateName
4729
4970
  );
4730
4971
  if (!template) {
4731
4972
  throw new Error(`Expected to find template ${templateName}`);
4732
4973
  }
4733
4974
  return {
4975
+ // @ts-ignore FIXME Argument of type 'unknown' is not assignable to parameter of type '{ [fieldName: string]: string | { [key: string]: unknown; } | (string | { [key: string]: unknown; })[]; }'
4734
4976
  ...await this.buildFieldMutations(
4735
4977
  item[template.name],
4736
4978
  template
4737
4979
  ),
4980
+ //@ts-ignore
4738
4981
  _template: template.name
4739
4982
  };
4740
4983
  })
@@ -4742,6 +4985,7 @@ var Resolver = class {
4742
4985
  } else {
4743
4986
  if (typeof fieldValue === "string") {
4744
4987
  throw new Error(
4988
+ //@ts-ignore
4745
4989
  `Expected object for template value for field ${field.name}`
4746
4990
  );
4747
4991
  }
@@ -4750,16 +4994,19 @@ var Resolver = class {
4750
4994
  });
4751
4995
  const [templateName] = Object.entries(fieldValue)[0];
4752
4996
  const template = templates.find(
4997
+ //@ts-ignore
4753
4998
  (template2) => template2.name === templateName
4754
4999
  );
4755
5000
  if (!template) {
4756
5001
  throw new Error(`Expected to find template ${templateName}`);
4757
5002
  }
4758
5003
  return {
5004
+ // @ts-ignore FIXME Argument of type 'unknown' is not assignable to parameter of type '{ [fieldName: string]: string | { [key: string]: unknown; } | (string | { [key: string]: unknown; })[]; }'
4759
5005
  ...await this.buildFieldMutations(
4760
5006
  fieldValue[template.name],
4761
5007
  template
4762
5008
  ),
5009
+ //@ts-ignore
4763
5010
  _template: template.name
4764
5011
  };
4765
5012
  }
@@ -4799,6 +5046,7 @@ var Resolver = class {
4799
5046
  return this.getDocument(realPath);
4800
5047
  }
4801
5048
  const params = await this.buildObjectMutations(
5049
+ // @ts-ignore
4802
5050
  args.params[collection.name],
4803
5051
  collection
4804
5052
  );
@@ -4844,6 +5092,7 @@ var Resolver = class {
4844
5092
  const values = {
4845
5093
  ...oldDoc,
4846
5094
  ...await this.buildFieldMutations(
5095
+ // @ts-ignore FIXME: failing on unknown, which we don't need to know because it's recursive
4847
5096
  templateParams,
4848
5097
  template,
4849
5098
  doc == null ? void 0 : doc._rawData
@@ -4857,6 +5106,7 @@ var Resolver = class {
4857
5106
  return this.getDocument(realPath);
4858
5107
  }
4859
5108
  const params = await this.buildObjectMutations(
5109
+ //@ts-ignore
4860
5110
  isCollectionSpecific ? args.params : args.params[collection.name],
4861
5111
  collection,
4862
5112
  doc == null ? void 0 : doc._rawData
@@ -4864,6 +5114,10 @@ var Resolver = class {
4864
5114
  await this.database.put(realPath, { ...oldDoc, ...params }, collection.name);
4865
5115
  return this.getDocument(realPath);
4866
5116
  };
5117
+ /**
5118
+ * Returns top-level fields which are not defined in the collection, so their
5119
+ * values are not eliminated from Tina when new values are saved
5120
+ */
4867
5121
  this.resolveLegacyValues = (oldDoc, collection) => {
4868
5122
  const legacyValues = {};
4869
5123
  Object.entries(oldDoc).forEach(([key, value]) => {
@@ -4969,6 +5223,22 @@ var Resolver = class {
4969
5223
  if (isDeletion) {
4970
5224
  const doc = await this.getDocument(realPath);
4971
5225
  await this.deleteDocument(realPath);
5226
+ if (await this.hasReferences(realPath, collection)) {
5227
+ const collRefs = await this.findReferences(realPath, collection);
5228
+ for (const [collection2, refFields] of Object.entries(collRefs)) {
5229
+ for (const [refPath, refs] of Object.entries(refFields)) {
5230
+ let refDoc = await this.getRaw(refPath);
5231
+ for (const ref of refs) {
5232
+ refDoc = updateObjectWithJsonPath(
5233
+ refDoc,
5234
+ ref.path.join("."),
5235
+ null
5236
+ );
5237
+ }
5238
+ await this.database.put(refPath, refDoc, collection2);
5239
+ }
5240
+ }
5241
+ }
4972
5242
  return doc;
4973
5243
  }
4974
5244
  if (isUpdateName) {
@@ -4987,6 +5257,20 @@ var Resolver = class {
4987
5257
  );
4988
5258
  await this.database.put(newRealPath, doc._rawData, collection.name);
4989
5259
  await this.deleteDocument(realPath);
5260
+ const collRefs = await this.findReferences(realPath, collection);
5261
+ for (const [collection2, refFields] of Object.entries(collRefs)) {
5262
+ for (const [refPath, refs] of Object.entries(refFields)) {
5263
+ let refDoc = await this.getRaw(refPath);
5264
+ for (const ref of refs) {
5265
+ refDoc = updateObjectWithJsonPath(
5266
+ refDoc,
5267
+ ref.path.join("."),
5268
+ newRealPath
5269
+ );
5270
+ }
5271
+ await this.database.put(refPath, refDoc, collection2);
5272
+ }
5273
+ }
4990
5274
  return this.getDocument(newRealPath);
4991
5275
  }
4992
5276
  if (alreadyExists === false) {
@@ -5000,7 +5284,10 @@ var Resolver = class {
5000
5284
  isCollectionSpecific
5001
5285
  });
5002
5286
  } else {
5003
- return this.getDocument(realPath);
5287
+ return this.getDocument(realPath, {
5288
+ collection,
5289
+ checkReferences: true
5290
+ });
5004
5291
  }
5005
5292
  };
5006
5293
  this.resolveCollectionConnections = async ({ ids }) => {
@@ -5037,6 +5324,7 @@ var Resolver = class {
5037
5324
  },
5038
5325
  collection: referencedCollection,
5039
5326
  hydrator: (path7) => path7
5327
+ // just return the path
5040
5328
  }
5041
5329
  );
5042
5330
  const { edges } = resolvedCollectionConnection;
@@ -5104,6 +5392,92 @@ var Resolver = class {
5104
5392
  }
5105
5393
  };
5106
5394
  };
5395
+ /**
5396
+ * Checks if a document has references to it
5397
+ * @param id The id of the document to check for references
5398
+ * @param c The collection to check for references
5399
+ * @returns true if the document has references, false otherwise
5400
+ */
5401
+ this.hasReferences = async (id, c) => {
5402
+ let count = 0;
5403
+ const deepRefs = this.tinaSchema.findReferences(c.name);
5404
+ for (const [collection, refs] of Object.entries(deepRefs)) {
5405
+ for (const ref of refs) {
5406
+ await this.database.query(
5407
+ {
5408
+ collection,
5409
+ filterChain: makeFilterChain({
5410
+ conditions: [
5411
+ {
5412
+ filterPath: ref.path.join("."),
5413
+ filterExpression: {
5414
+ _type: "reference",
5415
+ _list: false,
5416
+ eq: id
5417
+ }
5418
+ }
5419
+ ]
5420
+ }),
5421
+ sort: ref.field.name
5422
+ },
5423
+ (refId) => {
5424
+ count++;
5425
+ return refId;
5426
+ }
5427
+ );
5428
+ if (count) {
5429
+ return true;
5430
+ }
5431
+ }
5432
+ }
5433
+ return false;
5434
+ };
5435
+ /**
5436
+ * Finds references to a document
5437
+ * @param id the id of the document to find references to
5438
+ * @param c the collection to find references in
5439
+ * @returns references to the document in the form of a map of collection names to a list of fields that reference the document
5440
+ */
5441
+ this.findReferences = async (id, c) => {
5442
+ const references = {};
5443
+ const deepRefs = this.tinaSchema.findReferences(c.name);
5444
+ for (const [collection, refs] of Object.entries(deepRefs)) {
5445
+ for (const ref of refs) {
5446
+ await this.database.query(
5447
+ {
5448
+ collection,
5449
+ filterChain: makeFilterChain({
5450
+ conditions: [
5451
+ {
5452
+ filterPath: ref.path.join("."),
5453
+ filterExpression: {
5454
+ _type: "reference",
5455
+ _list: false,
5456
+ eq: id
5457
+ }
5458
+ }
5459
+ ]
5460
+ }),
5461
+ sort: ref.field.name
5462
+ },
5463
+ (refId) => {
5464
+ if (!references[collection]) {
5465
+ references[collection] = {};
5466
+ }
5467
+ if (!references[collection][refId]) {
5468
+ references[collection][refId] = [];
5469
+ }
5470
+ references[collection][refId].push({
5471
+ path: ref.path,
5472
+ field: ref.field
5473
+ });
5474
+ return refId;
5475
+ }
5476
+ );
5477
+ }
5478
+ }
5479
+ return references;
5480
+ };
5107
5481
  this.buildFieldMutations = async (fieldParams, template, existingData) => {
5108
5482
  var _a;
5109
5483
  const accum = {};
@@ -5191,6 +5565,27 @@ var Resolver = class {
5191
5565
  }
5192
5566
  return accum;
5193
5567
  };
5568
+ /**
5569
+ * A mutation looks nearly identical between updateDocument:
5570
+ * ```graphql
5571
+ * updateDocument(collection: $collection,relativePath: $path, params: {
5572
+ * post: {
5573
+ * title: "Hello, World"
5574
+ * }
5575
+ * })`
5576
+ * ```
5577
+ * and `updatePostDocument`:
5578
+ * ```graphql
5579
+ * updatePostDocument(relativePath: $path, params: {
5580
+ * title: "Hello, World"
5581
+ * })
5582
+ * ```
5583
+ * The problem here is that we don't know whether the payload came from `updateDocument`
5584
+ * or `updatePostDocument` (we could, but for now it's easier not to pipe those details through),
5585
+ * But we do know that when given a `args.collection` value, we can assume that
5586
+ * this was a `updateDocument` request, and thus - should grab the data
5587
+ * from the corresponding field name in the key
5588
+ */
5194
5589
  this.buildParams = (args) => {
5195
5590
  try {
5196
5591
  assertShape(
@@ -5291,7 +5686,10 @@ var resolve = async ({
5291
5686
  const graphQLSchema = (0, import_graphql5.buildASTSchema)(graphQLSchemaAst);
5292
5687
  const tinaConfig = await database.getTinaSchema();
5293
5688
  const tinaSchema = await createSchema({
5689
+ // TODO: please update all the types to import from @tinacms/schema-tools
5690
+ // @ts-ignore
5294
5691
  schema: tinaConfig,
5692
+ // @ts-ignore
5295
5693
  flags: (_a = tinaConfig == null ? void 0 : tinaConfig.meta) == null ? void 0 : _a.flags
5296
5694
  });
5297
5695
  const resolver = createResolver({
@@ -5308,8 +5706,7 @@ var resolve = async ({
5308
5706
  database
5309
5707
  },
5310
5708
  typeResolver: async (source, _args, info) => {
5311
- if (source.__typename)
5312
- return source.__typename;
5709
+ if (source.__typename) return source.__typename;
5313
5710
  const namedType = (0, import_graphql5.getNamedType)(info.returnType).toString();
5314
5711
  const lookup = await database.getLookup(namedType);
5315
5712
  if (lookup.resolveType === "unionData") {
@@ -5461,11 +5858,13 @@ var resolve = async ({
5461
5858
  (0, import_lodash4.default)(
5462
5859
  params,
5463
5860
  userField.path.slice(1),
5861
+ // remove _rawData from users path
5464
5862
  users.map((u) => {
5465
5863
  if (user[idFieldName] === u[idFieldName]) {
5466
5864
  return user;
5467
5865
  }
5468
5866
  return {
5867
+ // don't overwrite other users' passwords
5469
5868
  ...u,
5470
5869
  [passwordFieldName]: {
5471
5870
  ...u[passwordFieldName],
@@ -5488,6 +5887,9 @@ var resolve = async ({
5488
5887
  }
5489
5888
  const isCreation = lookup[info.fieldName] === "create";
5490
5889
  switch (lookup.resolveType) {
5890
+ /**
5891
+ * `node(id: $id)`
5892
+ */
5491
5893
  case "nodeDocument":
5492
5894
  assertShape(
5493
5895
  args,
@@ -5519,6 +5921,7 @@ var resolve = async ({
5519
5921
  collection: args.collection,
5520
5922
  isMutation,
5521
5923
  isCreation,
5924
+ // Right now this is the only case for deletion
5522
5925
  isDeletion: info.fieldName === "deleteDocument",
5523
5926
  isFolderCreation: info.fieldName === "createFolder",
5524
5927
  isUpdateName: Boolean((_a2 = args == null ? void 0 : args.params) == null ? void 0 : _a2.relativePath),
@@ -5528,6 +5931,9 @@ var resolve = async ({
5528
5931
  return result;
5529
5932
  }
5530
5933
  return value;
5934
+ /**
5935
+ * eg `getMovieDocument.data.actors`
5936
+ */
5531
5937
  case "multiCollectionDocumentList":
5532
5938
  if (Array.isArray(value)) {
5533
5939
  return {
@@ -5539,7 +5945,15 @@ var resolve = async ({
5539
5945
  }
5540
5946
  if (info.fieldName === "documents" && (value == null ? void 0 : value.collection) && (value == null ? void 0 : value.hasDocuments)) {
5541
5947
  let filter = args.filter;
5542
- if (typeof (args == null ? void 0 : args.filter) !== "undefined" && (args == null ? void 0 : args.filter) !== null && typeof ((_b = value == null ? void 0 : value.collection) == null ? void 0 : _b.name) === "string" && Object.keys(args.filter).includes((_c = value == null ? void 0 : value.collection) == null ? void 0 : _c.name) && typeof args.filter[(_d = value == null ? void 0 : value.collection) == null ? void 0 : _d.name] !== "undefined") {
5948
+ if (
5949
+ // 1. Make sure that the filter exists
5950
+ typeof (args == null ? void 0 : args.filter) !== "undefined" && (args == null ? void 0 : args.filter) !== null && // 2. Make sure that the collection name exists
5951
+ // @ts-ignore
5952
+ typeof ((_b = value == null ? void 0 : value.collection) == null ? void 0 : _b.name) === "string" && // 3. Make sure that the collection name is in the filter and is not undefined
5953
+ // @ts-ignore
5954
+ Object.keys(args.filter).includes((_c = value == null ? void 0 : value.collection) == null ? void 0 : _c.name) && // @ts-ignore
5955
+ typeof args.filter[(_d = value == null ? void 0 : value.collection) == null ? void 0 : _d.name] !== "undefined"
5956
+ ) {
5543
5957
  filter = args.filter[value.collection.name];
5544
5958
  }
5545
5959
  return resolver.resolveCollectionConnection({
@@ -5547,12 +5961,20 @@ var resolve = async ({
5547
5961
  ...args,
5548
5962
  filter
5549
5963
  },
5964
+ // @ts-ignore
5550
5965
  collection: value.collection
5551
5966
  });
5552
5967
  }
5553
5968
  throw new Error(
5554
5969
  `Expected an array for result of ${info.fieldName} at ${info.path}`
5555
5970
  );
5971
+ /**
5972
+ * Collections-specific getter
5973
+ * eg. `getPostDocument`/`createPostDocument`/`updatePostDocument`
5974
+ *
5975
+ * if coming from a query result
5976
+ * the field will be `node`
5977
+ */
5556
5978
  case "collectionDocument": {
5557
5979
  if (value) {
5558
5980
  return value;
@@ -5567,11 +5989,32 @@ var resolve = async ({
5567
5989
  });
5568
5990
  return result;
5569
5991
  }
5992
+ /**
5993
+ * Collections-specific list getter
5994
+ * eg. `getPageList`
5995
+ */
5570
5996
  case "collectionDocumentList":
5571
5997
  return resolver.resolveCollectionConnection({
5572
5998
  args,
5573
5999
  collection: tinaSchema.getCollection(lookup.collection)
5574
6000
  });
6001
+ /**
6002
+ * A polymorphic data set, it can be from a document's data
6003
+ * of any nested object which can be one of many shapes
6004
+ *
6005
+ * ```graphql
6006
+ * getPostDocument(relativePath: $relativePath) {
6007
+ * data {...} <- this part
6008
+ * }
6009
+ * ```
6010
+ * ```graphql
6011
+ * getBlockDocument(relativePath: $relativePath) {
6012
+ * data {
6013
+ * blocks {...} <- or this part
6014
+ * }
6015
+ * }
6016
+ * ```
6017
+ */
5575
6018
  case "unionData":
5576
6019
  if (!value) {
5577
6020
  if (args.relativePath) {
@@ -5636,8 +6079,7 @@ var TinaLevelClient = class extends import_many_level.ManyLevelGuest {
5636
6079
  this.port = port || 9e3;
5637
6080
  }
5638
6081
  openConnection() {
5639
- if (this._connected)
5640
- return;
6082
+ if (this._connected) return;
5641
6083
  const socket = (0, import_net.connect)(this.port);
5642
6084
  (0, import_readable_stream.pipeline)(socket, this.createRpcStream(), socket, () => {
5643
6085
  this._connected = false;
@@ -5757,7 +6199,7 @@ var Database = class {
5757
6199
  const contentObject = await level.sublevel(
5758
6200
  CONTENT_ROOT_PREFIX,
5759
6201
  SUBLEVEL_OPTIONS
5760
- ).get((0, import_schema_tools3.normalizePath)(filepath));
6202
+ ).get((0, import_schema_tools4.normalizePath)(filepath));
5761
6203
  if (!contentObject) {
5762
6204
  throw new NotFoundError(`Unable to find record ${filepath}`);
5763
6205
  }
@@ -5782,7 +6224,7 @@ var Database = class {
5782
6224
  );
5783
6225
  const indexDefinitions = await this.getIndexDefinitions(this.contentLevel);
5784
6226
  const collectionIndexDefinitions = indexDefinitions == null ? void 0 : indexDefinitions[collection.name];
5785
- const normalizedPath = (0, import_schema_tools3.normalizePath)(filepath);
6227
+ const normalizedPath = (0, import_schema_tools4.normalizePath)(filepath);
5786
6228
  if (!(collection == null ? void 0 : collection.isDetached)) {
5787
6229
  if (this.bridge) {
5788
6230
  await this.bridge.put(normalizedPath, stringifiedFile);
@@ -5818,6 +6260,7 @@ var Database = class {
5818
6260
  "put",
5819
6261
  level
5820
6262
  ),
6263
+ // folder indices
5821
6264
  ...makeIndexOpsForDocument(
5822
6265
  normalizedPath,
5823
6266
  `${collection == null ? void 0 : collection.name}_${folderKey}`,
@@ -5840,6 +6283,7 @@ var Database = class {
5840
6283
  "del",
5841
6284
  level
5842
6285
  ),
6286
+ // folder indices
5843
6287
  ...makeIndexOpsForDocument(
5844
6288
  normalizedPath,
5845
6289
  `${collection == null ? void 0 : collection.name}_${folderKey}`,
@@ -5879,7 +6323,7 @@ var Database = class {
5879
6323
  );
5880
6324
  collectionIndexDefinitions = indexDefinitions == null ? void 0 : indexDefinitions[collectionName];
5881
6325
  }
5882
- const normalizedPath = (0, import_schema_tools3.normalizePath)(filepath);
6326
+ const normalizedPath = (0, import_schema_tools4.normalizePath)(filepath);
5883
6327
  const dataFields = await this.formatBodyOnPayload(filepath, data);
5884
6328
  const collection = await this.collectionForPath(filepath);
5885
6329
  if (!collection) {
@@ -5934,6 +6378,7 @@ var Database = class {
5934
6378
  "put",
5935
6379
  level
5936
6380
  ),
6381
+ // folder indices
5937
6382
  ...makeIndexOpsForDocument(
5938
6383
  normalizedPath,
5939
6384
  `${collection == null ? void 0 : collection.name}_${folderKey}`,
@@ -5956,6 +6401,7 @@ var Database = class {
5956
6401
  "del",
5957
6402
  level
5958
6403
  ),
6404
+ // folder indices
5959
6405
  ...makeIndexOpsForDocument(
5960
6406
  normalizedPath,
5961
6407
  `${collection == null ? void 0 : collection.name}_${folderKey}`,
@@ -6033,6 +6479,7 @@ var Database = class {
6033
6479
  aliasedData,
6034
6480
  extension,
6035
6481
  writeTemplateKey,
6482
+ //templateInfo.type === 'union',
6036
6483
  {
6037
6484
  frontmatterFormat: collection == null ? void 0 : collection.frontmatterFormat,
6038
6485
  frontmatterDelimiters: collection == null ? void 0 : collection.frontmatterDelimiters
@@ -6050,7 +6497,7 @@ var Database = class {
6050
6497
  };
6051
6498
  this.getLookup = async (returnType) => {
6052
6499
  await this.initLevel();
6053
- const lookupPath = (0, import_schema_tools3.normalizePath)(
6500
+ const lookupPath = (0, import_schema_tools4.normalizePath)(
6054
6501
  import_node_path.default.join(this.getGeneratedFolder(), `_lookup.json`)
6055
6502
  );
6056
6503
  if (!this._lookup) {
@@ -6063,7 +6510,7 @@ var Database = class {
6063
6510
  };
6064
6511
  this.getGraphQLSchema = async () => {
6065
6512
  await this.initLevel();
6066
- const graphqlPath = (0, import_schema_tools3.normalizePath)(
6513
+ const graphqlPath = (0, import_schema_tools4.normalizePath)(
6067
6514
  import_node_path.default.join(this.getGeneratedFolder(), `_graphql.json`)
6068
6515
  );
6069
6516
  return await this.contentLevel.sublevel(
@@ -6071,11 +6518,12 @@ var Database = class {
6071
6518
  SUBLEVEL_OPTIONS
6072
6519
  ).get(graphqlPath);
6073
6520
  };
6521
+ //TODO - is there a reason why the database fetches some config with "bridge.get", and some with "store.get"?
6074
6522
  this.getGraphQLSchemaFromBridge = async () => {
6075
6523
  if (!this.bridge) {
6076
6524
  throw new Error(`No bridge configured`);
6077
6525
  }
6078
- const graphqlPath = (0, import_schema_tools3.normalizePath)(
6526
+ const graphqlPath = (0, import_schema_tools4.normalizePath)(
6079
6527
  import_node_path.default.join(this.getGeneratedFolder(), `_graphql.json`)
6080
6528
  );
6081
6529
  const _graphql = await this.bridge.get(graphqlPath);
@@ -6083,7 +6531,7 @@ var Database = class {
6083
6531
  };
6084
6532
  this.getTinaSchema = async (level) => {
6085
6533
  await this.initLevel();
6086
- const schemaPath = (0, import_schema_tools3.normalizePath)(
6534
+ const schemaPath = (0, import_schema_tools4.normalizePath)(
6087
6535
  import_node_path.default.join(this.getGeneratedFolder(), `_schema.json`)
6088
6536
  );
6089
6537
  return await (level || this.contentLevel).sublevel(
@@ -6099,7 +6547,7 @@ var Database = class {
6099
6547
  const schema = existingSchema || await this.getTinaSchema(level || this.contentLevel);
6100
6548
  if (!schema) {
6101
6549
  throw new Error(
6102
- `Unable to get schema from level db: ${(0, import_schema_tools3.normalizePath)(
6550
+ `Unable to get schema from level db: ${(0, import_schema_tools4.normalizePath)(
6103
6551
  import_node_path.default.join(this.getGeneratedFolder(), `_schema.json`)
6104
6552
  )}`
6105
6553
  );
@@ -6117,6 +6565,7 @@ var Database = class {
6117
6565
  for (const collection of collections) {
6118
6566
  const indexDefinitions = {
6119
6567
  [DEFAULT_COLLECTION_SORT_KEY]: { fields: [] }
6568
+ // provide a default sort key which is the file sort
6120
6569
  };
6121
6570
  if (collection.fields) {
6122
6571
  for (const field of collection.fields) {
@@ -6315,7 +6764,7 @@ var Database = class {
6315
6764
  try {
6316
6765
  lookup = lookupFromLockFile || JSON.parse(
6317
6766
  await this.bridge.get(
6318
- (0, import_schema_tools3.normalizePath)(
6767
+ (0, import_schema_tools4.normalizePath)(
6319
6768
  import_node_path.default.join(this.getGeneratedFolder(), "_lookup.json")
6320
6769
  )
6321
6770
  )
@@ -6340,15 +6789,15 @@ var Database = class {
6340
6789
  }
6341
6790
  const contentRootLevel = nextLevel.sublevel(CONTENT_ROOT_PREFIX, SUBLEVEL_OPTIONS);
6342
6791
  await contentRootLevel.put(
6343
- (0, import_schema_tools3.normalizePath)(import_node_path.default.join(this.getGeneratedFolder(), "_graphql.json")),
6792
+ (0, import_schema_tools4.normalizePath)(import_node_path.default.join(this.getGeneratedFolder(), "_graphql.json")),
6344
6793
  graphQLSchema
6345
6794
  );
6346
6795
  await contentRootLevel.put(
6347
- (0, import_schema_tools3.normalizePath)(import_node_path.default.join(this.getGeneratedFolder(), "_schema.json")),
6796
+ (0, import_schema_tools4.normalizePath)(import_node_path.default.join(this.getGeneratedFolder(), "_schema.json")),
6348
6797
  tinaSchema.schema
6349
6798
  );
6350
6799
  await contentRootLevel.put(
6351
- (0, import_schema_tools3.normalizePath)(import_node_path.default.join(this.getGeneratedFolder(), "_lookup.json")),
6800
+ (0, import_schema_tools4.normalizePath)(import_node_path.default.join(this.getGeneratedFolder(), "_lookup.json")),
6352
6801
  lookup
6353
6802
  );
6354
6803
  const result = await this._indexAllContent(
@@ -6441,12 +6890,12 @@ var Database = class {
6441
6890
  if (collection == null ? void 0 : collection.isDetached) {
6442
6891
  level = this.appLevel.sublevel(collection == null ? void 0 : collection.name, SUBLEVEL_OPTIONS);
6443
6892
  }
6444
- const itemKey = (0, import_schema_tools3.normalizePath)(filepath);
6893
+ const normalizedPath = (0, import_schema_tools4.normalizePath)(filepath);
6445
6894
  const rootSublevel = level.sublevel(
6446
6895
  CONTENT_ROOT_PREFIX,
6447
6896
  SUBLEVEL_OPTIONS
6448
6897
  );
6449
- const item = await rootSublevel.get(itemKey);
6898
+ const item = await rootSublevel.get(normalizedPath);
6450
6899
  if (item) {
6451
6900
  const folderTreeBuilder = new FolderTreeBuilder();
6452
6901
  const folderKey = folderTreeBuilder.update(
@@ -6455,15 +6904,16 @@ var Database = class {
6455
6904
  );
6456
6905
  await this.contentLevel.batch([
6457
6906
  ...makeIndexOpsForDocument(
6458
- filepath,
6907
+ normalizedPath,
6459
6908
  collection.name,
6460
6909
  collectionIndexDefinitions,
6461
6910
  item,
6462
6911
  "del",
6463
6912
  level
6464
6913
  ),
6914
+ // folder indices
6465
6915
  ...makeIndexOpsForDocument(
6466
- filepath,
6916
+ normalizedPath,
6467
6917
  `${collection.name}_${folderKey}`,
6468
6918
  collectionIndexDefinitions,
6469
6919
  item,
@@ -6472,17 +6922,17 @@ var Database = class {
6472
6922
  ),
6473
6923
  {
6474
6924
  type: "del",
6475
- key: itemKey,
6925
+ key: normalizedPath,
6476
6926
  sublevel: rootSublevel
6477
6927
  }
6478
6928
  ]);
6479
6929
  }
6480
6930
  if (!(collection == null ? void 0 : collection.isDetached)) {
6481
6931
  if (this.bridge) {
6482
- await this.bridge.delete((0, import_schema_tools3.normalizePath)(filepath));
6932
+ await this.bridge.delete(normalizedPath);
6483
6933
  }
6484
6934
  try {
6485
- await this.onDelete((0, import_schema_tools3.normalizePath)(filepath));
6935
+ await this.onDelete(normalizedPath);
6486
6936
  } catch (e) {
6487
6937
  throw new import_graphql6.GraphQLError(
6488
6938
  `Error running onDelete hook for ${filepath}: ${e}`,
@@ -6616,6 +7066,9 @@ var Database = class {
6616
7066
  info: templateInfo
6617
7067
  };
6618
7068
  }
7069
+ /**
7070
+ * Clears the internal cache of the tinaSchema and the lookup file. This allows the state to be reset
7071
+ */
6619
7072
  clearCache() {
6620
7073
  this.tinaSchema = null;
6621
7074
  this._lookup = null;
@@ -6697,11 +7150,42 @@ var _indexContent = async (database, level, documentPaths, enqueueOps, collectio
6697
7150
  if (passwordFields == null ? void 0 : passwordFields.length) {
6698
7151
  await hashPasswordValues(aliasedData, passwordFields);
6699
7152
  }
6700
- const normalizedPath = (0, import_schema_tools3.normalizePath)(filepath);
7153
+ const normalizedPath = (0, import_schema_tools4.normalizePath)(filepath);
7154
+ const rootSublevel = level.sublevel(
7155
+ CONTENT_ROOT_PREFIX,
7156
+ SUBLEVEL_OPTIONS
7157
+ );
6701
7158
  const folderKey = folderTreeBuilder.update(
6702
7159
  normalizedPath,
6703
7160
  collectionPath || ""
6704
7161
  );
7162
+ const item = await rootSublevel.get(normalizedPath);
7163
+ if (item) {
7164
+ await database.contentLevel.batch([
7165
+ ...makeIndexOpsForDocument(
7166
+ normalizedPath,
7167
+ collection.name,
7168
+ collectionIndexDefinitions,
7169
+ item,
7170
+ "del",
7171
+ level
7172
+ ),
7173
+ // folder indices
7174
+ ...makeIndexOpsForDocument(
7175
+ normalizedPath,
7176
+ `${collection.name}_${folderKey}`,
7177
+ collectionIndexDefinitions,
7178
+ item,
7179
+ "del",
7180
+ level
7181
+ ),
7182
+ {
7183
+ type: "del",
7184
+ key: normalizedPath,
7185
+ sublevel: rootSublevel
7186
+ }
7187
+ ]);
7188
+ }
6705
7189
  if (!isGitKeep(filepath, collection)) {
6706
7190
  await enqueueOps([
6707
7191
  ...makeIndexOpsForDocument(
@@ -6712,6 +7196,7 @@ var _indexContent = async (database, level, documentPaths, enqueueOps, collectio
6712
7196
  "put",
6713
7197
  level
6714
7198
  ),
7199
+ // folder indexes
6715
7200
  ...makeIndexOpsForDocument(
6716
7201
  normalizedPath,
6717
7202
  `${collection == null ? void 0 : collection.name}_${folderKey}`,
@@ -6777,7 +7262,7 @@ var _deleteIndexContent = async (database, documentPaths, enqueueOps, collection
6777
7262
  );
6778
7263
  const folderTreeBuilder = new FolderTreeBuilder();
6779
7264
  await sequential(documentPaths, async (filepath) => {
6780
- const itemKey = (0, import_schema_tools3.normalizePath)(filepath);
7265
+ const itemKey = (0, import_schema_tools4.normalizePath)(filepath);
6781
7266
  const item = await rootLevel.get(itemKey);
6782
7267
  if (item) {
6783
7268
  const folderKey = folderTreeBuilder.update(
@@ -6797,6 +7282,7 @@ var _deleteIndexContent = async (database, documentPaths, enqueueOps, collection
6797
7282
  "del",
6798
7283
  database.contentLevel
6799
7284
  ),
7285
+ // folder indexes
6800
7286
  ...makeIndexOpsForDocument(
6801
7287
  itemKey,
6802
7288
  `${collection == null ? void 0 : collection.name}_${folderKey}`,
@@ -6863,14 +7349,14 @@ var getChangedFiles = async ({
6863
7349
  const rootDir = await findGitRoot(dir);
6864
7350
  let pathPrefix = "";
6865
7351
  if (rootDir !== dir) {
6866
- pathPrefix = (0, import_schema_tools3.normalizePath)(dir.substring(rootDir.length + 1));
7352
+ pathPrefix = (0, import_schema_tools4.normalizePath)(dir.substring(rootDir.length + 1));
6867
7353
  }
6868
7354
  await import_isomorphic_git.default.walk({
6869
7355
  fs: fs4,
6870
7356
  dir: rootDir,
6871
7357
  trees: [import_isomorphic_git.default.TREE({ ref: from }), import_isomorphic_git.default.TREE({ ref: to })],
6872
7358
  map: async function(filename, [A, B]) {
6873
- const relativePath = (0, import_schema_tools3.normalizePath)(filename).substring(pathPrefix.length);
7359
+ const relativePath = (0, import_schema_tools4.normalizePath)(filename).substring(pathPrefix.length);
6874
7360
  let matches = false;
6875
7361
  for (const [key, matcher] of Object.entries(pathFilter)) {
6876
7362
  if (relativePath.startsWith(key)) {
@@ -7012,17 +7498,26 @@ var IsomorphicBridge = class {
7012
7498
  getAuthor() {
7013
7499
  return {
7014
7500
  ...this.author,
7015
- timestamp: Math.round(new Date().getTime() / 1e3),
7501
+ timestamp: Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3),
7016
7502
  timezoneOffset: 0
7017
7503
  };
7018
7504
  }
7019
7505
  getCommitter() {
7020
7506
  return {
7021
7507
  ...this.committer,
7022
- timestamp: Math.round(new Date().getTime() / 1e3),
7508
+ timestamp: Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3),
7023
7509
  timezoneOffset: 0
7024
7510
  };
7025
7511
  }
7512
+ /**
7513
+ * Recursively populate paths matching `pattern` for the given `entry`
7514
+ *
7515
+ * @param pattern - pattern to filter paths by
7516
+ * @param entry - TreeEntry to start building list from
7517
+ * @param path - base path
7518
+ * @param results
7519
+ * @private
7520
+ */
7026
7521
  async listEntries({
7027
7522
  pattern,
7028
7523
  entry,
@@ -7055,6 +7550,15 @@ var IsomorphicBridge = class {
7055
7550
  });
7056
7551
  }
7057
7552
  }
7553
+ /**
7554
+ * For the specified path, returns an object with an array containing the parts of the path (pathParts)
7555
+ * and an array containing the WalkerEntry objects for the path parts (pathEntries). Any null elements in the
7556
+ * pathEntries are placeholders for non-existent entries.
7557
+ *
7558
+ * @param path - path being resolved
7559
+ * @param ref - ref to resolve path entries for
7560
+ * @private
7561
+ */
7058
7562
  async resolvePathEntries(path7, ref) {
7059
7563
  let pathParts = path7.split("/");
7060
7564
  const result = await import_isomorphic_git2.default.walk({
@@ -7085,6 +7589,17 @@ var IsomorphicBridge = class {
7085
7589
  }
7086
7590
  return { pathParts, pathEntries };
7087
7591
  }
7592
+ /**
7593
+ * Updates tree entry and associated parent tree entries
7594
+ *
7595
+ * @param existingOid - the existing OID
7596
+ * @param updatedOid - the updated OID
7597
+ * @param path - the path of the entry being updated
7598
+ * @param type - the type of the entry being updated (blob or tree)
7599
+ * @param pathEntries - parent path entries
7600
+ * @param pathParts - parent path parts
7601
+ * @private
7602
+ */
7088
7603
  async updateTreeHierarchy(existingOid, updatedOid, path7, type, pathEntries, pathParts) {
7089
7604
  const lastIdx = pathEntries.length - 1;
7090
7605
  const parentEntry = pathEntries[lastIdx];
@@ -7140,6 +7655,13 @@ var IsomorphicBridge = class {
7140
7655
  );
7141
7656
  }
7142
7657
  }
7658
+ /**
7659
+ * Creates a commit for the specified tree and updates the specified ref to point to the commit
7660
+ *
7661
+ * @param treeSha - sha of the new tree
7662
+ * @param ref - the ref that should be updated
7663
+ * @private
7664
+ */
7143
7665
  async commitTree(treeSha, ref) {
7144
7666
  const commitSha = await import_isomorphic_git2.default.writeCommit({
7145
7667
  ...this.isomorphicConfig,
@@ -7152,6 +7674,7 @@ var IsomorphicBridge = class {
7152
7674
  })
7153
7675
  ],
7154
7676
  message: this.commitMessage,
7677
+ // TODO these should be configurable
7155
7678
  author: this.getAuthor(),
7156
7679
  committer: this.getCommitter()
7157
7680
  }
@@ -7390,5 +7913,5 @@ var buildSchema = async (config, flags) => {
7390
7913
  transformDocument,
7391
7914
  transformDocumentIntoPayload
7392
7915
  });
7393
- //! Replaces _.flattenDeep()
7394
7916
  //! Replaces _.get()
7917
+ //! Replaces _.flattenDeep()