@tinacms/graphql 2.3.0 → 2.3.1

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
@@ -3035,7 +3035,7 @@ var validateField = async (field) => {
3035
3035
  var package_default = {
3036
3036
  name: "@tinacms/graphql",
3037
3037
  type: "module",
3038
- version: "2.3.0",
3038
+ version: "2.3.1",
3039
3039
  main: "dist/index.js",
3040
3040
  module: "./dist/index.js",
3041
3041
  files: [
@@ -3779,6 +3779,9 @@ var getTemplateForFile = (templateInfo, data) => {
3779
3779
  throw new Error(`Unable to determine template`);
3780
3780
  };
3781
3781
  var loadAndParseWithAliases = async (bridge, filepath, collection, templateInfo) => {
3782
+ if (filepath.endsWith(".gitkeep")) {
3783
+ return { _is_tina_folder_placeholder: true };
3784
+ }
3782
3785
  const dataString = await bridge.get(normalizePath(filepath));
3783
3786
  const data = parseFile(
3784
3787
  dataString,
@@ -5361,6 +5364,12 @@ var Resolver = class _Resolver {
5361
5364
  if (newRealPath === realPath) {
5362
5365
  return doc;
5363
5366
  }
5367
+ const newPathAlreadyExists = await this.database.documentExists(newRealPath);
5368
+ if (newPathAlreadyExists) {
5369
+ throw new Error(
5370
+ `Unable to rename document, ${newRealPath} already exists`
5371
+ );
5372
+ }
5364
5373
  await this.database.put(newRealPath, doc._rawData, collection.name);
5365
5374
  await this.deleteDocument(realPath);
5366
5375
  const collRefs = await this.findReferences(realPath, collection);
@@ -6915,7 +6924,10 @@ var Database = class {
6915
6924
  if (!collection) {
6916
6925
  throw new GraphQLError5(`Unable to find collection for ${filepath}.`);
6917
6926
  }
6918
- if (collection.match?.exclude || collection.match?.include) {
6927
+ const isFolderPlaceholder = filepath.endsWith(
6928
+ `.gitkeep.${collection.format || "md"}`
6929
+ );
6930
+ if (!isFolderPlaceholder && (collection.match?.exclude || collection.match?.include)) {
6919
6931
  const matches = this.tinaSchema.getMatches({ collection });
6920
6932
  const match = micromatch2.isMatch(filepath, matches);
6921
6933
  if (!match) {
@@ -7839,8 +7851,9 @@ var _indexContent = async ({
7839
7851
  ]);
7840
7852
  }
7841
7853
  }
7854
+ let putOps = [];
7842
7855
  if (!isGitKeep(filepath, collection)) {
7843
- await enqueueOps([
7856
+ putOps = [
7844
7857
  ...makeRefOpsForDocument(
7845
7858
  normalizedPath,
7846
7859
  collection?.name,
@@ -7865,18 +7878,21 @@ var _indexContent = async ({
7865
7878
  aliasedData,
7866
7879
  "put",
7867
7880
  level
7868
- ),
7869
- {
7870
- type: "put",
7871
- key: normalizedPath,
7872
- value: aliasedData,
7873
- sublevel: level.sublevel(
7874
- CONTENT_ROOT_PREFIX,
7875
- SUBLEVEL_OPTIONS
7876
- )
7877
- }
7878
- ]);
7881
+ )
7882
+ ];
7879
7883
  }
7884
+ await enqueueOps([
7885
+ ...putOps,
7886
+ {
7887
+ type: "put",
7888
+ key: normalizedPath,
7889
+ value: aliasedData,
7890
+ sublevel: level.sublevel(
7891
+ CONTENT_ROOT_PREFIX,
7892
+ SUBLEVEL_OPTIONS
7893
+ )
7894
+ }
7895
+ ]);
7880
7896
  } catch (error) {
7881
7897
  throw new TinaFetchError(`Unable to seed ${filepath}`, {
7882
7898
  originalError: error,
@@ -11,6 +11,11 @@ interface ResolverConfig {
11
11
  isAudit: boolean;
12
12
  }
13
13
  export declare const createResolver: (args: ResolverConfig) => Resolver;
14
+ export declare const resolveFieldData: ({ namespace, ...field }: TinaField<true>, rawData: unknown, accumulator: {
15
+ [key: string]: unknown;
16
+ }, tinaSchema: TinaSchema, config?: GraphQLConfig, isAudit?: boolean) => Promise<{
17
+ [key: string]: unknown;
18
+ }>;
14
19
  export declare const transformDocumentIntoPayload: (fullPath: string, rawData: {
15
20
  _collection: any;
16
21
  _template: any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
3
  "type": "module",
4
- "version": "2.3.0",
4
+ "version": "2.3.1",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.js",
7
7
  "files": [
@@ -43,8 +43,8 @@
43
43
  "normalize-path": "^3.0.0",
44
44
  "readable-stream": "^4.7.0",
45
45
  "yup": "^1.6.1",
46
- "@tinacms/schema-tools": "2.7.3",
47
- "@tinacms/mdx": "2.1.3"
46
+ "@tinacms/mdx": "2.1.4",
47
+ "@tinacms/schema-tools": "2.7.4"
48
48
  },
49
49
  "publishConfig": {
50
50
  "registry": "https://registry.npmjs.org"
@@ -72,8 +72,8 @@
72
72
  "vite": "^4.5.9",
73
73
  "vitest": "^0.32.4",
74
74
  "zod": "^3.24.2",
75
- "@tinacms/schema-tools": "2.7.3",
76
- "@tinacms/scripts": "1.6.0"
75
+ "@tinacms/schema-tools": "2.7.4",
76
+ "@tinacms/scripts": "1.6.1"
77
77
  },
78
78
  "scripts": {
79
79
  "types": "pnpm tsc",