@takeshape/schema 8.265.1 → 8.268.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.
@@ -1,11 +1,11 @@
1
1
  import { FormConfig, ObjectSchema, ProjectSchema } from '../project-schema';
2
2
  export declare function mergeObjectSchemas(...args: Array<ObjectSchema | undefined>): ObjectSchema;
3
- export declare function mergeSchemaProperties(base: ObjectSchema, overrides: ObjectSchema): ObjectSchema;
4
- export declare function rebaseSchemaProperties(to: ObjectSchema, base: ObjectSchema, from: ObjectSchema): ObjectSchema;
5
- export declare function mergeFormProperties(base: FormConfig, overrides: FormConfig): FormConfig;
6
- export declare function rebaseFormProperties(to: FormConfig, base: FormConfig, from: FormConfig): FormConfig;
3
+ export declare function mergeSchemaProperties(parent: ObjectSchema, overrides: ObjectSchema): ObjectSchema;
4
+ export declare function rebaseSchemaProperties(base: ObjectSchema, parent: ObjectSchema, head: ObjectSchema): ObjectSchema;
5
+ export declare function mergeFormProperties(parent: FormConfig, overrides: FormConfig): FormConfig;
6
+ export declare function rebaseFormProperties(base: FormConfig, parent: FormConfig, head: FormConfig): FormConfig;
7
7
  export declare function mergeFormConfigs(...configs: FormConfig[]): FormConfig;
8
- export declare function mergeProjectSchemas(to: ProjectSchema, base: ProjectSchema, from: ProjectSchema): {
8
+ export declare function mergeProjectSchemas(base: ProjectSchema, parent: ProjectSchema, head: ProjectSchema): {
9
9
  error: string;
10
10
  mergedSchema: undefined;
11
11
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/util/merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAE,aAAa,EAAQ,MAAM,mBAAmB,CAAC;AAYjF,wBAAgB,kBAAkB,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,YAAY,CAEzF;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,GAAG,YAAY,CAgB/F;AAED,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,GAAG,YAAY,CAiB7G;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,UAAU,CAevF;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU,CAgBnG;AAED,wBAAgB,gBAAgB,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,CAErE;AAoJD,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,aAAa,EACjB,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,aAAa,GAClB;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,SAAS,CAAA;CAAC,GAAG;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,aAAa,CAAA;CAAC,CAsC5F"}
1
+ {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/util/merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAE,aAAa,EAAQ,MAAM,mBAAmB,CAAC;AAYjF,wBAAgB,kBAAkB,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,YAAY,CAEzF;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,GAAG,YAAY,CAgBjG;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,GAAG,YAAY,CAiBjH;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,UAAU,CAezF;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU,CAgBvG;AAED,wBAAgB,gBAAgB,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,CAErE;AAoJD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,aAAa,GAClB;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,SAAS,CAAA;CAAC,GAAG;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,aAAa,CAAA;CAAC,CAsC5F"}
@@ -40,13 +40,13 @@ function mergeObjectSchemas(...args) {
40
40
  });
41
41
  }
42
42
 
43
- function mergeSchemaProperties(base, overrides) {
44
- const result = { ...base,
45
- properties: { ...base.properties,
43
+ function mergeSchemaProperties(parent, overrides) {
44
+ const result = { ...parent,
45
+ properties: { ...parent.properties,
46
46
  ...overrides.properties
47
47
  }
48
48
  };
49
- const required = (0, _union.default)(base.required, overrides.required);
49
+ const required = (0, _union.default)(parent.required, overrides.required);
50
50
 
51
51
  if (required.length) {
52
52
  result.required = required;
@@ -55,22 +55,22 @@ function mergeSchemaProperties(base, overrides) {
55
55
  return result;
56
56
  }
57
57
 
58
- function rebaseSchemaProperties(to, base, from) {
58
+ function rebaseSchemaProperties(base, parent, head) {
59
59
  const {
60
60
  properties: toProperties,
61
61
  required: toRequired,
62
62
  ...toOther
63
- } = to;
63
+ } = base;
64
64
  const {
65
65
  properties: baseProperties,
66
66
  required: baseRequired,
67
67
  ...baseOther
68
- } = base;
68
+ } = parent;
69
69
  const {
70
70
  properties: fromProperties,
71
71
  required: fromRequired,
72
72
  ...fromOther
73
- } = from;
73
+ } = head;
74
74
  const newSchema = { ...(0, _util.rebaseObject)(toOther, baseOther, fromOther),
75
75
  type: 'object',
76
76
  properties: (0, _util.rebaseObject)(toProperties, baseProperties, fromProperties)
@@ -84,13 +84,13 @@ function rebaseSchemaProperties(to, base, from) {
84
84
  return newSchema;
85
85
  }
86
86
 
87
- function mergeFormProperties(base, overrides) {
88
- const result = { ...base,
89
- properties: { ...base.properties,
87
+ function mergeFormProperties(parent, overrides) {
88
+ const result = { ...parent,
89
+ properties: { ...parent.properties,
90
90
  ...overrides.properties
91
91
  }
92
92
  };
93
- const order = (0, _union.default)(base.order, overrides.order);
93
+ const order = (0, _union.default)(parent.order, overrides.order);
94
94
 
95
95
  if (order.length) {
96
96
  result.order = order;
@@ -99,22 +99,22 @@ function mergeFormProperties(base, overrides) {
99
99
  return result;
100
100
  }
101
101
 
102
- function rebaseFormProperties(to, base, from) {
102
+ function rebaseFormProperties(base, parent, head) {
103
103
  const {
104
104
  properties: toProperties,
105
105
  order: toOrder,
106
106
  ...toOther
107
- } = to;
107
+ } = base;
108
108
  const {
109
109
  properties: baseProperties,
110
110
  order: baseOrder,
111
111
  ...baseOther
112
- } = base;
112
+ } = parent;
113
113
  const {
114
114
  properties: fromProperties,
115
115
  order: fromOrder,
116
116
  ...fromOther
117
- } = from;
117
+ } = head;
118
118
  const newForm = { ...(0, _util.rebaseObject)(toOther, baseOther, fromOther),
119
119
  properties: (0, _util.rebaseObject)(toProperties, baseProperties, fromProperties)
120
120
  };
@@ -170,8 +170,8 @@ function compareSection(section, original, updated) {
170
170
  return changes;
171
171
  }
172
172
 
173
- function compareSections(base, branch) {
174
- return mergeableSections.flatMap(section => base[section] || branch[section] ? compareSection(section, base[section] ?? {}, branch[section] ?? {}) : []);
173
+ function compareSections(parent, branch) {
174
+ return mergeableSections.flatMap(section => parent[section] || branch[section] ? compareSection(section, parent[section] ?? {}, branch[section] ?? {}) : []);
175
175
  }
176
176
 
177
177
  function findChangedShape(schema, change) {
@@ -185,14 +185,14 @@ function getChangedShape(schema, change) {
185
185
  } // eslint-disable-next-line complexity
186
186
 
187
187
 
188
- function attemptToMerge(to, base, from, change) {
189
- const toShape = getChangedShape(to, change);
190
- const fromShape = getChangedShape(from, change);
188
+ function attemptToMerge(base, parent, head, change) {
189
+ const toShape = getChangedShape(base, change);
190
+ const fromShape = getChangedShape(head, change);
191
191
  const toSchema = toShape.schema;
192
192
  const fromSchema = fromShape.schema;
193
193
 
194
194
  if ((0, _types.isObjectSchema)(toSchema) && (0, _types.isObjectSchema)(fromSchema)) {
195
- const baseShape = findChangedShape(base, change);
195
+ const baseShape = findChangedShape(parent, change);
196
196
  const baseSchema = baseShape === null || baseShape === void 0 ? void 0 : baseShape.schema;
197
197
  return { ...(baseShape ? (0, _util.rebaseObject)((0, _omit.default)(toShape, 'schema'), (0, _omit.default)(baseShape, 'schema'), (0, _omit.default)(fromShape, 'schema')) : { ...toShape,
198
198
  ...fromShape
@@ -210,7 +210,7 @@ function attemptToMerge(to, base, from, change) {
210
210
  var _findChangedShape;
211
211
 
212
212
  let mergedObjSchema;
213
- const baseSchema = (_findChangedShape = findChangedShape(base, change)) === null || _findChangedShape === void 0 ? void 0 : _findChangedShape.schema;
213
+ const baseSchema = (_findChangedShape = findChangedShape(parent, change)) === null || _findChangedShape === void 0 ? void 0 : _findChangedShape.schema;
214
214
 
215
215
  if (change.op === 'update' && baseSchema && (0, _types.isExtendsSchema)(baseSchema)) {
216
216
  const baseObj = (0, _last.default)(baseSchema.extends);
@@ -233,45 +233,45 @@ function attemptToMerge(to, base, from, change) {
233
233
  }
234
234
  }
235
235
 
236
- function applyChange(to, base, from, change) {
236
+ function applyChange(base, parent, head, change) {
237
237
  if (change.op === 'remove') {
238
- (0, _unset.default)(to, change.path);
238
+ (0, _unset.default)(base, change.path);
239
239
  } else if (change.op === 'add') {
240
- (0, _set.default)(to, change.path, change.value);
240
+ (0, _set.default)(base, change.path, change.value);
241
241
  } else if (change.op === 'update') {
242
242
  if (change.section === 'shapes') {
243
- const mergedShape = attemptToMerge(to, base, from, change);
243
+ const mergedShape = attemptToMerge(base, parent, head, change);
244
244
 
245
245
  if (mergedShape) {
246
- (0, _set.default)(to, change.path, mergedShape);
246
+ (0, _set.default)(base, change.path, mergedShape);
247
247
  return;
248
248
  }
249
249
  } else if (change.section === 'forms') {
250
- var _to$forms, _to$forms$shapeName, _from$forms, _from$forms$shapeName;
250
+ var _base$forms, _base$forms$shapeName, _head$forms, _head$forms$shapeName;
251
251
 
252
252
  const shapeName = change.path[1];
253
- const toForm = (_to$forms = to.forms) === null || _to$forms === void 0 ? void 0 : (_to$forms$shapeName = _to$forms[shapeName]) === null || _to$forms$shapeName === void 0 ? void 0 : _to$forms$shapeName.default;
254
- const fromForm = (_from$forms = from.forms) === null || _from$forms === void 0 ? void 0 : (_from$forms$shapeName = _from$forms[shapeName]) === null || _from$forms$shapeName === void 0 ? void 0 : _from$forms$shapeName.default;
253
+ const toForm = (_base$forms = base.forms) === null || _base$forms === void 0 ? void 0 : (_base$forms$shapeName = _base$forms[shapeName]) === null || _base$forms$shapeName === void 0 ? void 0 : _base$forms$shapeName.default;
254
+ const fromForm = (_head$forms = head.forms) === null || _head$forms === void 0 ? void 0 : (_head$forms$shapeName = _head$forms[shapeName]) === null || _head$forms$shapeName === void 0 ? void 0 : _head$forms$shapeName.default;
255
255
 
256
256
  if (toForm && fromForm) {
257
- var _base$forms, _base$forms$shapeName;
257
+ var _parent$forms, _parent$forms$shapeNa;
258
258
 
259
- const baseForm = (_base$forms = base.forms) === null || _base$forms === void 0 ? void 0 : (_base$forms$shapeName = _base$forms[shapeName]) === null || _base$forms$shapeName === void 0 ? void 0 : _base$forms$shapeName.default;
260
- (0, _set.default)(to, change.path, {
259
+ const baseForm = (_parent$forms = parent.forms) === null || _parent$forms === void 0 ? void 0 : (_parent$forms$shapeNa = _parent$forms[shapeName]) === null || _parent$forms$shapeNa === void 0 ? void 0 : _parent$forms$shapeNa.default;
260
+ (0, _set.default)(base, change.path, {
261
261
  default: baseForm ? rebaseFormProperties(toForm, baseForm, fromForm) : mergeFormConfigs(toForm, fromForm)
262
262
  });
263
263
  return;
264
264
  }
265
265
  }
266
266
 
267
- (0, _set.default)(to, change.path, change.value);
267
+ (0, _set.default)(base, change.path, change.value);
268
268
  }
269
269
  }
270
270
 
271
- function mergeProjectSchemas(to, base, from) {
272
- const changesTo = compareSections(base, to);
273
- const changesFrom = compareSections(base, from);
274
- const mergedSchema = (0, _util.deepClone)(to);
271
+ function mergeProjectSchemas(base, parent, head) {
272
+ const changesTo = compareSections(parent, base);
273
+ const changesFrom = compareSections(parent, head);
274
+ const mergedSchema = (0, _util.deepClone)(base);
275
275
 
276
276
  for (let change of changesFrom) {
277
277
  const potentialConflict = changesTo.find(changeTo => (0, _isEqual.default)(changeTo.path, change.path));
@@ -286,7 +286,7 @@ function mergeProjectSchemas(to, base, from) {
286
286
 
287
287
  if (potentialConflict.op === 'add' && change.op === 'add' || potentialConflict.op === 'update' && change.op === 'update') {
288
288
  if (change.section === 'shapes') {
289
- const mergedValue = attemptToMerge(to, base, from, change); // eslint-disable-next-line max-depth
289
+ const mergedValue = attemptToMerge(base, parent, head, change); // eslint-disable-next-line max-depth
290
290
 
291
291
  if (!mergedValue) {
292
292
  return {
@@ -307,7 +307,7 @@ function mergeProjectSchemas(to, base, from) {
307
307
  }
308
308
  }
309
309
 
310
- applyChange(mergedSchema, base, from, change);
310
+ applyChange(mergedSchema, parent, head, change);
311
311
  }
312
312
 
313
313
  return {
package/es/util/merge.js CHANGED
@@ -14,13 +14,13 @@ export function mergeObjectSchemas(...args) {
14
14
  properties: {}
15
15
  });
16
16
  }
17
- export function mergeSchemaProperties(base, overrides) {
18
- const result = { ...base,
19
- properties: { ...base.properties,
17
+ export function mergeSchemaProperties(parent, overrides) {
18
+ const result = { ...parent,
19
+ properties: { ...parent.properties,
20
20
  ...overrides.properties
21
21
  }
22
22
  };
23
- const required = union(base.required, overrides.required);
23
+ const required = union(parent.required, overrides.required);
24
24
 
25
25
  if (required.length) {
26
26
  result.required = required;
@@ -28,22 +28,22 @@ export function mergeSchemaProperties(base, overrides) {
28
28
 
29
29
  return result;
30
30
  }
31
- export function rebaseSchemaProperties(to, base, from) {
31
+ export function rebaseSchemaProperties(base, parent, head) {
32
32
  const {
33
33
  properties: toProperties,
34
34
  required: toRequired,
35
35
  ...toOther
36
- } = to;
36
+ } = base;
37
37
  const {
38
38
  properties: baseProperties,
39
39
  required: baseRequired,
40
40
  ...baseOther
41
- } = base;
41
+ } = parent;
42
42
  const {
43
43
  properties: fromProperties,
44
44
  required: fromRequired,
45
45
  ...fromOther
46
- } = from;
46
+ } = head;
47
47
  const newSchema = { ...rebaseObject(toOther, baseOther, fromOther),
48
48
  type: 'object',
49
49
  properties: rebaseObject(toProperties, baseProperties, fromProperties)
@@ -56,13 +56,13 @@ export function rebaseSchemaProperties(to, base, from) {
56
56
 
57
57
  return newSchema;
58
58
  }
59
- export function mergeFormProperties(base, overrides) {
60
- const result = { ...base,
61
- properties: { ...base.properties,
59
+ export function mergeFormProperties(parent, overrides) {
60
+ const result = { ...parent,
61
+ properties: { ...parent.properties,
62
62
  ...overrides.properties
63
63
  }
64
64
  };
65
- const order = union(base.order, overrides.order);
65
+ const order = union(parent.order, overrides.order);
66
66
 
67
67
  if (order.length) {
68
68
  result.order = order;
@@ -70,22 +70,22 @@ export function mergeFormProperties(base, overrides) {
70
70
 
71
71
  return result;
72
72
  }
73
- export function rebaseFormProperties(to, base, from) {
73
+ export function rebaseFormProperties(base, parent, head) {
74
74
  const {
75
75
  properties: toProperties,
76
76
  order: toOrder,
77
77
  ...toOther
78
- } = to;
78
+ } = base;
79
79
  const {
80
80
  properties: baseProperties,
81
81
  order: baseOrder,
82
82
  ...baseOther
83
- } = base;
83
+ } = parent;
84
84
  const {
85
85
  properties: fromProperties,
86
86
  order: fromOrder,
87
87
  ...fromOther
88
- } = from;
88
+ } = head;
89
89
  const newForm = { ...rebaseObject(toOther, baseOther, fromOther),
90
90
  properties: rebaseObject(toProperties, baseProperties, fromProperties)
91
91
  };
@@ -139,8 +139,8 @@ function compareSection(section, original, updated) {
139
139
  return changes;
140
140
  }
141
141
 
142
- function compareSections(base, branch) {
143
- return mergeableSections.flatMap(section => base[section] || branch[section] ? compareSection(section, base[section] ?? {}, branch[section] ?? {}) : []);
142
+ function compareSections(parent, branch) {
143
+ return mergeableSections.flatMap(section => parent[section] || branch[section] ? compareSection(section, parent[section] ?? {}, branch[section] ?? {}) : []);
144
144
  }
145
145
 
146
146
  function findChangedShape(schema, change) {
@@ -154,14 +154,14 @@ function getChangedShape(schema, change) {
154
154
  } // eslint-disable-next-line complexity
155
155
 
156
156
 
157
- function attemptToMerge(to, base, from, change) {
158
- const toShape = getChangedShape(to, change);
159
- const fromShape = getChangedShape(from, change);
157
+ function attemptToMerge(base, parent, head, change) {
158
+ const toShape = getChangedShape(base, change);
159
+ const fromShape = getChangedShape(head, change);
160
160
  const toSchema = toShape.schema;
161
161
  const fromSchema = fromShape.schema;
162
162
 
163
163
  if (isObjectSchema(toSchema) && isObjectSchema(fromSchema)) {
164
- const baseShape = findChangedShape(base, change);
164
+ const baseShape = findChangedShape(parent, change);
165
165
  const baseSchema = baseShape === null || baseShape === void 0 ? void 0 : baseShape.schema;
166
166
  return { ...(baseShape ? rebaseObject(omit(toShape, 'schema'), omit(baseShape, 'schema'), omit(fromShape, 'schema')) : { ...toShape,
167
167
  ...fromShape
@@ -179,7 +179,7 @@ function attemptToMerge(to, base, from, change) {
179
179
  var _findChangedShape;
180
180
 
181
181
  let mergedObjSchema;
182
- const baseSchema = (_findChangedShape = findChangedShape(base, change)) === null || _findChangedShape === void 0 ? void 0 : _findChangedShape.schema;
182
+ const baseSchema = (_findChangedShape = findChangedShape(parent, change)) === null || _findChangedShape === void 0 ? void 0 : _findChangedShape.schema;
183
183
 
184
184
  if (change.op === 'update' && baseSchema && isExtendsSchema(baseSchema)) {
185
185
  const baseObj = last(baseSchema.extends);
@@ -202,45 +202,45 @@ function attemptToMerge(to, base, from, change) {
202
202
  }
203
203
  }
204
204
 
205
- function applyChange(to, base, from, change) {
205
+ function applyChange(base, parent, head, change) {
206
206
  if (change.op === 'remove') {
207
- unset(to, change.path);
207
+ unset(base, change.path);
208
208
  } else if (change.op === 'add') {
209
- set(to, change.path, change.value);
209
+ set(base, change.path, change.value);
210
210
  } else if (change.op === 'update') {
211
211
  if (change.section === 'shapes') {
212
- const mergedShape = attemptToMerge(to, base, from, change);
212
+ const mergedShape = attemptToMerge(base, parent, head, change);
213
213
 
214
214
  if (mergedShape) {
215
- set(to, change.path, mergedShape);
215
+ set(base, change.path, mergedShape);
216
216
  return;
217
217
  }
218
218
  } else if (change.section === 'forms') {
219
- var _to$forms, _to$forms$shapeName, _from$forms, _from$forms$shapeName;
219
+ var _base$forms, _base$forms$shapeName, _head$forms, _head$forms$shapeName;
220
220
 
221
221
  const shapeName = change.path[1];
222
- const toForm = (_to$forms = to.forms) === null || _to$forms === void 0 ? void 0 : (_to$forms$shapeName = _to$forms[shapeName]) === null || _to$forms$shapeName === void 0 ? void 0 : _to$forms$shapeName.default;
223
- const fromForm = (_from$forms = from.forms) === null || _from$forms === void 0 ? void 0 : (_from$forms$shapeName = _from$forms[shapeName]) === null || _from$forms$shapeName === void 0 ? void 0 : _from$forms$shapeName.default;
222
+ const toForm = (_base$forms = base.forms) === null || _base$forms === void 0 ? void 0 : (_base$forms$shapeName = _base$forms[shapeName]) === null || _base$forms$shapeName === void 0 ? void 0 : _base$forms$shapeName.default;
223
+ const fromForm = (_head$forms = head.forms) === null || _head$forms === void 0 ? void 0 : (_head$forms$shapeName = _head$forms[shapeName]) === null || _head$forms$shapeName === void 0 ? void 0 : _head$forms$shapeName.default;
224
224
 
225
225
  if (toForm && fromForm) {
226
- var _base$forms, _base$forms$shapeName;
226
+ var _parent$forms, _parent$forms$shapeNa;
227
227
 
228
- const baseForm = (_base$forms = base.forms) === null || _base$forms === void 0 ? void 0 : (_base$forms$shapeName = _base$forms[shapeName]) === null || _base$forms$shapeName === void 0 ? void 0 : _base$forms$shapeName.default;
229
- set(to, change.path, {
228
+ const baseForm = (_parent$forms = parent.forms) === null || _parent$forms === void 0 ? void 0 : (_parent$forms$shapeNa = _parent$forms[shapeName]) === null || _parent$forms$shapeNa === void 0 ? void 0 : _parent$forms$shapeNa.default;
229
+ set(base, change.path, {
230
230
  default: baseForm ? rebaseFormProperties(toForm, baseForm, fromForm) : mergeFormConfigs(toForm, fromForm)
231
231
  });
232
232
  return;
233
233
  }
234
234
  }
235
235
 
236
- set(to, change.path, change.value);
236
+ set(base, change.path, change.value);
237
237
  }
238
238
  }
239
239
 
240
- export function mergeProjectSchemas(to, base, from) {
241
- const changesTo = compareSections(base, to);
242
- const changesFrom = compareSections(base, from);
243
- const mergedSchema = deepClone(to);
240
+ export function mergeProjectSchemas(base, parent, head) {
241
+ const changesTo = compareSections(parent, base);
242
+ const changesFrom = compareSections(parent, head);
243
+ const mergedSchema = deepClone(base);
244
244
 
245
245
  for (let change of changesFrom) {
246
246
  const potentialConflict = changesTo.find(changeTo => isEqual(changeTo.path, change.path));
@@ -255,7 +255,7 @@ export function mergeProjectSchemas(to, base, from) {
255
255
 
256
256
  if (potentialConflict.op === 'add' && change.op === 'add' || potentialConflict.op === 'update' && change.op === 'update') {
257
257
  if (change.section === 'shapes') {
258
- const mergedValue = attemptToMerge(to, base, from, change); // eslint-disable-next-line max-depth
258
+ const mergedValue = attemptToMerge(base, parent, head, change); // eslint-disable-next-line max-depth
259
259
 
260
260
  if (!mergedValue) {
261
261
  return {
@@ -276,7 +276,7 @@ export function mergeProjectSchemas(to, base, from) {
276
276
  }
277
277
  }
278
278
 
279
- applyChange(mergedSchema, base, from, change);
279
+ applyChange(mergedSchema, parent, head, change);
280
280
  }
281
281
 
282
282
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/schema",
3
- "version": "8.265.1",
3
+ "version": "8.268.0",
4
4
  "description": "TakeShape Schema",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {
@@ -30,9 +30,9 @@
30
30
  "p-reduce": "^2.1.0",
31
31
  "semver": "^7.3.2",
32
32
  "tiny-invariant": "^1.2.0",
33
- "@takeshape/errors": "8.265.1",
34
- "@takeshape/util": "8.265.1",
35
- "@takeshape/json-schema": "8.265.1"
33
+ "@takeshape/errors": "8.268.0",
34
+ "@takeshape/json-schema": "8.268.0",
35
+ "@takeshape/util": "8.268.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@takeshape/json-schema-to-typescript": "^11.0.0",