@tinacms/graphql 1.4.38 → 1.4.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +122 -111
  2. package/dist/index.mjs +122 -111
  3. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -2874,7 +2874,7 @@ var validateField = async (field) => {
2874
2874
  // package.json
2875
2875
  var package_default = {
2876
2876
  name: "@tinacms/graphql",
2877
- version: "1.4.38",
2877
+ version: "1.4.40",
2878
2878
  main: "dist/index.js",
2879
2879
  module: "dist/index.mjs",
2880
2880
  typings: "dist/index.d.ts",
@@ -2919,7 +2919,7 @@ var package_default = {
2919
2919
  "js-sha1": "^0.6.0",
2920
2920
  "js-yaml": "^3.14.1",
2921
2921
  "jsonpath-plus": "^6.0.1",
2922
- lodash: "^4.17.20",
2922
+ lodash: "4.17.20",
2923
2923
  "many-level": "^2.0.0",
2924
2924
  micromatch: "4.0.5",
2925
2925
  "normalize-path": "^3.0.0",
@@ -2943,7 +2943,7 @@ var package_default = {
2943
2943
  "@types/fs-extra": "^9.0.2",
2944
2944
  "@types/jest": "^26.0.4",
2945
2945
  "@types/js-yaml": "^3.12.5",
2946
- "@types/lodash": "^4.14.161",
2946
+ "@types/lodash": "4.14.190",
2947
2947
  "@types/lodash.camelcase": "^4.3.6",
2948
2948
  "@types/lodash.upperfirst": "^4.3.6",
2949
2949
  "@types/lru-cache": "^5.1.0",
@@ -2959,7 +2959,7 @@ var package_default = {
2959
2959
  "jest-matcher-utils": "^29.5.0",
2960
2960
  "memory-level": "^1.0.0",
2961
2961
  nodemon: "2.0.19",
2962
- typescript: "4.6.4"
2962
+ typescript: "4.7.4"
2963
2963
  }
2964
2964
  };
2965
2965
 
@@ -5801,46 +5801,50 @@ var Database = class {
5801
5801
  }
5802
5802
  const folderTreeBuilder = new FolderTreeBuilder();
5803
5803
  const folderKey = folderTreeBuilder.update(filepath, collection.path || "");
5804
- const putOps = [
5805
- ...makeIndexOpsForDocument(
5806
- normalizedPath,
5807
- collection == null ? void 0 : collection.name,
5808
- collectionIndexDefinitions,
5809
- dataFields,
5810
- "put",
5811
- level
5812
- ),
5813
- ...makeIndexOpsForDocument(
5814
- normalizedPath,
5815
- `${collection == null ? void 0 : collection.name}_${folderKey}`,
5816
- collectionIndexDefinitions,
5817
- dataFields,
5818
- "put",
5819
- level
5820
- )
5821
- ];
5822
- const existingItem = await level.sublevel(
5823
- CONTENT_ROOT_PREFIX,
5824
- SUBLEVEL_OPTIONS
5825
- ).get(normalizedPath);
5826
- const delOps = existingItem ? [
5827
- ...makeIndexOpsForDocument(
5828
- normalizedPath,
5829
- collection == null ? void 0 : collection.name,
5830
- collectionIndexDefinitions,
5831
- existingItem,
5832
- "del",
5833
- level
5834
- ),
5835
- ...makeIndexOpsForDocument(
5836
- normalizedPath,
5837
- `${collection == null ? void 0 : collection.name}_${folderKey}`,
5838
- collectionIndexDefinitions,
5839
- existingItem,
5840
- "del",
5841
- level
5842
- )
5843
- ] : [];
5804
+ let putOps = [];
5805
+ let delOps = [];
5806
+ if (!isGitKeep(normalizedPath, collection)) {
5807
+ putOps = [
5808
+ ...makeIndexOpsForDocument(
5809
+ normalizedPath,
5810
+ collection == null ? void 0 : collection.name,
5811
+ collectionIndexDefinitions,
5812
+ dataFields,
5813
+ "put",
5814
+ level
5815
+ ),
5816
+ ...makeIndexOpsForDocument(
5817
+ normalizedPath,
5818
+ `${collection == null ? void 0 : collection.name}_${folderKey}`,
5819
+ collectionIndexDefinitions,
5820
+ dataFields,
5821
+ "put",
5822
+ level
5823
+ )
5824
+ ];
5825
+ const existingItem = await level.sublevel(
5826
+ CONTENT_ROOT_PREFIX,
5827
+ SUBLEVEL_OPTIONS
5828
+ ).get(normalizedPath);
5829
+ delOps = existingItem ? [
5830
+ ...makeIndexOpsForDocument(
5831
+ normalizedPath,
5832
+ collection == null ? void 0 : collection.name,
5833
+ collectionIndexDefinitions,
5834
+ existingItem,
5835
+ "del",
5836
+ level
5837
+ ),
5838
+ ...makeIndexOpsForDocument(
5839
+ normalizedPath,
5840
+ `${collection == null ? void 0 : collection.name}_${folderKey}`,
5841
+ collectionIndexDefinitions,
5842
+ existingItem,
5843
+ "del",
5844
+ level
5845
+ )
5846
+ ] : [];
5847
+ }
5844
5848
  const ops = [
5845
5849
  ...delOps,
5846
5850
  ...putOps,
@@ -5913,46 +5917,50 @@ var Database = class {
5913
5917
  collection.path || ""
5914
5918
  );
5915
5919
  const level = (collection == null ? void 0 : collection.isDetached) ? this.appLevel.sublevel(collection == null ? void 0 : collection.name, SUBLEVEL_OPTIONS) : this.contentLevel;
5916
- const putOps = [
5917
- ...makeIndexOpsForDocument(
5918
- normalizedPath,
5919
- collectionName,
5920
- collectionIndexDefinitions,
5921
- dataFields,
5922
- "put",
5923
- level
5924
- ),
5925
- ...makeIndexOpsForDocument(
5926
- normalizedPath,
5927
- `${collection == null ? void 0 : collection.name}_${folderKey}`,
5928
- collectionIndexDefinitions,
5929
- dataFields,
5930
- "put",
5931
- level
5932
- )
5933
- ];
5934
- const existingItem = await level.sublevel(
5935
- CONTENT_ROOT_PREFIX,
5936
- SUBLEVEL_OPTIONS
5937
- ).get(normalizedPath);
5938
- const delOps = existingItem ? [
5939
- ...makeIndexOpsForDocument(
5940
- normalizedPath,
5941
- collectionName,
5942
- collectionIndexDefinitions,
5943
- existingItem,
5944
- "del",
5945
- level
5946
- ),
5947
- ...makeIndexOpsForDocument(
5948
- normalizedPath,
5949
- `${collection == null ? void 0 : collection.name}_${folderKey}`,
5950
- collectionIndexDefinitions,
5951
- existingItem,
5952
- "del",
5953
- level
5954
- )
5955
- ] : [];
5920
+ let putOps = [];
5921
+ let delOps = [];
5922
+ if (!isGitKeep(normalizedPath, collection)) {
5923
+ putOps = [
5924
+ ...makeIndexOpsForDocument(
5925
+ normalizedPath,
5926
+ collectionName,
5927
+ collectionIndexDefinitions,
5928
+ dataFields,
5929
+ "put",
5930
+ level
5931
+ ),
5932
+ ...makeIndexOpsForDocument(
5933
+ normalizedPath,
5934
+ `${collection == null ? void 0 : collection.name}_${folderKey}`,
5935
+ collectionIndexDefinitions,
5936
+ dataFields,
5937
+ "put",
5938
+ level
5939
+ )
5940
+ ];
5941
+ const existingItem = await level.sublevel(
5942
+ CONTENT_ROOT_PREFIX,
5943
+ SUBLEVEL_OPTIONS
5944
+ ).get(normalizedPath);
5945
+ delOps = existingItem ? [
5946
+ ...makeIndexOpsForDocument(
5947
+ normalizedPath,
5948
+ collectionName,
5949
+ collectionIndexDefinitions,
5950
+ existingItem,
5951
+ "del",
5952
+ level
5953
+ ),
5954
+ ...makeIndexOpsForDocument(
5955
+ normalizedPath,
5956
+ `${collection == null ? void 0 : collection.name}_${folderKey}`,
5957
+ collectionIndexDefinitions,
5958
+ existingItem,
5959
+ "del",
5960
+ level
5961
+ )
5962
+ ] : [];
5963
+ }
5956
5964
  const ops = [
5957
5965
  ...delOps,
5958
5966
  ...putOps,
@@ -6653,6 +6661,7 @@ var hashPasswordValues = async (data, passwordFields) => Promise.all(
6653
6661
  async (passwordField) => visitNodes(data, passwordField, hashPasswordVisitor)
6654
6662
  )
6655
6663
  );
6664
+ var isGitKeep = (filepath, collection) => filepath.endsWith(`.gitkeep.${(collection == null ? void 0 : collection.format) || "md"}`);
6656
6665
  var _indexContent = async (database, level, documentPaths, enqueueOps, collection, passwordFields) => {
6657
6666
  let collectionIndexDefinitions;
6658
6667
  let collectionPath;
@@ -6689,33 +6698,35 @@ var _indexContent = async (database, level, documentPaths, enqueueOps, collectio
6689
6698
  normalizedPath,
6690
6699
  collectionPath || ""
6691
6700
  );
6692
- await enqueueOps([
6693
- ...makeIndexOpsForDocument(
6694
- normalizedPath,
6695
- collection == null ? void 0 : collection.name,
6696
- collectionIndexDefinitions,
6697
- aliasedData,
6698
- "put",
6699
- level
6700
- ),
6701
- ...makeIndexOpsForDocument(
6702
- normalizedPath,
6703
- `${collection == null ? void 0 : collection.name}_${folderKey}`,
6704
- collectionIndexDefinitions,
6705
- aliasedData,
6706
- "put",
6707
- level
6708
- ),
6709
- {
6710
- type: "put",
6711
- key: normalizedPath,
6712
- value: aliasedData,
6713
- sublevel: level.sublevel(
6714
- CONTENT_ROOT_PREFIX,
6715
- SUBLEVEL_OPTIONS
6716
- )
6717
- }
6718
- ]);
6701
+ if (!isGitKeep(filepath, collection)) {
6702
+ await enqueueOps([
6703
+ ...makeIndexOpsForDocument(
6704
+ normalizedPath,
6705
+ collection == null ? void 0 : collection.name,
6706
+ collectionIndexDefinitions,
6707
+ aliasedData,
6708
+ "put",
6709
+ level
6710
+ ),
6711
+ ...makeIndexOpsForDocument(
6712
+ normalizedPath,
6713
+ `${collection == null ? void 0 : collection.name}_${folderKey}`,
6714
+ collectionIndexDefinitions,
6715
+ aliasedData,
6716
+ "put",
6717
+ level
6718
+ ),
6719
+ {
6720
+ type: "put",
6721
+ key: normalizedPath,
6722
+ value: aliasedData,
6723
+ sublevel: level.sublevel(
6724
+ CONTENT_ROOT_PREFIX,
6725
+ SUBLEVEL_OPTIONS
6726
+ )
6727
+ }
6728
+ ]);
6729
+ }
6719
6730
  } catch (error) {
6720
6731
  throw new TinaFetchError(`Unable to seed ${filepath}`, {
6721
6732
  originalError: error,
package/dist/index.mjs CHANGED
@@ -2807,7 +2807,7 @@ var validateField = async (field) => {
2807
2807
  // package.json
2808
2808
  var package_default = {
2809
2809
  name: "@tinacms/graphql",
2810
- version: "1.4.38",
2810
+ version: "1.4.40",
2811
2811
  main: "dist/index.js",
2812
2812
  module: "dist/index.mjs",
2813
2813
  typings: "dist/index.d.ts",
@@ -2852,7 +2852,7 @@ var package_default = {
2852
2852
  "js-sha1": "^0.6.0",
2853
2853
  "js-yaml": "^3.14.1",
2854
2854
  "jsonpath-plus": "^6.0.1",
2855
- lodash: "^4.17.20",
2855
+ lodash: "4.17.20",
2856
2856
  "many-level": "^2.0.0",
2857
2857
  micromatch: "4.0.5",
2858
2858
  "normalize-path": "^3.0.0",
@@ -2876,7 +2876,7 @@ var package_default = {
2876
2876
  "@types/fs-extra": "^9.0.2",
2877
2877
  "@types/jest": "^26.0.4",
2878
2878
  "@types/js-yaml": "^3.12.5",
2879
- "@types/lodash": "^4.14.161",
2879
+ "@types/lodash": "4.14.190",
2880
2880
  "@types/lodash.camelcase": "^4.3.6",
2881
2881
  "@types/lodash.upperfirst": "^4.3.6",
2882
2882
  "@types/lru-cache": "^5.1.0",
@@ -2892,7 +2892,7 @@ var package_default = {
2892
2892
  "jest-matcher-utils": "^29.5.0",
2893
2893
  "memory-level": "^1.0.0",
2894
2894
  nodemon: "2.0.19",
2895
- typescript: "4.6.4"
2895
+ typescript: "4.7.4"
2896
2896
  }
2897
2897
  };
2898
2898
 
@@ -5723,46 +5723,50 @@ var Database = class {
5723
5723
  }
5724
5724
  const folderTreeBuilder = new FolderTreeBuilder();
5725
5725
  const folderKey = folderTreeBuilder.update(filepath, collection.path || "");
5726
- const putOps = [
5727
- ...makeIndexOpsForDocument(
5728
- normalizedPath,
5729
- collection?.name,
5730
- collectionIndexDefinitions,
5731
- dataFields,
5732
- "put",
5733
- level
5734
- ),
5735
- ...makeIndexOpsForDocument(
5736
- normalizedPath,
5737
- `${collection?.name}_${folderKey}`,
5738
- collectionIndexDefinitions,
5739
- dataFields,
5740
- "put",
5741
- level
5742
- )
5743
- ];
5744
- const existingItem = await level.sublevel(
5745
- CONTENT_ROOT_PREFIX,
5746
- SUBLEVEL_OPTIONS
5747
- ).get(normalizedPath);
5748
- const delOps = existingItem ? [
5749
- ...makeIndexOpsForDocument(
5750
- normalizedPath,
5751
- collection?.name,
5752
- collectionIndexDefinitions,
5753
- existingItem,
5754
- "del",
5755
- level
5756
- ),
5757
- ...makeIndexOpsForDocument(
5758
- normalizedPath,
5759
- `${collection?.name}_${folderKey}`,
5760
- collectionIndexDefinitions,
5761
- existingItem,
5762
- "del",
5763
- level
5764
- )
5765
- ] : [];
5726
+ let putOps = [];
5727
+ let delOps = [];
5728
+ if (!isGitKeep(normalizedPath, collection)) {
5729
+ putOps = [
5730
+ ...makeIndexOpsForDocument(
5731
+ normalizedPath,
5732
+ collection?.name,
5733
+ collectionIndexDefinitions,
5734
+ dataFields,
5735
+ "put",
5736
+ level
5737
+ ),
5738
+ ...makeIndexOpsForDocument(
5739
+ normalizedPath,
5740
+ `${collection?.name}_${folderKey}`,
5741
+ collectionIndexDefinitions,
5742
+ dataFields,
5743
+ "put",
5744
+ level
5745
+ )
5746
+ ];
5747
+ const existingItem = await level.sublevel(
5748
+ CONTENT_ROOT_PREFIX,
5749
+ SUBLEVEL_OPTIONS
5750
+ ).get(normalizedPath);
5751
+ delOps = existingItem ? [
5752
+ ...makeIndexOpsForDocument(
5753
+ normalizedPath,
5754
+ collection?.name,
5755
+ collectionIndexDefinitions,
5756
+ existingItem,
5757
+ "del",
5758
+ level
5759
+ ),
5760
+ ...makeIndexOpsForDocument(
5761
+ normalizedPath,
5762
+ `${collection?.name}_${folderKey}`,
5763
+ collectionIndexDefinitions,
5764
+ existingItem,
5765
+ "del",
5766
+ level
5767
+ )
5768
+ ] : [];
5769
+ }
5766
5770
  const ops = [
5767
5771
  ...delOps,
5768
5772
  ...putOps,
@@ -5834,46 +5838,50 @@ var Database = class {
5834
5838
  collection.path || ""
5835
5839
  );
5836
5840
  const level = collection?.isDetached ? this.appLevel.sublevel(collection?.name, SUBLEVEL_OPTIONS) : this.contentLevel;
5837
- const putOps = [
5838
- ...makeIndexOpsForDocument(
5839
- normalizedPath,
5840
- collectionName,
5841
- collectionIndexDefinitions,
5842
- dataFields,
5843
- "put",
5844
- level
5845
- ),
5846
- ...makeIndexOpsForDocument(
5847
- normalizedPath,
5848
- `${collection?.name}_${folderKey}`,
5849
- collectionIndexDefinitions,
5850
- dataFields,
5851
- "put",
5852
- level
5853
- )
5854
- ];
5855
- const existingItem = await level.sublevel(
5856
- CONTENT_ROOT_PREFIX,
5857
- SUBLEVEL_OPTIONS
5858
- ).get(normalizedPath);
5859
- const delOps = existingItem ? [
5860
- ...makeIndexOpsForDocument(
5861
- normalizedPath,
5862
- collectionName,
5863
- collectionIndexDefinitions,
5864
- existingItem,
5865
- "del",
5866
- level
5867
- ),
5868
- ...makeIndexOpsForDocument(
5869
- normalizedPath,
5870
- `${collection?.name}_${folderKey}`,
5871
- collectionIndexDefinitions,
5872
- existingItem,
5873
- "del",
5874
- level
5875
- )
5876
- ] : [];
5841
+ let putOps = [];
5842
+ let delOps = [];
5843
+ if (!isGitKeep(normalizedPath, collection)) {
5844
+ putOps = [
5845
+ ...makeIndexOpsForDocument(
5846
+ normalizedPath,
5847
+ collectionName,
5848
+ collectionIndexDefinitions,
5849
+ dataFields,
5850
+ "put",
5851
+ level
5852
+ ),
5853
+ ...makeIndexOpsForDocument(
5854
+ normalizedPath,
5855
+ `${collection?.name}_${folderKey}`,
5856
+ collectionIndexDefinitions,
5857
+ dataFields,
5858
+ "put",
5859
+ level
5860
+ )
5861
+ ];
5862
+ const existingItem = await level.sublevel(
5863
+ CONTENT_ROOT_PREFIX,
5864
+ SUBLEVEL_OPTIONS
5865
+ ).get(normalizedPath);
5866
+ delOps = existingItem ? [
5867
+ ...makeIndexOpsForDocument(
5868
+ normalizedPath,
5869
+ collectionName,
5870
+ collectionIndexDefinitions,
5871
+ existingItem,
5872
+ "del",
5873
+ level
5874
+ ),
5875
+ ...makeIndexOpsForDocument(
5876
+ normalizedPath,
5877
+ `${collection?.name}_${folderKey}`,
5878
+ collectionIndexDefinitions,
5879
+ existingItem,
5880
+ "del",
5881
+ level
5882
+ )
5883
+ ] : [];
5884
+ }
5877
5885
  const ops = [
5878
5886
  ...delOps,
5879
5887
  ...putOps,
@@ -6573,6 +6581,7 @@ var hashPasswordValues = async (data, passwordFields) => Promise.all(
6573
6581
  async (passwordField) => visitNodes(data, passwordField, hashPasswordVisitor)
6574
6582
  )
6575
6583
  );
6584
+ var isGitKeep = (filepath, collection) => filepath.endsWith(`.gitkeep.${collection?.format || "md"}`);
6576
6585
  var _indexContent = async (database, level, documentPaths, enqueueOps, collection, passwordFields) => {
6577
6586
  let collectionIndexDefinitions;
6578
6587
  let collectionPath;
@@ -6609,33 +6618,35 @@ var _indexContent = async (database, level, documentPaths, enqueueOps, collectio
6609
6618
  normalizedPath,
6610
6619
  collectionPath || ""
6611
6620
  );
6612
- await enqueueOps([
6613
- ...makeIndexOpsForDocument(
6614
- normalizedPath,
6615
- collection?.name,
6616
- collectionIndexDefinitions,
6617
- aliasedData,
6618
- "put",
6619
- level
6620
- ),
6621
- ...makeIndexOpsForDocument(
6622
- normalizedPath,
6623
- `${collection?.name}_${folderKey}`,
6624
- collectionIndexDefinitions,
6625
- aliasedData,
6626
- "put",
6627
- level
6628
- ),
6629
- {
6630
- type: "put",
6631
- key: normalizedPath,
6632
- value: aliasedData,
6633
- sublevel: level.sublevel(
6634
- CONTENT_ROOT_PREFIX,
6635
- SUBLEVEL_OPTIONS
6636
- )
6637
- }
6638
- ]);
6621
+ if (!isGitKeep(filepath, collection)) {
6622
+ await enqueueOps([
6623
+ ...makeIndexOpsForDocument(
6624
+ normalizedPath,
6625
+ collection?.name,
6626
+ collectionIndexDefinitions,
6627
+ aliasedData,
6628
+ "put",
6629
+ level
6630
+ ),
6631
+ ...makeIndexOpsForDocument(
6632
+ normalizedPath,
6633
+ `${collection?.name}_${folderKey}`,
6634
+ collectionIndexDefinitions,
6635
+ aliasedData,
6636
+ "put",
6637
+ level
6638
+ ),
6639
+ {
6640
+ type: "put",
6641
+ key: normalizedPath,
6642
+ value: aliasedData,
6643
+ sublevel: level.sublevel(
6644
+ CONTENT_ROOT_PREFIX,
6645
+ SUBLEVEL_OPTIONS
6646
+ )
6647
+ }
6648
+ ]);
6649
+ }
6639
6650
  } catch (error) {
6640
6651
  throw new TinaFetchError(`Unable to seed ${filepath}`, {
6641
6652
  originalError: error,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "1.4.38",
3
+ "version": "1.4.40",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "typings": "dist/index.d.ts",
@@ -35,15 +35,15 @@
35
35
  "js-sha1": "^0.6.0",
36
36
  "js-yaml": "^3.14.1",
37
37
  "jsonpath-plus": "^6.0.1",
38
- "lodash": "^4.17.20",
38
+ "lodash": "4.17.20",
39
39
  "many-level": "^2.0.0",
40
40
  "micromatch": "4.0.5",
41
41
  "normalize-path": "^3.0.0",
42
42
  "readable-stream": "^4.3.0",
43
43
  "scmp": "^2.1.0",
44
44
  "yup": "^0.32.9",
45
- "@tinacms/mdx": "1.3.28",
46
- "@tinacms/schema-tools": "1.4.19"
45
+ "@tinacms/mdx": "1.3.29",
46
+ "@tinacms/schema-tools": "1.5.0"
47
47
  },
48
48
  "publishConfig": {
49
49
  "registry": "https://registry.npmjs.org"
@@ -59,7 +59,7 @@
59
59
  "@types/fs-extra": "^9.0.2",
60
60
  "@types/jest": "^26.0.4",
61
61
  "@types/js-yaml": "^3.12.5",
62
- "@types/lodash": "^4.14.161",
62
+ "@types/lodash": "4.14.190",
63
63
  "@types/lodash.camelcase": "^4.3.6",
64
64
  "@types/lodash.upperfirst": "^4.3.6",
65
65
  "@types/lru-cache": "^5.1.0",
@@ -75,8 +75,8 @@
75
75
  "jest-matcher-utils": "^29.5.0",
76
76
  "memory-level": "^1.0.0",
77
77
  "nodemon": "2.0.19",
78
- "typescript": "4.6.4",
79
- "@tinacms/schema-tools": "1.4.19",
78
+ "typescript": "4.7.4",
79
+ "@tinacms/schema-tools": "1.5.0",
80
80
  "@tinacms/scripts": "1.1.6"
81
81
  },
82
82
  "scripts": {