@takeshape/schema 8.66.1 → 8.68.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/es/content-schema-transform.js +2 -2
- package/es/index.js +2 -1
- package/es/migration/index.js +13 -2
- package/es/migration/to/v3.14.0.js +10 -0
- package/es/migration/to/v3.15.0.js +10 -0
- package/es/project-schema/index.js +2 -0
- package/es/project-schema/v3.13.1.js +1 -0
- package/es/project-schema/v3.14.0.js +1 -0
- package/es/project-schema/v3.15.0.js +1 -0
- package/es/refs.js +78 -1
- package/es/rewrite.js +58 -0
- package/es/schema-util.js +32 -118
- package/es/schemas/index.js +5 -3
- package/es/schemas/index.ts +6 -2
- package/es/schemas/project-schema/v3.14.0.json +2379 -0
- package/es/schemas/project-schema/v3.15.0.json +2359 -0
- package/es/schemas/project-schema.json +2 -1
- package/es/template-shapes/templates.js +56 -52
- package/es/template-shapes/types.js +8 -1
- package/es/types/utils.js +5 -0
- package/es/util/detect-cycles.js +2 -2
- package/es/util/index.js +2 -1
- package/es/util/merge.js +36 -0
- package/es/validate.js +2 -10
- package/examples/latest/betzino.json +1 -1
- package/examples/latest/blog-schema.json +1 -1
- package/examples/latest/brewery-schema.json +1 -1
- package/examples/latest/complex-project-schema.json +1 -1
- package/examples/latest/fabric-ecommerce.json +1 -1
- package/examples/latest/frank-and-fred-schema.json +1 -1
- package/examples/latest/massive-schema.json +1 -1
- package/examples/latest/mill-components-schema.json +1 -1
- package/examples/latest/pet-oneof-array.json +1 -1
- package/examples/latest/post-schema.json +1 -1
- package/examples/latest/pruned-shopify-product-schema.json +1 -1
- package/examples/latest/real-world-schema.json +1 -1
- package/examples/latest/recursive-repeater-schema.json +1 -1
- package/examples/latest/recursive-schema.json +1 -1
- package/examples/latest/rick-and-morty-ast.json +1 -1
- package/examples/latest/rick-and-morty-graphql.json +1 -1
- package/examples/latest/rick-and-morty-rest.json +1 -1
- package/examples/latest/schema-with-repeater-draftjs.json +1 -1
- package/examples/latest/shape-books-v3_2_0.json +1 -1
- package/examples/latest/shape-books.json +1 -1
- package/examples/latest/shopify-lookbook.json +1 -1
- package/examples/latest/shopify-store-with-widget.json +1 -1
- package/examples/latest/stripe-starter-resolved.json +1 -1
- package/examples/latest/user-schema-no-required.json +1 -1
- package/examples/latest/user-schema-with-defaults.json +1 -1
- package/lib/content-schema-transform.js +6 -6
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +14 -0
- package/lib/migration/index.d.ts.map +1 -1
- package/lib/migration/index.js +14 -1
- package/lib/migration/to/v3.14.0.d.ts +4 -0
- package/lib/migration/to/v3.14.0.d.ts.map +1 -0
- package/lib/migration/to/v3.14.0.js +18 -0
- package/lib/migration/to/v3.15.0.d.ts +4 -0
- package/lib/migration/to/v3.15.0.d.ts.map +1 -0
- package/lib/migration/to/v3.15.0.js +18 -0
- package/lib/project-schema/index.d.ts +5 -1
- package/lib/project-schema/index.d.ts.map +1 -1
- package/lib/project-schema/index.js +45 -19
- package/lib/project-schema/latest.d.ts +164 -23
- package/lib/project-schema/latest.d.ts.map +1 -1
- package/lib/project-schema/v3.13.1.d.ts +1413 -0
- package/lib/project-schema/v3.13.1.d.ts.map +1 -0
- package/lib/project-schema/v3.13.1.js +5 -0
- package/lib/project-schema/v3.14.0.d.ts +1437 -0
- package/lib/project-schema/v3.14.0.d.ts.map +1 -0
- package/lib/project-schema/v3.14.0.js +5 -0
- package/lib/project-schema/v3.15.0.d.ts +1459 -0
- package/lib/project-schema/v3.15.0.d.ts.map +1 -0
- package/lib/project-schema/v3.15.0.js +5 -0
- package/lib/refs.d.ts +11 -2
- package/lib/refs.d.ts.map +1 -1
- package/lib/refs.js +83 -0
- package/lib/rewrite.d.ts +10 -0
- package/lib/rewrite.d.ts.map +1 -0
- package/lib/rewrite.js +69 -0
- package/lib/schema-util.d.ts +3 -15
- package/lib/schema-util.d.ts.map +1 -1
- package/lib/schema-util.js +36 -135
- package/lib/schemas/index.d.ts +2302 -2
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +25 -21
- package/lib/schemas/index.ts +6 -2
- package/lib/schemas/project-schema/v3.14.0.json +2379 -0
- package/lib/schemas/project-schema/v3.15.0.json +2359 -0
- package/lib/schemas/project-schema.json +2 -1
- package/lib/template-shapes/templates.d.ts +11 -4
- package/lib/template-shapes/templates.d.ts.map +1 -1
- package/lib/template-shapes/templates.js +63 -57
- package/lib/template-shapes/types.d.ts +6 -0
- package/lib/template-shapes/types.d.ts.map +1 -1
- package/lib/template-shapes/types.js +11 -1
- package/lib/types/types.d.ts +2 -2
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/utils.d.ts +4 -1
- package/lib/types/utils.d.ts.map +1 -1
- package/lib/types/utils.js +10 -1
- package/lib/util/detect-cycles.d.ts +1 -1
- package/lib/util/detect-cycles.js +2 -2
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +13 -0
- package/lib/util/merge.d.ts +5 -0
- package/lib/util/merge.d.ts.map +1 -0
- package/lib/util/merge.js +51 -0
- package/lib/validate.d.ts.map +1 -1
- package/lib/validate.js +3 -10
- package/package.json +4 -4
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
{"$ref": "https://schema.takeshape.io/project-schema/v3.12.0#"},
|
|
21
21
|
{"$ref": "https://schema.takeshape.io/project-schema/v3.12.1#"},
|
|
22
22
|
{"$ref": "https://schema.takeshape.io/project-schema/v3.12.2#"},
|
|
23
|
-
{"$ref": "https://schema.takeshape.io/project-schema/v3.13.0#"}
|
|
23
|
+
{"$ref": "https://schema.takeshape.io/project-schema/v3.13.0#"},
|
|
24
|
+
{"$ref": "https://schema.takeshape.io/project-schema/v3.15.0#"}
|
|
24
25
|
]
|
|
25
26
|
}
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
+
import { TemplateVerbs } from './types';
|
|
1
2
|
import { listTypePrefix } from '../migration';
|
|
2
|
-
import {
|
|
3
|
+
import { pascalCase } from '@takeshape/util';
|
|
3
4
|
import keyBy from 'lodash/keyBy';
|
|
4
|
-
import { createShape, getShapeDependencies, isIndexedRemoteShape
|
|
5
|
+
import { createShape, getShapeDependencies, isIndexedRemoteShape } from '../schema-util';
|
|
5
6
|
import { getFlattenedTemplateShapeName, getRefShapeName } from '../refs';
|
|
6
7
|
import { getWhereSearchArg } from './where';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const DELETE = 'delete';
|
|
10
|
-
const DUPLICATE = 'duplicate';
|
|
8
|
+
import { mergeObjectSchemas, mergeSchemaProperties } from '../util';
|
|
9
|
+
import { rewriteSchema } from '../rewrite';
|
|
11
10
|
export const TSGetArgs = getIDQueryArgs('TSGetArgs');
|
|
12
11
|
export const TSGetSingletonArgs = getIDQueryArgs('TSGetSingletonArgs');
|
|
13
12
|
export const TSListArgs = getShapeListQueryArgs('TSListArgs', true);
|
|
14
13
|
export const TSSearchArgs = getShapeListQueryArgs('TSSearchArgs', false);
|
|
15
|
-
export const CreateArgs = getMutationArgs('CreateArgs',
|
|
16
|
-
export const UpdateArgs = getMutationArgs('UpdateArgs',
|
|
17
|
-
export const DuplicateArgs = getMutationArgs('DuplicateArgs',
|
|
18
|
-
export const DeleteArgs = getMutationArgs('DeleteArgs',
|
|
14
|
+
export const CreateArgs = getMutationArgs('CreateArgs', TemplateVerbs.Create);
|
|
15
|
+
export const UpdateArgs = getMutationArgs('UpdateArgs', TemplateVerbs.Update);
|
|
16
|
+
export const DuplicateArgs = getMutationArgs('DuplicateArgs', TemplateVerbs.Duplicate);
|
|
17
|
+
export const DeleteArgs = getMutationArgs('DeleteArgs', TemplateVerbs.Delete);
|
|
19
18
|
export const PaginatedList = getPaginatedListShape;
|
|
20
19
|
export const SearchResults = getSearchResultsShape;
|
|
21
|
-
export const CreateResult = getMutationResultType(
|
|
22
|
-
export const UpdateResult = getMutationResultType(
|
|
23
|
-
export const DuplicateResult = getMutationResultType(
|
|
24
|
-
export const DeleteResult = getMutationResultType(
|
|
20
|
+
export const CreateResult = getMutationResultType(TemplateVerbs.Create);
|
|
21
|
+
export const UpdateResult = getMutationResultType(TemplateVerbs.Update);
|
|
22
|
+
export const DuplicateResult = getMutationResultType(TemplateVerbs.Duplicate);
|
|
23
|
+
export const DeleteResult = getMutationResultType(TemplateVerbs.Delete);
|
|
25
24
|
export const TSSearchSortInput = createShape('TSSearchSortInput', {
|
|
26
25
|
type: 'object',
|
|
27
26
|
properties: {
|
|
@@ -166,25 +165,6 @@ const idSchema = {
|
|
|
166
165
|
},
|
|
167
166
|
required: ['_id']
|
|
168
167
|
};
|
|
169
|
-
export function rewriteSchema(shapeSchema) {
|
|
170
|
-
return JSON.parse(JSON.stringify(shapeSchema), (key, value) => {
|
|
171
|
-
if (typeof value === 'object') {
|
|
172
|
-
var _value$required;
|
|
173
|
-
|
|
174
|
-
// Remove required
|
|
175
|
-
if ((_value$required = value.required) !== null && _value$required !== void 0 && _value$required.length) {
|
|
176
|
-
delete value.required;
|
|
177
|
-
} // Remove default
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (value.type !== undefined && value.default !== undefined) {
|
|
181
|
-
delete value.default;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return value;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
168
|
export function getIDQueryArgs(templateName) {
|
|
189
169
|
return (context, shape) => {
|
|
190
170
|
var _shape$model;
|
|
@@ -199,25 +179,48 @@ export function getIDQueryArgs(templateName) {
|
|
|
199
179
|
};
|
|
200
180
|
};
|
|
201
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Construct a shape name used for a mutation input shape.
|
|
184
|
+
*/
|
|
202
185
|
|
|
203
|
-
function
|
|
204
|
-
return
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
186
|
+
export function getMutationInputShapeName(verb) {
|
|
187
|
+
return shapeName => {
|
|
188
|
+
return pascalCase([verb, shapeName, 'input']);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Create a shape name variant for an input. Updates will typically want a partial input.
|
|
194
|
+
*/
|
|
195
|
+
function getInputShapeName(shapeName, {
|
|
196
|
+
isPartial
|
|
197
|
+
}) {
|
|
198
|
+
return isPartial ? `${shapeName}PartialInput` : `${shapeName}Input`;
|
|
208
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Construct shapes for a mutation inputs, given source shape info.
|
|
202
|
+
*/
|
|
203
|
+
|
|
209
204
|
|
|
210
205
|
export function getMutationArgs(templateName, verb) {
|
|
206
|
+
const getShapeName = getMutationInputShapeName(verb);
|
|
207
|
+
const addLocale = verb === TemplateVerbs.Update || verb === TemplateVerbs.Duplicate;
|
|
208
|
+
const addStructure = verb === TemplateVerbs.Update;
|
|
209
|
+
const isUpdate = verb === TemplateVerbs.Update || verb === TemplateVerbs.Duplicate;
|
|
211
210
|
return ({
|
|
212
211
|
projectSchema
|
|
213
212
|
}, shape) => {
|
|
214
|
-
const
|
|
215
|
-
const addStructure = verb === UPDATE;
|
|
216
|
-
const inputName = pascalCase([verb, shape.name, 'input']);
|
|
213
|
+
const inputName = getShapeName(shape.name);
|
|
217
214
|
const isSingleton = shape.model && shape.model.type === 'single';
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
|
|
215
|
+
const shouldRequireId = !isSingleton && (verb === TemplateVerbs.Update || verb === TemplateVerbs.Delete || verb === TemplateVerbs.Duplicate);
|
|
216
|
+
const rewrittenSchema = verb !== TemplateVerbs.Delete ? rewriteSchema(shape.schema, isUpdate ? {
|
|
217
|
+
removeDefault: true,
|
|
218
|
+
removeRequired: true,
|
|
219
|
+
replaceInput: true
|
|
220
|
+
} : {
|
|
221
|
+
replaceInput: true
|
|
222
|
+
}) : undefined;
|
|
223
|
+
const inputShape = createShape(inputName, mergeObjectSchemas(shouldRequireId ? idSchema : undefined, rewrittenSchema), {
|
|
221
224
|
description: `${verb} ${shape.name} input`
|
|
222
225
|
});
|
|
223
226
|
const argsShapeName = getFlattenedTemplateShapeName(shape.name, templateName);
|
|
@@ -233,15 +236,12 @@ export function getMutationArgs(templateName, verb) {
|
|
|
233
236
|
},
|
|
234
237
|
required: ['input']
|
|
235
238
|
}, addStructure ? contentStructureFields : undefined, addLocale ? localeProps : undefined));
|
|
236
|
-
|
|
237
|
-
const getInputShapeName = shapeName => isUpdate ? `${shapeName}PartialInput` : `${shapeName}Input`;
|
|
238
|
-
|
|
239
239
|
return {
|
|
240
240
|
shapeName: argsShapeName,
|
|
241
241
|
dependencies: {
|
|
242
242
|
[inputName]: inputShape,
|
|
243
243
|
[argsShapeName]: argsShape,
|
|
244
|
-
...(verb !==
|
|
244
|
+
...(verb !== TemplateVerbs.Delete && keyBy(getShapeDependencies(projectSchema, shape, propSchema => {
|
|
245
245
|
if (!propSchema['@resolver']) {
|
|
246
246
|
return false;
|
|
247
247
|
}
|
|
@@ -249,17 +249,21 @@ export function getMutationArgs(templateName, verb) {
|
|
|
249
249
|
const shapeName = getRefShapeName(projectSchema, propSchema);
|
|
250
250
|
|
|
251
251
|
if (shapeName) {
|
|
252
|
-
return shapeName !== 'TSRelationship' && !projectSchema.shapes[getInputShapeName(shapeName
|
|
252
|
+
return shapeName !== 'TSRelationship' && !projectSchema.shapes[getInputShapeName(shapeName, {
|
|
253
|
+
isPartial: isUpdate
|
|
254
|
+
})];
|
|
253
255
|
}
|
|
254
256
|
|
|
255
257
|
return true;
|
|
256
258
|
}).map(shapeName => {
|
|
257
259
|
const shape = projectSchema.shapes[shapeName];
|
|
258
|
-
const name = getInputShapeName(shapeName
|
|
260
|
+
const name = getInputShapeName(shapeName, {
|
|
261
|
+
isPartial: isUpdate
|
|
262
|
+
});
|
|
259
263
|
return { ...shape,
|
|
260
264
|
name,
|
|
261
265
|
id: name,
|
|
262
|
-
schema:
|
|
266
|
+
schema: rewrittenSchema
|
|
263
267
|
};
|
|
264
268
|
}), 'name')),
|
|
265
269
|
...(addStructure ? {
|
|
@@ -272,7 +276,7 @@ export function getMutationArgs(templateName, verb) {
|
|
|
272
276
|
export function getMutationResultType(verb) {
|
|
273
277
|
return (context, shape) => {
|
|
274
278
|
const shapeName = pascalCase([verb, shape.name, 'result']);
|
|
275
|
-
const result = verb ===
|
|
279
|
+
const result = verb === TemplateVerbs.Delete ? {
|
|
276
280
|
type: 'boolean'
|
|
277
281
|
} : {
|
|
278
282
|
'@ref': `local:${shape.name}`
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export let TemplateVerbs;
|
|
2
|
+
|
|
3
|
+
(function (TemplateVerbs) {
|
|
4
|
+
TemplateVerbs["Create"] = "create";
|
|
5
|
+
TemplateVerbs["Update"] = "update";
|
|
6
|
+
TemplateVerbs["Duplicate"] = "duplicate";
|
|
7
|
+
TemplateVerbs["Delete"] = "delete";
|
|
8
|
+
})(TemplateVerbs || (TemplateVerbs = {}));
|
package/es/types/utils.js
CHANGED
|
@@ -75,6 +75,8 @@ export const isProjectSchemaV3_12_1 = createVersionPredicate('3.12.1');
|
|
|
75
75
|
export const isProjectSchemaV3_12_2 = createVersionPredicate('3.12.2');
|
|
76
76
|
export const isProjectSchemaV3_12_3 = createVersionPredicate('3.12.3');
|
|
77
77
|
export const isProjectSchemaV3_13_0 = createVersionPredicate('3.13.0');
|
|
78
|
+
export const isProjectSchemaV3_14_0 = createVersionPredicate('3.14.0');
|
|
79
|
+
export const isProjectSchemaV3_15_0 = createVersionPredicate('3.15.0');
|
|
78
80
|
export const isLatestProjectSchema = createVersionPredicate(CURRENT_SCHEMA_VERSION);
|
|
79
81
|
export function isV1XSchema(maybeSchema) {
|
|
80
82
|
return isObject(maybeSchema) && isString(maybeSchema.projectId) && isObject(maybeSchema.contentTypes) && (isUndefined(maybeSchema.schemaVersion) || maybeSchema.schemaVersion === '1' || maybeSchema.schemaVersion === '1.0.0');
|
|
@@ -209,6 +211,9 @@ export function isRefSchemaLegacy(propertySchema) {
|
|
|
209
211
|
export function isAllOfSchema(propertySchema) {
|
|
210
212
|
return isArray(propertySchema.allOf);
|
|
211
213
|
}
|
|
214
|
+
export function isExtendsSchema(propertySchema) {
|
|
215
|
+
return isArray(propertySchema.extends);
|
|
216
|
+
}
|
|
212
217
|
export function isOneOfSchema(propertySchema) {
|
|
213
218
|
return isArray(propertySchema.oneOf);
|
|
214
219
|
}
|
package/es/util/detect-cycles.js
CHANGED
|
@@ -6,7 +6,7 @@ function immutableSetAdd(set, str) {
|
|
|
6
6
|
return result;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Use a basic depth-first search to
|
|
9
|
+
* Use a basic depth-first search to determine whether a schema contains a cycle
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
|
|
@@ -27,7 +27,7 @@ export function hasCycle(projectSchema, schema, shapesSeen = new Set()) {
|
|
|
27
27
|
return hasCycle(projectSchema, refShape.schema, immutableSetAdd(shapesSeen, refShape.name));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const combo = schema.oneOf ?? schema.allOf;
|
|
30
|
+
const combo = schema.oneOf ?? schema.allOf ?? schema.extends;
|
|
31
31
|
|
|
32
32
|
if (combo) {
|
|
33
33
|
return combo.some(childSchema => hasCycle(projectSchema, childSchema, shapesSeen));
|
package/es/util/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from './detect-cycles';
|
|
1
|
+
export * from './detect-cycles';
|
|
2
|
+
export * from './merge';
|
package/es/util/merge.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isDefined } from '@takeshape/util';
|
|
2
|
+
import union from 'lodash/union';
|
|
3
|
+
export function mergeObjectSchemas(...args) {
|
|
4
|
+
return args.filter(isDefined).reduce(mergeSchemaProperties, {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {}
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export function mergeSchemaProperties(base, overrides) {
|
|
10
|
+
const result = { ...base,
|
|
11
|
+
properties: { ...base.properties,
|
|
12
|
+
...overrides.properties
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const required = union(base.required, overrides.required);
|
|
16
|
+
|
|
17
|
+
if (required.length) {
|
|
18
|
+
result.required = required;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
export function mergeFormProperties(base, overrides) {
|
|
24
|
+
const result = { ...base,
|
|
25
|
+
properties: { ...base.properties,
|
|
26
|
+
...overrides.properties
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const order = union(base.order, overrides.order);
|
|
30
|
+
|
|
31
|
+
if (order.length) {
|
|
32
|
+
result.order = order;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return result;
|
|
36
|
+
}
|
package/es/validate.js
CHANGED
|
@@ -19,6 +19,7 @@ import { scalars } from './scalars';
|
|
|
19
19
|
import { enumerateOneOfKeys, isUnionSchema } from './unions';
|
|
20
20
|
import { isEnumLikeSchema } from './enum';
|
|
21
21
|
import metaSchemaV3_9_0 from './schemas/project-schema/meta-schema-v3.9.0.json';
|
|
22
|
+
import { isIntegerLike } from '@takeshape/util';
|
|
22
23
|
|
|
23
24
|
function findDuplicates(items) {
|
|
24
25
|
const seen = {};
|
|
@@ -343,22 +344,13 @@ function getModelShapeIds(shapes) {
|
|
|
343
344
|
}
|
|
344
345
|
|
|
345
346
|
const builtInModelShapeIds = getModelShapeIds(builtInShapes);
|
|
346
|
-
|
|
347
|
-
function isNumberLike(value) {
|
|
348
|
-
if (typeof value === 'number') {
|
|
349
|
-
return true;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
return /^\d+$/.test(value);
|
|
353
|
-
}
|
|
354
347
|
/**
|
|
355
348
|
* Verify the path has an allOf schema and not just prop named "allOf"
|
|
356
349
|
*/
|
|
357
350
|
|
|
358
|
-
|
|
359
351
|
function isAllOfPath(path) {
|
|
360
352
|
const index = path.indexOf('allOf');
|
|
361
|
-
return index !== -1 &&
|
|
353
|
+
return index !== -1 && isIntegerLike(path[index + 1]);
|
|
362
354
|
}
|
|
363
355
|
|
|
364
356
|
function validateRefs(projectSchema, additionalShapeNames = builtInShapeNames) {
|
|
@@ -45168,6 +45168,6 @@
|
|
|
45168
45168
|
}
|
|
45169
45169
|
}
|
|
45170
45170
|
},
|
|
45171
|
-
"schemaVersion": "3.
|
|
45171
|
+
"schemaVersion": "3.15.0",
|
|
45172
45172
|
"services": {}
|
|
45173
45173
|
}
|
|
@@ -10516,5 +10516,5 @@
|
|
|
10516
10516
|
}
|
|
10517
10517
|
}
|
|
10518
10518
|
},
|
|
10519
|
-
"schemaVersion": "3.
|
|
10519
|
+
"schemaVersion": "3.15.0"
|
|
10520
10520
|
}
|
|
@@ -20505,6 +20505,6 @@
|
|
|
20505
20505
|
}
|
|
20506
20506
|
}
|
|
20507
20507
|
},
|
|
20508
|
-
"schemaVersion": "3.
|
|
20508
|
+
"schemaVersion": "3.15.0",
|
|
20509
20509
|
"services": {}
|
|
20510
20510
|
}
|
|
@@ -12534,5 +12534,5 @@
|
|
|
12534
12534
|
}
|
|
12535
12535
|
}
|
|
12536
12536
|
},
|
|
12537
|
-
"schemaVersion": "3.
|
|
12537
|
+
"schemaVersion": "3.15.0"
|
|
12538
12538
|
}
|
|
@@ -29315,5 +29315,5 @@
|
|
|
29315
29315
|
}
|
|
29316
29316
|
}
|
|
29317
29317
|
},
|
|
29318
|
-
"schemaVersion": "3.
|
|
29318
|
+
"schemaVersion": "3.15.0"
|
|
29319
29319
|
}
|
|
@@ -90,7 +90,7 @@ function getContentTransform({
|
|
|
90
90
|
}) {
|
|
91
91
|
const prepare = (schema, obj, name = '') => {
|
|
92
92
|
const shapeName = (0, _refs.getRefShapeName)(projectSchema, schema);
|
|
93
|
-
schema = (0,
|
|
93
|
+
schema = (0, _refs.dereferenceSchema)(projectSchema, schema);
|
|
94
94
|
|
|
95
95
|
if (accumulators) {
|
|
96
96
|
accumulators.forEach(accumulator => {
|
|
@@ -129,7 +129,7 @@ function getContentTransform({
|
|
|
129
129
|
|
|
130
130
|
if (value !== undefined) {
|
|
131
131
|
assigned.add(sourceKey);
|
|
132
|
-
const transform = findTransforms(transforms, (0,
|
|
132
|
+
const transform = findTransforms(transforms, (0, _refs.dereferenceSchema)(projectSchema, fieldSchema), name);
|
|
133
133
|
const getKey = transform !== null && transform !== void 0 && transform.keyTransform ? transform.keyTransform : keyTransform;
|
|
134
134
|
result[getKey(name, fieldSchema, sourceKey)] = value;
|
|
135
135
|
}
|
|
@@ -192,7 +192,7 @@ function getPropertyInfo(context, schema, path) {
|
|
|
192
192
|
return;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
const refSchema = (0,
|
|
195
|
+
const refSchema = (0, _refs.dereferenceSchema)(projectSchema, propSchema);
|
|
196
196
|
const nextPath = path.concat(transformKey(transforms, refSchema, name, keyTransform));
|
|
197
197
|
|
|
198
198
|
if (rest.length) {
|
|
@@ -206,14 +206,14 @@ function getPropertyInfo(context, schema, path) {
|
|
|
206
206
|
}
|
|
207
207
|
} else if ((0, _unions.isUnionSchema)(currentSchema)) {
|
|
208
208
|
for (const optionSchema of currentSchema.oneOf) {
|
|
209
|
-
findProperty((0,
|
|
209
|
+
findProperty((0, _refs.dereferenceSchema)(projectSchema, optionSchema), name, rest, path);
|
|
210
210
|
}
|
|
211
211
|
} else if ((0, _utils.isArraySchema)(currentSchema)) {
|
|
212
|
-
findProperty((0,
|
|
212
|
+
findProperty((0, _refs.dereferenceSchema)(projectSchema, currentSchema.items), name, rest, path);
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
const [first, ...rest] = path.split('.');
|
|
217
|
-
findProperty((0,
|
|
217
|
+
findProperty((0, _refs.dereferenceSchema)(projectSchema, schema), first, rest, []);
|
|
218
218
|
return result;
|
|
219
219
|
}
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,mBAAmB,EAAE,6BAA6B,EAAC,MAAM,mBAAmB,CAAC;AAE1F,YAAY,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,mBAAmB,EAAE,6BAA6B,EAAC,MAAM,mBAAmB,CAAC;AAE1F,YAAY,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -361,4 +361,18 @@ Object.keys(_relationships).forEach(function (key) {
|
|
|
361
361
|
return _relationships[key];
|
|
362
362
|
}
|
|
363
363
|
});
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
var _rewrite = require("./rewrite");
|
|
367
|
+
|
|
368
|
+
Object.keys(_rewrite).forEach(function (key) {
|
|
369
|
+
if (key === "default" || key === "__esModule") return;
|
|
370
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
371
|
+
if (key in exports && exports[key] === _rewrite[key]) return;
|
|
372
|
+
Object.defineProperty(exports, key, {
|
|
373
|
+
enumerable: true,
|
|
374
|
+
get: function () {
|
|
375
|
+
return _rewrite[key];
|
|
376
|
+
}
|
|
377
|
+
});
|
|
364
378
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,SAAS,CAAC;AA6C3D,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAG9C,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,6BAA6B,EACtC,aAAa,EAAE,gBAAgB,GAC9B,OAAO,CAAC,aAAa,CAAC,CAsFxB;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,6BAA6B,EACtC,MAAM,CAAC,EAAE,gBAAgB,GACxB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAMpC"}
|
package/lib/migration/index.js
CHANGED
|
@@ -50,6 +50,10 @@ var _v17 = _interopRequireDefault(require("./to/v3.12.3"));
|
|
|
50
50
|
|
|
51
51
|
var _v18 = _interopRequireDefault(require("./to/v3.13.0"));
|
|
52
52
|
|
|
53
|
+
var _v19 = _interopRequireDefault(require("./to/v3.14.0"));
|
|
54
|
+
|
|
55
|
+
var _v20 = _interopRequireDefault(require("./to/v3.15.0"));
|
|
56
|
+
|
|
53
57
|
var _utils2 = require("./utils");
|
|
54
58
|
|
|
55
59
|
Object.keys(_utils2).forEach(function (key) {
|
|
@@ -66,7 +70,8 @@ Object.keys(_utils2).forEach(function (key) {
|
|
|
66
70
|
|
|
67
71
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
68
72
|
|
|
69
|
-
const listTypePrefix = 'PaginatedList';
|
|
73
|
+
const listTypePrefix = 'PaginatedList'; // eslint-disable-next-line complexity
|
|
74
|
+
|
|
70
75
|
exports.listTypePrefix = listTypePrefix;
|
|
71
76
|
|
|
72
77
|
async function migrateToLatestProjectSchema(context, projectSchema) {
|
|
@@ -146,6 +151,14 @@ async function migrateToLatestProjectSchema(context, projectSchema) {
|
|
|
146
151
|
projectSchema = (0, _v18.default)(projectSchema);
|
|
147
152
|
}
|
|
148
153
|
|
|
154
|
+
if ((0, _utils.isProjectSchemaV3_13_0)(projectSchema)) {
|
|
155
|
+
projectSchema = (0, _v19.default)(projectSchema);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if ((0, _utils.isProjectSchemaV3_14_0)(projectSchema)) {
|
|
159
|
+
projectSchema = (0, _v20.default)(projectSchema);
|
|
160
|
+
}
|
|
161
|
+
|
|
149
162
|
return projectSchema;
|
|
150
163
|
}
|
|
151
164
|
|