@takeshape/schema 8.282.0 → 8.282.4

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 +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,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"}
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;AAajF,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;AA6JD,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,CAwC5F"}
@@ -31,6 +31,8 @@ var _types = require("../types");
31
31
 
32
32
  var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
33
33
 
34
+ var _pickBy = _interopRequireDefault(require("lodash/pickBy"));
35
+
34
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
37
 
36
38
  function mergeObjectSchemas(...args) {
@@ -134,7 +136,15 @@ function mergeFormConfigs(...configs) {
134
136
  });
135
137
  }
136
138
 
137
- const mergeableSections = ['shapes', 'mutations', 'queries', 'forms', 'services'];
139
+ const mergeableSections = ['shapes', 'mutations', 'queries', 'forms', 'services', 'indexedShapes'];
140
+
141
+ const isMergeableSection = str => {
142
+ return mergeableSections.includes(str);
143
+ };
144
+
145
+ const pickUnmergeable = projectSchema => {
146
+ return (0, _pickBy.default)(projectSchema, (_value, key) => !isMergeableSection(key));
147
+ };
138
148
 
139
149
  function compareSection(section, original, updated) {
140
150
  const changes = [];
@@ -310,6 +320,7 @@ function mergeProjectSchemas(base, parent, head) {
310
320
  applyChange(mergedSchema, parent, head, change);
311
321
  }
312
322
 
323
+ Object.assign(mergedSchema, (0, _util.rebaseObject)(pickUnmergeable(base), pickUnmergeable(parent), pickUnmergeable(head)));
313
324
  return {
314
325
  error: undefined,
315
326
  mergedSchema
package/es/util/merge.js CHANGED
@@ -8,6 +8,7 @@ import last from 'lodash/last';
8
8
  import omit from 'lodash/omit';
9
9
  import { isExtendsSchema, isObjectSchema } from '../types';
10
10
  import invariant from 'tiny-invariant';
11
+ import pickBy from 'lodash/pickBy';
11
12
  export function mergeObjectSchemas(...args) {
12
13
  return args.filter(isDefined).reduce(mergeSchemaProperties, {
13
14
  type: 'object',
@@ -103,7 +104,15 @@ export function mergeFormConfigs(...configs) {
103
104
  order: []
104
105
  });
105
106
  }
106
- const mergeableSections = ['shapes', 'mutations', 'queries', 'forms', 'services'];
107
+ const mergeableSections = ['shapes', 'mutations', 'queries', 'forms', 'services', 'indexedShapes'];
108
+
109
+ const isMergeableSection = str => {
110
+ return mergeableSections.includes(str);
111
+ };
112
+
113
+ const pickUnmergeable = projectSchema => {
114
+ return pickBy(projectSchema, (_value, key) => !isMergeableSection(key));
115
+ };
107
116
 
108
117
  function compareSection(section, original, updated) {
109
118
  const changes = [];
@@ -279,6 +288,7 @@ export function mergeProjectSchemas(base, parent, head) {
279
288
  applyChange(mergedSchema, parent, head, change);
280
289
  }
281
290
 
291
+ Object.assign(mergedSchema, rebaseObject(pickUnmergeable(base), pickUnmergeable(parent), pickUnmergeable(head)));
282
292
  return {
283
293
  error: undefined,
284
294
  mergedSchema
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/schema",
3
- "version": "8.282.0",
3
+ "version": "8.282.4",
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.282.0",
34
- "@takeshape/util": "8.282.0",
35
- "@takeshape/json-schema": "8.282.0"
33
+ "@takeshape/json-schema": "8.282.4",
34
+ "@takeshape/errors": "8.282.4",
35
+ "@takeshape/util": "8.282.4"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@takeshape/json-schema-to-typescript": "^11.0.0",