@tinacms/graphql 1.0.2 → 1.0.3

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
@@ -2454,7 +2454,7 @@ var validateField = async (field) => {
2454
2454
 
2455
2455
  // package.json
2456
2456
  var name = "@tinacms/graphql";
2457
- var version = "1.0.2";
2457
+ var version = "1.0.3";
2458
2458
  var main = "dist/index.js";
2459
2459
  var typings = "dist/index.d.ts";
2460
2460
  var files = [
@@ -2997,7 +2997,8 @@ var Resolver = class {
2997
2997
  collection,
2998
2998
  template: lastItem(template.namespace)
2999
2999
  },
3000
- _values: data
3000
+ _values: data,
3001
+ _rawData: rawData
3001
3002
  });
3002
3003
  } catch (e) {
3003
3004
  if (e instanceof TinaGraphQLError) {
@@ -3103,6 +3104,8 @@ var Resolver = class {
3103
3104
  isAddPendingDocument,
3104
3105
  isCollectionSpecific
3105
3106
  }) => {
3107
+ const doc = await this.getDocument(realPath);
3108
+ const oldDoc = (doc == null ? void 0 : doc._rawData) || {};
3106
3109
  if (isAddPendingDocument === true) {
3107
3110
  const templateInfo = this.tinaSchema.getTemplatesForCollectable(collection);
3108
3111
  const params2 = this.buildParams(args);
@@ -3110,7 +3113,7 @@ var Resolver = class {
3110
3113
  case "object":
3111
3114
  if (params2) {
3112
3115
  const values = this.buildFieldMutations(params2, templateInfo.template);
3113
- await this.database.put(realPath, values, collection.name);
3116
+ await this.database.put(realPath, __spreadValues(__spreadValues({}, oldDoc), values), collection.name);
3114
3117
  }
3115
3118
  break;
3116
3119
  case "union":
@@ -3120,7 +3123,7 @@ var Resolver = class {
3120
3123
  if (typeof templateParams === "string") {
3121
3124
  throw new Error(`Expected to find an object for template params, but got string`);
3122
3125
  }
3123
- const values = __spreadProps(__spreadValues({}, this.buildFieldMutations(templateParams, template)), {
3126
+ const values = __spreadProps(__spreadValues(__spreadValues({}, oldDoc), this.buildFieldMutations(templateParams, template)), {
3124
3127
  _template: lastItem(template.namespace)
3125
3128
  });
3126
3129
  await this.database.put(realPath, values, collection.name);
@@ -3130,7 +3133,7 @@ var Resolver = class {
3130
3133
  return this.getDocument(realPath);
3131
3134
  }
3132
3135
  const params = this.buildObjectMutations(isCollectionSpecific ? args.params : args.params[collection.name], collection);
3133
- await this.database.put(realPath, params, collection.name);
3136
+ await this.database.put(realPath, __spreadValues(__spreadValues({}, oldDoc), params), collection.name);
3134
3137
  return this.getDocument(realPath);
3135
3138
  };
3136
3139
  this.resolveDocument = async ({
@@ -88,6 +88,10 @@ export declare class Resolver {
88
88
  _collection: string;
89
89
  _template: string;
90
90
  };
91
+ _rawData: {
92
+ _collection: string;
93
+ _template: string;
94
+ };
91
95
  _collection: string;
92
96
  _template: string;
93
97
  __typename: string;
@@ -120,6 +124,10 @@ export declare class Resolver {
120
124
  _collection: string;
121
125
  _template: string;
122
126
  };
127
+ _rawData: {
128
+ _collection: string;
129
+ _template: string;
130
+ };
123
131
  _collection: string;
124
132
  _template: string;
125
133
  __typename: string;
@@ -147,6 +155,10 @@ export declare class Resolver {
147
155
  _collection: string;
148
156
  _template: string;
149
157
  };
158
+ _rawData: {
159
+ _collection: string;
160
+ _template: string;
161
+ };
150
162
  _collection: string;
151
163
  _template: string;
152
164
  __typename: string;
@@ -176,6 +188,10 @@ export declare class Resolver {
176
188
  _collection: string;
177
189
  _template: string;
178
190
  };
191
+ _rawData: {
192
+ _collection: string;
193
+ _template: string;
194
+ };
179
195
  _collection: string;
180
196
  _template: string;
181
197
  __typename: string;
@@ -202,6 +218,10 @@ export declare class Resolver {
202
218
  _collection: string;
203
219
  _template: string;
204
220
  };
221
+ _rawData: {
222
+ _collection: string;
223
+ _template: string;
224
+ };
205
225
  _collection: string;
206
226
  _template: string;
207
227
  __typename: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -20,8 +20,8 @@
20
20
  "dependencies": {
21
21
  "@graphql-tools/relay-operation-optimizer": "^6.4.1",
22
22
  "@tinacms/datalayer": "1.0.0",
23
- "@tinacms/schema-tools": "1.0.2",
24
- "@tinacms/mdx": "1.0.2",
23
+ "@tinacms/schema-tools": "1.0.3",
24
+ "@tinacms/mdx": "1.0.3",
25
25
  "body-parser": "^1.19.0",
26
26
  "cors": "^2.8.5",
27
27
  "dataloader": "^2.0.0",
@@ -72,7 +72,7 @@
72
72
  },
73
73
  "devDependencies": {
74
74
  "@tinacms/datalayer": "1.0.0",
75
- "@tinacms/schema-tools": "1.0.2",
75
+ "@tinacms/schema-tools": "1.0.3",
76
76
  "@tinacms/scripts": "1.0.0",
77
77
  "@types/cors": "^2.8.7",
78
78
  "@types/estree": "^0.0.50",