sanity 4.4.0-next.22 → 4.4.0-next.23

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.
@@ -379,19 +379,14 @@ class MenuItemGroupBuilder {
379
379
  serialize(options = {
380
380
  path: []
381
381
  }) {
382
- const {
383
- _id,
384
- _title,
385
- _i18n
386
- } = this;
387
- if (!_id)
388
- throw new SerializeError("`id` is required for a menu item group", options.path, options.index, _title).withHelpUrl(HELP_URL.ID_REQUIRED);
389
- if (!_title)
390
- throw new SerializeError("`title` is required for a menu item group", options.path, _id).withHelpUrl(HELP_URL.TITLE_REQUIRED);
382
+ if (!this._id)
383
+ throw new SerializeError("`id` is required for a menu item group", options.path, options.index, this._title).withHelpUrl(HELP_URL.ID_REQUIRED);
384
+ if (!this._title)
385
+ throw new SerializeError("`title` is required for a menu item group", options.path, this._id).withHelpUrl(HELP_URL.TITLE_REQUIRED);
391
386
  return {
392
- id: _id,
393
- title: _title,
394
- i18n: _i18n
387
+ id: this._id,
388
+ title: this._title,
389
+ i18n: this._i18n
395
390
  };
396
391
  }
397
392
  }
@@ -1200,30 +1195,24 @@ class InitialValueTemplateItemBuilder {
1200
1195
  } = {
1201
1196
  path: []
1202
1197
  }) {
1203
- const {
1204
- spec,
1205
- _context
1206
- } = this, {
1207
- templates
1208
- } = _context;
1209
- if (typeof spec.id != "string" || !spec.id)
1198
+ if (typeof this.spec.id != "string" || !this.spec.id)
1210
1199
  throw new SerializeError("`id` is required for initial value template item nodes", path, index, hint).withHelpUrl(HELP_URL.ID_REQUIRED);
1211
- if (!spec.templateId)
1212
- throw new SerializeError("template id (`templateId`) is required for initial value template item nodes", path, spec.id, hint).withHelpUrl(HELP_URL.ID_REQUIRED);
1213
- const template = templates.find((t) => t.id === spec.templateId);
1200
+ if (!this.spec.templateId)
1201
+ throw new SerializeError("template id (`templateId`) is required for initial value template item nodes", path, this.spec.id, hint).withHelpUrl(HELP_URL.ID_REQUIRED);
1202
+ const template = this._context.templates.find((t) => t.id === this.spec.templateId);
1214
1203
  if (!template)
1215
- throw new SerializeError("template id (`templateId`) is required for initial value template item nodes", path, spec.id, hint).withHelpUrl(HELP_URL.ID_REQUIRED);
1204
+ throw new SerializeError("template id (`templateId`) is required for initial value template item nodes", path, this.spec.id, hint).withHelpUrl(HELP_URL.ID_REQUIRED);
1216
1205
  return {
1217
- id: spec.id,
1218
- templateId: spec.id,
1206
+ id: this.spec.id,
1207
+ templateId: this.spec.id,
1219
1208
  schemaType: template.schemaType,
1220
1209
  type: "initialValueTemplateItem",
1221
- description: spec.description || template.description,
1222
- title: spec.title || template.title,
1223
- subtitle: spec.subtitle,
1224
- icon: spec.icon || template.icon,
1225
- initialDocumentId: spec.initialDocumentId,
1226
- parameters: spec.parameters
1210
+ description: this.spec.description || template.description,
1211
+ title: this.spec.title || template.title,
1212
+ subtitle: this.spec.subtitle,
1213
+ icon: this.spec.icon || template.icon,
1214
+ initialDocumentId: this.spec.initialDocumentId,
1215
+ parameters: this.spec.parameters
1227
1216
  };
1228
1217
  }
1229
1218
  /** Clone generic view builder (allows for options overriding)