@takeshape/schema 8.16.0 → 8.20.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.
- package/es/enum.js +1 -1
- package/es/get-is-leaf.js +5 -5
- package/es/layers/type-utils.js +2 -2
- package/es/migration.js +59 -1
- package/es/project-schema/index.js +1 -0
- package/es/project-schema/v3.10.0.js +1 -0
- package/es/refs.js +19 -19
- package/es/schema-util.js +7 -7
- package/es/schemas/index.js +15 -15
- package/es/schemas/index.ts +26 -25
- package/es/schemas/project-schema/v3.10.0.json +2091 -0
- package/es/schemas/project-schema/v4.0.0.json +8 -6
- package/es/schemas/project-schema.json +2 -1
- package/es/types/types.js +1 -1
- package/es/types/utils.js +20 -19
- package/es/util/detect-cycles.js +1 -1
- package/es/validate.js +10 -7
- package/examples/latest/blog-schema.json +32 -32
- package/examples/latest/brewery-schema.json +53 -53
- package/examples/latest/complex-project-schema.json +3278 -3278
- package/examples/latest/fabric-ecommerce.json +130 -130
- package/examples/latest/frank-and-fred-schema.json +15588 -15588
- package/examples/latest/massive-schema.json +5836 -5836
- package/examples/latest/mill-components-schema.json +876 -876
- package/examples/latest/pet-oneof-array.json +77 -77
- package/examples/latest/post-schema.json +23 -23
- package/examples/latest/pruned-shopify-product-schema.json +19 -19
- package/examples/latest/real-world-schema.json +166 -166
- package/examples/latest/recursive-repeater-schema.json +14 -14
- package/examples/latest/recursive-schema.json +14 -14
- package/examples/latest/rick-and-morty-ast.json +1875 -1896
- package/examples/latest/rick-and-morty-graphql.json +1093 -1093
- package/examples/latest/rick-and-morty-rest.json +20 -20
- package/examples/latest/schema-with-repeater-draftjs.json +9 -9
- package/examples/latest/shape-books-v3_2_0.json +218 -218
- package/examples/latest/shape-books.json +218 -218
- package/examples/latest/shopify-lookbook.json +147 -147
- package/examples/latest/shopify-store-with-widget.json +10420 -10420
- package/examples/latest/stripe-starter-resolved.json +1018 -1018
- package/examples/latest/user-schema-no-required.json +19 -19
- package/examples/latest/user-schema-with-defaults.json +20 -20
- package/examples/source/rick-and-morty-ast.json +0 -21
- package/lib/content-schema-transform.d.ts +13 -13
- package/lib/content-schema-transform.d.ts.map +1 -1
- package/lib/enum.d.ts +2 -2
- package/lib/enum.d.ts.map +1 -1
- package/lib/enum.js +2 -2
- package/lib/get-is-leaf.d.ts +2 -2
- package/lib/get-is-leaf.d.ts.map +1 -1
- package/lib/get-is-leaf.js +5 -5
- package/lib/layers/type-utils.js +1 -1
- package/lib/migration.d.ts +6 -5
- package/lib/migration.d.ts.map +1 -1
- package/lib/migration.js +60 -0
- package/lib/project-schema/index.d.ts +3 -1
- package/lib/project-schema/index.d.ts.map +1 -1
- package/lib/project-schema/index.js +25 -12
- package/lib/project-schema/latest.d.ts +260 -238
- package/lib/project-schema/latest.d.ts.map +1 -1
- package/lib/project-schema/v1.0.0.d.ts +14 -7
- package/lib/project-schema/v1.0.0.d.ts.map +1 -1
- package/lib/project-schema/v3.0.0.d.ts +24 -25
- package/lib/project-schema/v3.0.0.d.ts.map +1 -1
- package/lib/project-schema/v3.1.0.d.ts +42 -43
- package/lib/project-schema/v3.1.0.d.ts.map +1 -1
- package/lib/project-schema/v3.10.0.d.ts +1202 -0
- package/lib/project-schema/v3.10.0.d.ts.map +1 -0
- package/lib/project-schema/v3.10.0.js +5 -0
- package/lib/project-schema/v3.2.0.d.ts +42 -43
- package/lib/project-schema/v3.2.0.d.ts.map +1 -1
- package/lib/project-schema/v3.3.0.d.ts +42 -43
- package/lib/project-schema/v3.3.0.d.ts.map +1 -1
- package/lib/project-schema/v3.4.0.d.ts +42 -43
- package/lib/project-schema/v3.4.0.d.ts.map +1 -1
- package/lib/project-schema/v3.5.0.d.ts +42 -43
- package/lib/project-schema/v3.5.0.d.ts.map +1 -1
- package/lib/project-schema/v3.5.1.d.ts +42 -43
- package/lib/project-schema/v3.5.1.d.ts.map +1 -1
- package/lib/project-schema/v3.6.0.d.ts +42 -43
- package/lib/project-schema/v3.6.0.d.ts.map +1 -1
- package/lib/project-schema/v3.7.0.d.ts +42 -43
- package/lib/project-schema/v3.7.0.d.ts.map +1 -1
- package/lib/project-schema/v3.8.0.d.ts +42 -43
- package/lib/project-schema/v3.8.0.d.ts.map +1 -1
- package/lib/project-schema/v3.9.0.d.ts +42 -43
- package/lib/project-schema/v3.9.0.d.ts.map +1 -1
- package/lib/project-schema/v4.0.0.d.ts +54 -52
- package/lib/project-schema/v4.0.0.d.ts.map +1 -1
- package/lib/refs.d.ts +8 -8
- package/lib/refs.d.ts.map +1 -1
- package/lib/refs.js +19 -19
- package/lib/schema-util.d.ts +23 -23
- package/lib/schema-util.d.ts.map +1 -1
- package/lib/schema-util.js +7 -7
- package/lib/schemas/index.d.ts +3421 -3420
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +26 -30
- package/lib/schemas/index.ts +26 -25
- package/lib/schemas/project-schema/v3.10.0.json +2091 -0
- package/lib/schemas/project-schema/v4.0.0.json +8 -6
- package/lib/schemas/project-schema.json +2 -1
- package/lib/types/types.d.ts +8 -7
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js +1 -1
- package/lib/types/utils.d.ts +9 -8
- package/lib/types/utils.d.ts.map +1 -1
- package/lib/types/utils.js +25 -23
- package/lib/unions.d.ts +8 -8
- package/lib/unions.d.ts.map +1 -1
- package/lib/util/detect-cycles.d.ts +2 -2
- package/lib/util/detect-cycles.d.ts.map +1 -1
- package/lib/util/detect-cycles.js +1 -1
- package/lib/validate.d.ts.map +1 -1
- package/lib/validate.js +9 -6
- package/lib/workflows.d.ts +2 -2
- package/lib/workflows.d.ts.map +1 -1
- package/package.json +5 -5
package/lib/schema-util.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
|
-
import type { ProjectSchema,
|
|
2
|
+
import type { ProjectSchema, PropertySchema, FormConfig, Query, QueryMap, Shape, ShapeMap, ObjectSchema, ServiceConfig, ShapeV3_0_0, ShapeSchema } from './project-schema';
|
|
3
3
|
import type { LatestProjectSchemaWithServices, ServiceMap, ServiceInfo, SchemaWithArgs, SchemaPropertyName, SchemaPropertyNode, ProjectSchemaV3X, SchemaPath, SchemaWithRef } from './types/types';
|
|
4
4
|
import { Maybe } from '@takeshape/util';
|
|
5
5
|
import { RefItem, RefItemWithPath, ServicesShapesContext } from './refs';
|
|
@@ -23,13 +23,13 @@ export declare function getShapeQueriesAndMutations(shapeList: Array<Shape | Sha
|
|
|
23
23
|
queries: QueryMap;
|
|
24
24
|
mutations: QueryMap;
|
|
25
25
|
};
|
|
26
|
-
export declare function getBuiltInProperties(apiVersion?: string): Record<string,
|
|
26
|
+
export declare function getBuiltInProperties(apiVersion?: string): Record<string, PropertySchema>;
|
|
27
27
|
/**
|
|
28
28
|
* Return all the built in property names,
|
|
29
29
|
*/
|
|
30
30
|
export declare const getBuiltInPropertyNames: (apiVersion?: string) => Set<string>;
|
|
31
31
|
export declare function applyBuiltinPropertiesToShape(projectSchema: ProjectSchema, shape: Shape): Shape;
|
|
32
|
-
export declare function mergeSchemaProperties(base: ObjectSchema, overrides: ObjectSchema):
|
|
32
|
+
export declare function mergeSchemaProperties(base: ObjectSchema, overrides: ObjectSchema): ObjectSchema;
|
|
33
33
|
export declare function mergeFormProperties(base: FormConfig, overrides: FormConfig): FormConfig;
|
|
34
34
|
/**
|
|
35
35
|
* Get all built-in shapes that are depended on by the given project schema.
|
|
@@ -61,10 +61,10 @@ export declare function isModelShape(shape: Shape): boolean;
|
|
|
61
61
|
export declare function isIndexedRemoteShape({ indexedShapes }: Pick<ProjectSchema, 'indexedShapes'>, shape: Shape): boolean;
|
|
62
62
|
export declare function getArgsReference(projectSchema: ProjectSchemaV3X, argsSchema: SchemaWithArgs): Maybe<RefItem>;
|
|
63
63
|
export declare function getArgsReferenceWithPath(projectSchema: ProjectSchemaV3X, argsSchema: SchemaWithArgs, schemaPath?: SchemaPath): Maybe<RefItemWithPath>;
|
|
64
|
-
export declare function getArgsShapeSchema(projectSchema: ProjectSchema, argsSchema: SchemaWithArgs): Maybe<
|
|
65
|
-
export declare function
|
|
64
|
+
export declare function getArgsShapeSchema(projectSchema: ProjectSchema, argsSchema: SchemaWithArgs): Maybe<ShapeSchema>;
|
|
65
|
+
export declare function shapeToPropertySchema(projectSchema: ProjectSchema, shape: Shape): PropertySchema;
|
|
66
66
|
export declare function projectSchemaToJSONSchema(projectSchema: ProjectSchema): {
|
|
67
|
-
definitions: Record<string,
|
|
67
|
+
definitions: Record<string, PropertySchema>;
|
|
68
68
|
};
|
|
69
69
|
export declare function getShapeDependencies(projectSchema: ProjectSchema, shape: Shape): string[];
|
|
70
70
|
interface GetRelevantShapesParams {
|
|
@@ -74,8 +74,8 @@ interface GetRelevantShapesParams {
|
|
|
74
74
|
includeDependencies?: boolean;
|
|
75
75
|
}
|
|
76
76
|
export declare function getRelevantShapes(projectSchema: ProjectSchema, params: GetRelevantShapesParams): ShapeMap;
|
|
77
|
-
export declare type PropertyVisitorCallback = (schema:
|
|
78
|
-
export declare function visitSchemaProperties(schema:
|
|
77
|
+
export declare type PropertyVisitorCallback = (schema: PropertySchema, path: SchemaPath) => void;
|
|
78
|
+
export declare function visitSchemaProperties(schema: PropertySchema, path: Array<string | number>, callback: PropertyVisitorCallback): void;
|
|
79
79
|
export declare function visitShapeProperties(shapes: ShapeMap, callback: PropertyVisitorCallback): void;
|
|
80
80
|
export declare type RefPredicate = (ref: RefItemWithPath) => boolean;
|
|
81
81
|
/**
|
|
@@ -103,11 +103,11 @@ export interface Mapping {
|
|
|
103
103
|
}
|
|
104
104
|
export declare function parseMapping(mapping: string): Mapping;
|
|
105
105
|
export declare function splitMapping(mapping: string): string[];
|
|
106
|
-
export declare function findMapping(schema:
|
|
107
|
-
export declare function getFirstMapping(schema:
|
|
108
|
-
export declare function getFullyQualifiedShapeName(schema:
|
|
109
|
-
export declare function getKey(schema:
|
|
110
|
-
export declare function getPropertyService(schema:
|
|
106
|
+
export declare function findMapping(schema: PropertySchema, predicate: (mappingStr: string) => boolean): string | undefined;
|
|
107
|
+
export declare function getFirstMapping(schema: PropertySchema): string | undefined;
|
|
108
|
+
export declare function getFullyQualifiedShapeName(schema: PropertySchema): string | undefined;
|
|
109
|
+
export declare function getKey(schema: PropertySchema): string | undefined;
|
|
110
|
+
export declare function getPropertyService(schema: PropertySchema): string | undefined;
|
|
111
111
|
export declare function emptySchema(projectId: string, dataKey: string): ProjectSchema;
|
|
112
112
|
export declare function getShapesById(projectSchema: ProjectSchema): ShapeMap;
|
|
113
113
|
/**
|
|
@@ -144,7 +144,7 @@ export declare function filterGraphQLServiceMap(serviceMap: ServiceMap): Map<str
|
|
|
144
144
|
/**
|
|
145
145
|
* Add all referenced shape names to the refSet meant to be used as a callback to visitSchemaProperties
|
|
146
146
|
*/
|
|
147
|
-
export declare function collectReferencedShapeNames(projectSchema: ProjectSchema, refSet: Set<string>): (schema:
|
|
147
|
+
export declare function collectReferencedShapeNames(projectSchema: ProjectSchema, refSet: Set<string>): (schema: PropertySchema) => void;
|
|
148
148
|
/**
|
|
149
149
|
* Get the subset of a schema that was automatically created or should otherwise
|
|
150
150
|
* have special protection against editing or deleting.
|
|
@@ -158,31 +158,31 @@ export declare function getProtectedSchema(schema: ProjectSchema): Pick<ProjectS
|
|
|
158
158
|
*
|
|
159
159
|
* If it can't create a valid schema it returns the input.
|
|
160
160
|
*/
|
|
161
|
-
export declare function dereferenceSchema(context: ServicesShapesContext, shapeOrFieldSchema:
|
|
162
|
-
export declare function dereferenceObjectSchema(context: ServicesShapesContext, shapeOrFieldSchema:
|
|
161
|
+
export declare function dereferenceSchema(context: ServicesShapesContext, shapeOrFieldSchema: PropertySchema, schemaPath?: SchemaPath): PropertySchema;
|
|
162
|
+
export declare function dereferenceObjectSchema(context: ServicesShapesContext, shapeOrFieldSchema: PropertySchema, schemaPath?: SchemaPath): ObjectSchema;
|
|
163
163
|
/**
|
|
164
164
|
* Creates a schema property list chainable fn, allowing you to manipulate and
|
|
165
165
|
* iterate the properties in a schema.
|
|
166
166
|
*/
|
|
167
|
-
export declare const createSchemaPropertyList: import("lodash").CurriedFunction2<ServicesShapesContext,
|
|
168
|
-
_propertyIterator: Map<string,
|
|
167
|
+
export declare const createSchemaPropertyList: import("lodash").CurriedFunction2<ServicesShapesContext, PropertySchema, {
|
|
168
|
+
_propertyIterator: Map<string, PropertySchema>;
|
|
169
169
|
orderBy: (iteratees?: ((n: SchemaPropertyNode) => string)[], orders?: ("asc" | "desc")[]) => any;
|
|
170
170
|
sortWith: (comparator?: ((a: SchemaPropertyNode, b: SchemaPropertyNode) => number) | undefined) => any;
|
|
171
171
|
sortByNamesWithList: (comparatorArray?: string[] | undefined) => any;
|
|
172
172
|
filterBy: (predicate: (n: SchemaPropertyNode) => boolean) => any;
|
|
173
173
|
forEach: (iteratee: (n: SchemaPropertyNode) => void) => any;
|
|
174
174
|
getNodes: () => SchemaPropertyNode[];
|
|
175
|
-
getObject: () => Record<string,
|
|
175
|
+
getObject: () => Record<string, PropertySchema>;
|
|
176
176
|
getNames: () => SchemaPropertyName[];
|
|
177
|
-
getValues: () =>
|
|
177
|
+
getValues: () => PropertySchema[];
|
|
178
178
|
}>;
|
|
179
179
|
/**
|
|
180
180
|
* Creates a schema property accessor, allowing you to safely access schema
|
|
181
181
|
* properties.
|
|
182
182
|
*/
|
|
183
|
-
export declare const createSchemaPropertyAccessor: import("lodash").CurriedFunction2<ServicesShapesContext,
|
|
184
|
-
getValue: (propertyName: SchemaPropertyName) => Maybe<
|
|
185
|
-
findValue: (predicate: (n: SchemaPropertyNode) => boolean) => Maybe<
|
|
183
|
+
export declare const createSchemaPropertyAccessor: import("lodash").CurriedFunction2<ServicesShapesContext, PropertySchema, {
|
|
184
|
+
getValue: (propertyName: SchemaPropertyName) => Maybe<PropertySchema>;
|
|
185
|
+
findValue: (predicate: (n: SchemaPropertyNode) => boolean) => Maybe<PropertySchema>;
|
|
186
186
|
findName: (predicate: (n: SchemaPropertyNode) => boolean) => Maybe<SchemaPropertyName>;
|
|
187
187
|
getKey: (propertyName: SchemaPropertyName) => Maybe<string>;
|
|
188
188
|
}>;
|
package/lib/schema-util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-util.d.ts","sourceRoot":"","sources":["../../src/schema-util.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"schema-util.d.ts","sourceRoot":"","sources":["../../src/schema-util.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,UAAU,EAEV,KAAK,EACL,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,WAAW,EAGX,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,+BAA+B,EAC/B,UAAU,EACV,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAElB,gBAAgB,EAChB,UAAU,EACV,aAAa,EACd,MAAM,eAAe,CAAC;AAevB,OAAO,EAAC,KAAK,EAA6C,MAAM,iBAAiB,CAAC;AAQlF,OAAO,EAQL,OAAO,EAIP,eAAe,EACf,qBAAqB,EACtB,MAAM,QAAQ,CAAC;AAGhB,eAAO,MAAM,2BAA2B,2BAA2B,CAAC;AAEpE,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEzD;AAID,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,wBAAgB,aAAa,CAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,GAAG,OAAO,CAG7F;AAED,eAAO,MAAM,kBAAkB,UAU9B,CAAC;AACF,eAAO,MAAM,gBAAgB,UAAyD,CAAC;AAEvF,eAAO,MAAM,gBAAgB,UAY5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAkD,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,MAAM,CAAC;EAcpE,CAAC;AAEF,oBAAY,kBAAkB,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC;AAgC9E;;GAEG;AACH,eAAO,MAAM,SAAS,kBAAmB,kBAAkB,aAAa,MAAM,YAAY,MAAM,KAAG,MAAM,GAAG,SAC9C,CAAC;AAC/D;;GAEG;AACH,eAAO,MAAM,YAAY,kBACR,kBAAkB,aACtB,MAAM,YACP,MAAM,KACf,MAAM,GAAG,SAA4E,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,WAAW,kBAAmB,kBAAkB,aAAa,MAAM,YAAY,MAAM,KAAG,MACrC,CAAC;AACjE;;;GAGG;AACH,eAAO,MAAM,cAAc,kBAAmB,kBAAkB,aAAa,MAAM,YAAY,MAAM,KAAG,MACrC,CAAC;AAEpE;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,KAAK,CAAC,UAAU,CAAC,CAEnB;AAED,oBAAY,2BAA2B,GACnC,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,qBAAqB,CAAC;AAE1B;;GAEG;AACH,eAAO,MAAM,sBAAsB,cAAe,MAAM,YAAY,2BAA2B,KAAG,MAGjG,CAAC"}
|
package/lib/schema-util.js
CHANGED
|
@@ -59,7 +59,7 @@ exports.parseQuerySource = parseQuerySource;
|
|
|
59
59
|
exports.pathBetween = pathBetween;
|
|
60
60
|
exports.projectSchemaToJSONSchema = projectSchemaToJSONSchema;
|
|
61
61
|
exports.schemaMetadataKeys = exports.scalarSchemaKeys = void 0;
|
|
62
|
-
exports.
|
|
62
|
+
exports.shapeToPropertySchema = shapeToPropertySchema;
|
|
63
63
|
exports.splitMapping = splitMapping;
|
|
64
64
|
exports.stringifyQuerySource = stringifyQuerySource;
|
|
65
65
|
exports.visitSchemaProperties = visitSchemaProperties;
|
|
@@ -677,7 +677,7 @@ function getArgsShapeSchema(projectSchema, argsSchema) {
|
|
|
677
677
|
|
|
678
678
|
const omitAllOfAndExtend = (targetSchema, sourceSchema) => (0, _assign.default)((0, _omit.default)(['allOf'], targetSchema), sourceSchema);
|
|
679
679
|
|
|
680
|
-
const
|
|
680
|
+
const createShapeToPropertySchema = (projectSchema, definitions, definitionNames, useShapeIdDiscriminator = true) => {
|
|
681
681
|
const rewriteRefs = (shape, addDiscriminator = false) => {
|
|
682
682
|
const handleSchema = (propSchema, addDiscriminator = false) => {
|
|
683
683
|
// Unwrap array schema
|
|
@@ -749,10 +749,10 @@ const createShapeToContentSchema = (projectSchema, definitions, definitionNames,
|
|
|
749
749
|
return rewriteRefs;
|
|
750
750
|
};
|
|
751
751
|
|
|
752
|
-
function
|
|
752
|
+
function shapeToPropertySchema(projectSchema, shape) {
|
|
753
753
|
const definitions = {};
|
|
754
754
|
const definitionNames = new Set();
|
|
755
|
-
const convert =
|
|
755
|
+
const convert = createShapeToPropertySchema(projectSchema, definitions, definitionNames);
|
|
756
756
|
return { ...convert(shape),
|
|
757
757
|
definitions
|
|
758
758
|
};
|
|
@@ -761,7 +761,7 @@ function shapeToContentSchema(projectSchema, shape) {
|
|
|
761
761
|
function projectSchemaToJSONSchema(projectSchema) {
|
|
762
762
|
const definitions = {};
|
|
763
763
|
const definitionNames = new Set();
|
|
764
|
-
const convert =
|
|
764
|
+
const convert = createShapeToPropertySchema(projectSchema, definitions, definitionNames, false);
|
|
765
765
|
|
|
766
766
|
for (const shape of Object.values(projectSchema.shapes)) {
|
|
767
767
|
definitions[shape.name] = convert(shape);
|
|
@@ -1205,7 +1205,7 @@ function dereferenceObjectSchema(context, shapeOrFieldSchema, schemaPath = []) {
|
|
|
1205
1205
|
|
|
1206
1206
|
|
|
1207
1207
|
const createSchemaPropertyList = (0, _curry.default)((context, shapeOrFieldSchema) => {
|
|
1208
|
-
const schema =
|
|
1208
|
+
const schema = dereferenceSchema(context, shapeOrFieldSchema);
|
|
1209
1209
|
const propertyIterator = new Map((0, _utils.isObjectSchema)(schema) ? Object.entries(schema.properties) : undefined);
|
|
1210
1210
|
const defaultOrderByIteratees = [n => n[0]];
|
|
1211
1211
|
const defaultOrderByOrders = ['asc'];
|
|
@@ -1282,7 +1282,7 @@ const createSchemaPropertyList = (0, _curry.default)((context, shapeOrFieldSchem
|
|
|
1282
1282
|
|
|
1283
1283
|
exports.createSchemaPropertyList = createSchemaPropertyList;
|
|
1284
1284
|
const createSchemaPropertyAccessor = (0, _curry.default)((context, shapeOrFieldSchema) => {
|
|
1285
|
-
const schema =
|
|
1285
|
+
const schema = dereferenceSchema(context, shapeOrFieldSchema);
|
|
1286
1286
|
const propertyIterator = new Map((0, _utils.isObjectSchema)(schema) ? Object.entries(schema.properties) : undefined);
|
|
1287
1287
|
|
|
1288
1288
|
const _getValue = propertyName => {
|