@tinacms/graphql 0.60.8 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # tina-graphql
2
2
 
3
+ ## 0.61.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4daf15b36: Updated matching logic to only return the correct extension.
8
+
9
+ This means if you are using any other files besides `.md` the format must be provided in the schema.
10
+
11
+ ```ts
12
+ // .tina/schema.ts
13
+
14
+ import { defineSchema } from 'tinacms'
15
+
16
+ const schema = defineSchema({
17
+ collections: [
18
+ {
19
+ name: 'page',
20
+ path: 'content/page',
21
+ label: 'Page',
22
+ // Need to provide the format if the file being used (default is `.md`)
23
+ format: 'mdx',
24
+ fields: [
25
+ //...
26
+ ],
27
+ },
28
+ ],
29
+ })
30
+ //...
31
+
32
+ export default schema
33
+ ```
34
+
35
+ ### Patch Changes
36
+
37
+ - 2ef5a1f33: Use media config from the schema in the local media server
38
+ - 2ef5a1f33: Uses new `schema.config` when resolving media/asset urls
39
+ - b348f8b6b: Experimental isomorphic git bridge implementation
40
+ - fb73fb355: Renames syncFolder to a mediaRoot when configuring Repo-Based Media
41
+ - Updated dependencies [b348f8b6b]
42
+ - Updated dependencies [fb73fb355]
43
+ - Updated dependencies [4daf15b36]
44
+ - @tinacms/datalayer@0.2.0
45
+ - @tinacms/schema-tools@0.0.6
46
+
3
47
  ## 0.60.8
4
48
 
5
49
  ### Patch Changes
@@ -12,7 +12,7 @@ limitations under the License.
12
12
  */
13
13
  export interface Bridge {
14
14
  rootPath: string;
15
- glob(pattern: string): Promise<string[]>;
15
+ glob(pattern: string, extension: string): Promise<string[]>;
16
16
  get(filepath: string): Promise<string>;
17
17
  put(filepath: string, data: string): Promise<void>;
18
18
  delete(filepath: string): Promise<void>;
@@ -28,6 +28,7 @@ declare type CreateDatabase = {
28
28
  export declare const createDatabase: (config: CreateDatabase) => Promise<Database>;
29
29
  /** Options for {@link Database.query} **/
30
30
  export declare type QueryOptions = {
31
+ fileExtension?: string;
31
32
  collection: string;
32
33
  filterChain?: (BinaryFilter | TernaryFilter)[];
33
34
  sort?: string;
package/dist/index.js CHANGED
@@ -12693,7 +12693,7 @@ var validateField = async (field) => {
12693
12693
 
12694
12694
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/package.json
12695
12695
  var name = "@tinacms/graphql";
12696
- var version = "0.60.8";
12696
+ var version = "0.61.0";
12697
12697
  var main = "dist/index.js";
12698
12698
  var typings = "dist/index.d.ts";
12699
12699
  var files = [
@@ -13091,7 +13091,7 @@ var _buildFragments = async (builder, tinaSchema, rootPath) => {
13091
13091
  definitions: import_lodash3.default.uniqBy(extractInlineTypes(fragmentDefinitionsFields), (node) => node.name.value)
13092
13092
  };
13093
13093
  const fragPath = import_path.default.join(rootPath, ".tina", "__generated__");
13094
- await import_fs_extra.default.outputFileSync(import_path.default.join(fragPath, "frags.gql"), (0, import_graphql2.print)(fragDoc));
13094
+ await import_fs_extra.default.outputFile(import_path.default.join(fragPath, "frags.gql"), (0, import_graphql2.print)(fragDoc));
13095
13095
  };
13096
13096
  var _buildQueries = async (builder, tinaSchema, rootPath) => {
13097
13097
  const operationsDefinitions = [];
@@ -13115,7 +13115,7 @@ var _buildQueries = async (builder, tinaSchema, rootPath) => {
13115
13115
  definitions: import_lodash3.default.uniqBy(extractInlineTypes(operationsDefinitions), (node) => node.name.value)
13116
13116
  };
13117
13117
  const fragPath = import_path.default.join(rootPath, ".tina", "__generated__");
13118
- await import_fs_extra.default.outputFileSync(import_path.default.join(fragPath, "queries.gql"), (0, import_graphql2.print)(queryDoc));
13118
+ await import_fs_extra.default.outputFile(import_path.default.join(fragPath, "queries.gql"), (0, import_graphql2.print)(queryDoc));
13119
13119
  };
13120
13120
  var _buildSchema = async (builder, tinaSchema) => {
13121
13121
  const definitions = [];
@@ -20483,9 +20483,9 @@ var resolveMediaCloudToRelative = (value, config = { useRelativeMedia: true }, s
20483
20483
  if (hasTinaMediaConfig(schema) === true) {
20484
20484
  const assetsURL = `https://${config.assetsHost}/${config.clientId}`;
20485
20485
  if (typeof value === "string" && value.includes(assetsURL)) {
20486
- const cleanSyncFolder = cleanUpSlashes(schema.config.media.tina.syncFolder);
20486
+ const cleanMediaRoot = cleanUpSlashes(schema.config.media.tina.mediaRoot);
20487
20487
  const strippedURL = value.replace(assetsURL, "");
20488
- return `${cleanSyncFolder}${strippedURL}`;
20488
+ return `${cleanMediaRoot}${strippedURL}`;
20489
20489
  }
20490
20490
  return value;
20491
20491
  }
@@ -20500,8 +20500,8 @@ var resolveMediaRelativeToCloud = (value, config = { useRelativeMedia: true }, s
20500
20500
  return value;
20501
20501
  }
20502
20502
  if (hasTinaMediaConfig(schema) === true) {
20503
- const cleanSyncFolder = cleanUpSlashes(schema.config.media.tina.syncFolder);
20504
- const strippedValue = value.replace(cleanSyncFolder, "");
20503
+ const cleanMediaRoot = cleanUpSlashes(schema.config.media.tina.mediaRoot);
20504
+ const strippedValue = value.replace(cleanMediaRoot, "");
20505
20505
  return `https://${config.assetsHost}/${config.clientId}${strippedValue}`;
20506
20506
  }
20507
20507
  return value;
@@ -20517,7 +20517,7 @@ var cleanUpSlashes = (path6) => {
20517
20517
  };
20518
20518
  var hasTinaMediaConfig = (schema) => {
20519
20519
  var _a, _b, _c, _d, _e, _f;
20520
- if (((_c = (_b = (_a = schema.config) == null ? void 0 : _a.media) == null ? void 0 : _b.tina) == null ? void 0 : _c.publicFolder) && ((_f = (_e = (_d = schema.config) == null ? void 0 : _d.media) == null ? void 0 : _e.tina) == null ? void 0 : _f.syncFolder)) {
20520
+ if (((_c = (_b = (_a = schema.config) == null ? void 0 : _a.media) == null ? void 0 : _b.tina) == null ? void 0 : _c.publicFolder) && ((_f = (_e = (_d = schema.config) == null ? void 0 : _d.media) == null ? void 0 : _e.tina) == null ? void 0 : _f.mediaRoot)) {
20521
20521
  return true;
20522
20522
  }
20523
20523
  return false;
@@ -23129,7 +23129,8 @@ var Resolver = class {
23129
23129
  edges = result.edges;
23130
23130
  pageInfo = result.pageInfo;
23131
23131
  } else {
23132
- edges = (await this.database.store.glob(collection.path, this.getDocument)).map((document3) => ({
23132
+ const ext = (collection == null ? void 0 : collection.format) || ".md";
23133
+ edges = (await this.database.store.glob(collection.path, this.getDocument, ext)).map((document3) => ({
23133
23134
  node: document3
23134
23135
  }));
23135
23136
  }
@@ -23936,7 +23937,7 @@ var Database = class {
23936
23937
  this._indexAllContent = async () => {
23937
23938
  const tinaSchema = await this.getSchema();
23938
23939
  await sequential(tinaSchema.getCollections(), async (collection) => {
23939
- const documentPaths = await this.bridge.glob(normalizePath(collection.path));
23940
+ const documentPaths = await this.bridge.glob(normalizePath(collection.path), collection.format || "md");
23940
23941
  await _indexContent(this, documentPaths, collection);
23941
23942
  });
23942
23943
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "0.60.8",
3
+ "version": "0.61.0",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -47,8 +47,8 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@graphql-tools/relay-operation-optimizer": "^6.4.1",
50
- "@tinacms/datalayer": "0.1.1",
51
- "@tinacms/schema-tools": "0.0.5",
50
+ "@tinacms/datalayer": "0.2.0",
51
+ "@tinacms/schema-tools": "0.0.6",
52
52
  "body-parser": "^1.19.0",
53
53
  "cors": "^2.8.5",
54
54
  "dataloader": "^2.0.0",
@@ -98,9 +98,9 @@
98
98
  "directory": "packages/tina-graphql"
99
99
  },
100
100
  "devDependencies": {
101
- "@tinacms/datalayer": "0.1.1",
102
- "@tinacms/schema-tools": "0.0.5",
103
- "@tinacms/scripts": "0.50.8",
101
+ "@tinacms/datalayer": "0.2.0",
102
+ "@tinacms/schema-tools": "0.0.6",
103
+ "@tinacms/scripts": "0.50.9",
104
104
  "@types/cors": "^2.8.7",
105
105
  "@types/estree": "^0.0.50",
106
106
  "@types/express": "^4.17.8",