@tinacms/graphql 0.0.0-202256142235 → 0.0.0-20225621459

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 CHANGED
@@ -1,16 +1,12 @@
1
1
  # tina-graphql
2
2
 
3
- ## 0.0.0-202256142235
3
+ ## 0.0.0-20225621459
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 57f09bdd7: Always use the query function when the dataLayer in enabled
8
-
9
- ## 0.60.4
10
-
11
- ### Patch Changes
12
-
13
- - d103b27ad: Fix issue where new collections would not be added when CLI restarts
7
+ - ed565bd3b: Experimental isomorphic git bridge implementation
8
+ - Updated dependencies [ed565bd3b]
9
+ - @tinacms/datalayer@0.0.0-20225621459
14
10
 
15
11
  ## 0.60.3
16
12
 
@@ -44,6 +44,8 @@ export declare class Database {
44
44
  private tinaSchema;
45
45
  private collectionIndexDefinitions;
46
46
  private _lookup;
47
+ private _graphql;
48
+ private _tinaSchema;
47
49
  constructor(config: CreateDatabase);
48
50
  private collectionForPath;
49
51
  private partitionPathsByCollection;
@@ -63,10 +65,6 @@ export declare class Database {
63
65
  };
64
66
  keepTemplateKey: boolean;
65
67
  }>;
66
- /**
67
- * Clears the internal cache of the tinaSchema and the lookup file. This allows the state to be reset
68
- */
69
- clearCache(): void;
70
68
  flush: (filepath: string) => Promise<string>;
71
69
  getLookup: (returnType: string) => Promise<LookupMapType>;
72
70
  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.4";
12483
+ var version = "0.60.3";
12484
12484
  var main = "dist/index.js";
12485
12485
  var typings = "dist/index.d.ts";
12486
12486
  var files = [
@@ -12813,6 +12813,9 @@ var indexDB = async ({
12813
12813
  if (flags.indexOf("experimentalData") === -1) {
12814
12814
  flags.push("experimentalData");
12815
12815
  }
12816
+ if (flags.indexOf("isomorphicGitBridge") === -1) {
12817
+ flags.push("isomorphicGitBridge");
12818
+ }
12816
12819
  }
12817
12820
  const tinaSchema = await createSchema({ schema: config, flags });
12818
12821
  const builder = await createBuilder({
@@ -22751,6 +22754,10 @@ var Resolver = class {
22751
22754
  })
22752
22755
  };
22753
22756
  };
22757
+ this.getDocumentsForCollection = async (collectionName) => {
22758
+ const collection = this.tinaSchema.getCollection(collectionName);
22759
+ return this.database.store.glob(collection.path, this.getDocument);
22760
+ };
22754
22761
  this.referenceResolver = async (filter, fieldDefinition) => {
22755
22762
  const referencedCollection = this.tinaSchema.getCollection(fieldDefinition.collections[0]);
22756
22763
  if (!referencedCollection) {
@@ -22775,11 +22782,9 @@ var Resolver = class {
22775
22782
  collection,
22776
22783
  hydrator
22777
22784
  }) => {
22778
- var _a, _b, _c, _d;
22779
22785
  let edges;
22780
22786
  let pageInfo;
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) {
22787
+ if (args.filter || args.sort) {
22783
22788
  let conditions;
22784
22789
  if (args.filter) {
22785
22790
  if (collection.fields) {
@@ -23003,14 +23008,12 @@ var resolve = async ({
23003
23008
  database,
23004
23009
  silenceErrors
23005
23010
  }) => {
23006
- var _a;
23007
23011
  try {
23008
23012
  const graphQLSchemaAst = await database.getGraphQLSchema();
23009
23013
  const graphQLSchema = (0, import_graphql3.buildASTSchema)(graphQLSchemaAst);
23010
23014
  const tinaConfig = await database.getTinaSchema();
23011
23015
  const tinaSchema = await createSchema({
23012
- schema: tinaConfig,
23013
- flags: (_a = tinaConfig == null ? void 0 : tinaConfig.meta) == null ? void 0 : _a.flags
23016
+ schema: tinaConfig
23014
23017
  });
23015
23018
  const resolver2 = await createResolver2({ config, database, tinaSchema });
23016
23019
  const res = await (0, import_graphql3.graphql)({
@@ -23044,8 +23047,8 @@ var resolve = async ({
23044
23047
  if (info.fieldName === "collections") {
23045
23048
  const collectionNode2 = info.fieldNodes.find((x) => x.name.value === "collections");
23046
23049
  const hasDocuments2 = collectionNode2.selectionSet.selections.find((x) => {
23047
- var _a2;
23048
- return ((_a2 = x == null ? void 0 : x.name) == null ? void 0 : _a2.value) === "documents";
23050
+ var _a;
23051
+ return ((_a = x == null ? void 0 : x.name) == null ? void 0 : _a.value) === "documents";
23049
23052
  });
23050
23053
  return tinaSchema.getCollections().map((collection) => {
23051
23054
  return resolver2.resolveCollection(args, collection.name, Boolean(hasDocuments2));
@@ -23053,8 +23056,8 @@ var resolve = async ({
23053
23056
  }
23054
23057
  const collectionNode = info.fieldNodes.find((x) => x.name.value === "collection");
23055
23058
  const hasDocuments = collectionNode.selectionSet.selections.find((x) => {
23056
- var _a2;
23057
- return ((_a2 = x == null ? void 0 : x.name) == null ? void 0 : _a2.value) === "documents";
23059
+ var _a;
23060
+ return ((_a = x == null ? void 0 : x.name) == null ? void 0 : _a.value) === "documents";
23058
23061
  });
23059
23062
  return resolver2.resolveCollection(args, args.collection, Boolean(hasDocuments));
23060
23063
  }
@@ -23590,6 +23593,7 @@ var Database = class {
23590
23593
  const tinaSchema = await this.getSchema();
23591
23594
  await sequential(tinaSchema.getCollections(), async (collection) => {
23592
23595
  const documentPaths = await this.bridge.glob(normalizePath(collection.path));
23596
+ console.log({ documentPaths });
23593
23597
  await _indexContent(this, documentPaths, collection);
23594
23598
  });
23595
23599
  };
@@ -23628,10 +23632,6 @@ var Database = class {
23628
23632
  }
23629
23633
  return { pathsByCollection, nonCollectionPaths, collections };
23630
23634
  }
23631
- clearCache() {
23632
- this.tinaSchema = null;
23633
- this._lookup = null;
23634
- }
23635
23635
  async indexStatusCallbackWrapper(fn) {
23636
23636
  await this.indexStatusCallback({ status: "inprogress" });
23637
23637
  try {
@@ -23665,6 +23665,9 @@ var _indexContent = async (database, documentPaths, collection) => {
23665
23665
  }
23666
23666
  await sequential(documentPaths, async (filepath) => {
23667
23667
  const dataString = await database.bridge.get(normalizePath(filepath));
23668
+ if (!dataString) {
23669
+ console.log("bridge returned undefined for ", filepath);
23670
+ }
23668
23671
  const data = parseFile(dataString, import_path4.default.extname(filepath), (yup3) => yup3.object({}));
23669
23672
  if (database.store.supportsSeeding()) {
23670
23673
  await database.store.seed(normalizePath(filepath), data, seedOptions);
@@ -203,6 +203,7 @@ export declare class Resolver {
203
203
  };
204
204
  }[];
205
205
  }>;
206
+ getDocumentsForCollection: (collectionName: string) => Promise<string[]>;
206
207
  private referenceResolver;
207
208
  private resolveFilterConditions;
208
209
  resolveCollectionConnection: ({ args, collection, hydrator, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "0.0.0-202256142235",
3
+ "version": "0.0.0-20225621459",
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.1.1",
50
+ "@tinacms/datalayer": "0.0.0-20225621459",
51
51
  "body-parser": "^1.19.0",
52
52
  "cors": "^2.8.5",
53
53
  "dataloader": "^2.0.0",
@@ -97,7 +97,7 @@
97
97
  "directory": "packages/tina-graphql"
98
98
  },
99
99
  "devDependencies": {
100
- "@tinacms/datalayer": "0.1.1",
100
+ "@tinacms/datalayer": "0.0.0-20225621459",
101
101
  "@tinacms/schema-tools": "0.0.4",
102
102
  "@tinacms/scripts": "0.50.7",
103
103
  "@types/cors": "^2.8.7",