datocms-plugin-sdk 0.8.0 → 0.8.2

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.
@@ -1221,16 +1221,19 @@ export declare type ItemFormAdditionalMethods = {
1221
1221
  * Takes the internal form state, and transforms it into an Item entity
1222
1222
  * compatible with DatoCMS API.
1223
1223
  *
1224
+ * When `skipUnchangedFields`, only the fields that changed value will be
1225
+ * serialized.
1226
+ *
1224
1227
  * If the required nested blocks are still not loaded, this method will return
1225
1228
  * `undefined`.
1226
1229
  *
1227
1230
  * @example
1228
1231
  *
1229
1232
  * ```js
1230
- * await ctx.formValuesToItem(ctx.formValues);
1233
+ * await ctx.formValuesToItem(ctx.formValues, false);
1231
1234
  * ```
1232
1235
  */
1233
- formValuesToItem: (formValues: Record<string, unknown>) => Promise<Omit<Item, 'id' | 'meta'> | undefined>;
1236
+ formValuesToItem: (formValues: Record<string, unknown>, skipUnchangedFields?: boolean) => Promise<Omit<Item, 'id' | 'meta'> | undefined>;
1234
1237
  /**
1235
1238
  * Takes an Item entity, and converts it into the internal form state
1236
1239
  *
@@ -1221,16 +1221,19 @@ export declare type ItemFormAdditionalMethods = {
1221
1221
  * Takes the internal form state, and transforms it into an Item entity
1222
1222
  * compatible with DatoCMS API.
1223
1223
  *
1224
+ * When `skipUnchangedFields`, only the fields that changed value will be
1225
+ * serialized.
1226
+ *
1224
1227
  * If the required nested blocks are still not loaded, this method will return
1225
1228
  * `undefined`.
1226
1229
  *
1227
1230
  * @example
1228
1231
  *
1229
1232
  * ```js
1230
- * await ctx.formValuesToItem(ctx.formValues);
1233
+ * await ctx.formValuesToItem(ctx.formValues, false);
1231
1234
  * ```
1232
1235
  */
1233
- formValuesToItem: (formValues: Record<string, unknown>) => Promise<Omit<Item, 'id' | 'meta'> | undefined>;
1236
+ formValuesToItem: (formValues: Record<string, unknown>, skipUnchangedFields?: boolean) => Promise<Omit<Item, 'id' | 'meta'> | undefined>;
1234
1237
  /**
1235
1238
  * Takes an Item entity, and converts it into the internal form state
1236
1239
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datocms-plugin-sdk",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "DatoCMS Plugin SDK",
5
5
  "keywords": [
6
6
  "datocms",
@@ -44,5 +44,5 @@
44
44
  "devDependencies": {
45
45
  "typedoc": "^0.23.20"
46
46
  },
47
- "gitHead": "9110cbf584ae4ac4ace170d25899ec90e32db588"
47
+ "gitHead": "cd9036995eefda50300a5226e7511ee7f3377cd0"
48
48
  }
package/src/types.ts CHANGED
@@ -1313,17 +1313,21 @@ export type ItemFormAdditionalMethods = {
1313
1313
  * Takes the internal form state, and transforms it into an Item entity
1314
1314
  * compatible with DatoCMS API.
1315
1315
  *
1316
+ * When `skipUnchangedFields`, only the fields that changed value will be
1317
+ * serialized.
1318
+ *
1316
1319
  * If the required nested blocks are still not loaded, this method will return
1317
1320
  * `undefined`.
1318
1321
  *
1319
1322
  * @example
1320
1323
  *
1321
1324
  * ```js
1322
- * await ctx.formValuesToItem(ctx.formValues);
1325
+ * await ctx.formValuesToItem(ctx.formValues, false);
1323
1326
  * ```
1324
1327
  */
1325
1328
  formValuesToItem: (
1326
1329
  formValues: Record<string, unknown>,
1330
+ skipUnchangedFields?: boolean,
1327
1331
  ) => Promise<Omit<Item, 'id' | 'meta'> | undefined>;
1328
1332
  /**
1329
1333
  * Takes an Item entity, and converts it into the internal form state