@takeshape/schema 11.89.0 → 11.91.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.
- package/dist/flatten-templates.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces.d.ts +4 -2
- package/dist/interfaces.js +6 -5
- package/dist/migration/to/v3.34.0.js +2 -7
- package/dist/models/runtime-schema.js +7 -7
- package/dist/models/shape.d.ts +1 -0
- package/dist/models/shape.js +5 -2
- package/dist/refs.d.ts +30 -51
- package/dist/refs.js +101 -137
- package/dist/relationships.d.ts +1 -1
- package/dist/relationships.js +22 -31
- package/dist/schema-util.d.ts +4 -16
- package/dist/schema-util.js +12 -45
- package/dist/service-dependencies.js +9 -9
- package/dist/template-shapes/templates.d.ts +10 -10
- package/dist/template-shapes/templates.js +6 -9
- package/dist/template-shapes/where.js +9 -11
- package/dist/types/types.d.ts +0 -14
- package/dist/types/types.js +0 -8
- package/dist/types/utils.d.ts +2 -8
- package/dist/types/utils.js +1 -14
- package/dist/unions.js +2 -2
- package/dist/util/expressions.d.ts +13 -2
- package/dist/util/expressions.js +32 -0
- package/dist/util/form-config.js +1 -1
- package/dist/util/get-conflicting-properties.js +2 -2
- package/dist/util/has-arg.js +2 -2
- package/dist/util/is-asset-property.d.ts +3 -0
- package/dist/util/is-asset-property.js +11 -0
- package/dist/util/merge.js +1 -1
- package/dist/validate/validate.js +24 -20
- package/package.json +6 -5
|
@@ -11,7 +11,7 @@ export function flattenTemplates(projectSchema) {
|
|
|
11
11
|
const newSchema = deepClone(projectSchema);
|
|
12
12
|
for (const ref of templateRefs) {
|
|
13
13
|
if (ref.template && isValidTemplate(ref.template)) {
|
|
14
|
-
const { shapeName, dependencies } = resolveTemplate(newSchema, ref.template, refItemToNamespacedShapeName(ref));
|
|
14
|
+
const { shapeName, dependencies } = resolveTemplate(newSchema, ref.template, refItemToNamespacedShapeName(newSchema, ref));
|
|
15
15
|
set(newSchema, ref.path, ref.path[ref.path.length - 1] === '@ref' ? `local:${shapeName}` : shapeName);
|
|
16
16
|
Object.assign(newSchema.shapes, dependencies);
|
|
17
17
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export * from './util/form-config.ts';
|
|
|
43
43
|
export * from './util/get-conflicting-properties.ts';
|
|
44
44
|
export * from './util/get-return-shape.ts';
|
|
45
45
|
export * from './util/has-arg.ts';
|
|
46
|
+
export * from './util/is-asset-property.ts';
|
|
46
47
|
export * from './util/merge.ts';
|
|
47
48
|
export * from './util/patch-schema.ts';
|
|
48
49
|
export * from './util/shapes.ts';
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ export * from "./util/form-config.js";
|
|
|
41
41
|
export * from "./util/get-conflicting-properties.js";
|
|
42
42
|
export * from "./util/get-return-shape.js";
|
|
43
43
|
export * from "./util/has-arg.js";
|
|
44
|
+
export * from "./util/is-asset-property.js";
|
|
44
45
|
export * from "./util/merge.js";
|
|
45
46
|
export * from "./util/patch-schema.js";
|
|
46
47
|
export * from "./util/shapes.js";
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { OneOfSchema, ProjectSchemaJSON, PropertySchema, ShapeJSON, ShapeMap } from './project-schema/index.ts';
|
|
2
|
-
import type
|
|
3
|
-
export declare function isInterfaceShape(shape?: ShapeJSON):
|
|
2
|
+
import { type RefItem, type ServicesShapesContext } from './refs.ts';
|
|
3
|
+
export declare function isInterfaceShape(shape?: ShapeJSON): shape is ShapeJSON & {
|
|
4
|
+
type: 'interface';
|
|
5
|
+
};
|
|
4
6
|
export type ImplementationShapeMap = Record<string, Set<ShapeJSON>>;
|
|
5
7
|
export type ImplementationShapeNameMap = Record<string, Set<string>>;
|
|
6
8
|
export declare function isInterfaceRef(context: ServicesShapesContext, propertySchema: PropertySchema): boolean;
|
package/dist/interfaces.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isDefined } from '@takeshape/util';
|
|
2
2
|
import mapValues from 'lodash/mapValues.js';
|
|
3
|
-
import { getRef, normalizeRefExpression,
|
|
3
|
+
import { getRef, getShapeByRef, normalizeRefExpression, parseRef, refItemToNamespacedShapeName, refItemToShape, shapeToRefItem } from "./refs.js";
|
|
4
4
|
import { isUnionSchema } from "./unions.js";
|
|
5
5
|
export function isInterfaceShape(shape) {
|
|
6
6
|
return shape?.type === 'interface';
|
|
@@ -36,7 +36,8 @@ export function pruneUnusedInterfaces(projectSchema, shapeMap) {
|
|
|
36
36
|
return mapValues(shapeMap, (shape) => {
|
|
37
37
|
const { interfaces } = shape;
|
|
38
38
|
if (interfaces?.length) {
|
|
39
|
-
const
|
|
39
|
+
const context = { ...projectSchema, shapes: shapeMap };
|
|
40
|
+
const filteredInterfaces = interfaces.filter((refExpression) => getShapeByRef(context, refExpression));
|
|
40
41
|
if (interfaces.length !== filteredInterfaces.length) {
|
|
41
42
|
return { ...shape, interfaces: filteredInterfaces };
|
|
42
43
|
}
|
|
@@ -45,13 +46,13 @@ export function pruneUnusedInterfaces(projectSchema, shapeMap) {
|
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
function compareRefItems(refItem1, refItem2) {
|
|
48
|
-
return refItem1.
|
|
49
|
+
return refItem1.shapeName === refItem2.shapeName && refItem1.layerId === refItem2.layerId;
|
|
49
50
|
}
|
|
50
51
|
export function getImplementingShapes(context, interfaceRef) {
|
|
51
52
|
const shapeMap = context.shapes;
|
|
52
53
|
const implementingShapes = [];
|
|
53
54
|
for (const shape of Object.values(shapeMap)) {
|
|
54
|
-
if (shape.interfaces?.find((interfaceRefExpression) => compareRefItems(
|
|
55
|
+
if (shape.interfaces?.find((interfaceRefExpression) => compareRefItems(parseRef(context, interfaceRefExpression), interfaceRef))) {
|
|
55
56
|
implementingShapes.push(shape);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
@@ -74,7 +75,7 @@ export function getPossibleShapeNames(projectSchema, shape) {
|
|
|
74
75
|
names = shape.schema.oneOf
|
|
75
76
|
.map((member) => {
|
|
76
77
|
const ref = getRef(projectSchema, member);
|
|
77
|
-
return ref && refItemToNamespacedShapeName(ref);
|
|
78
|
+
return ref && refItemToNamespacedShapeName(projectSchema, ref);
|
|
78
79
|
})
|
|
79
80
|
.filter(isDefined);
|
|
80
81
|
}
|
|
@@ -3,15 +3,10 @@ import set from 'lodash/fp/set.js';
|
|
|
3
3
|
import unset from 'lodash/fp/unset.js';
|
|
4
4
|
import upperFirst from 'lodash/upperFirst.js';
|
|
5
5
|
import { SERVICE_OBJECT_PATTERN_NAME } from "../../constants.js";
|
|
6
|
-
import { getRefOrItemsRef } from "../../refs.js";
|
|
6
|
+
import { getRefOrItemsRef, refItemToNamespacedShapeName } from "../../refs.js";
|
|
7
7
|
import { createSchemaPropertyAccessor } from "../../schema-util.js";
|
|
8
8
|
import { CURRENT_SCHEMA_VERSION } from "../../schemas/index.js";
|
|
9
9
|
import { getServiceObjectFields } from "../../services/services.js";
|
|
10
|
-
// Inline utilities for posterity
|
|
11
|
-
function refItemToShapeName(refItem) {
|
|
12
|
-
const { serviceNamespace, typeName } = refItem;
|
|
13
|
-
return serviceNamespace ? `${serviceNamespace}_${typeName}` : typeName;
|
|
14
|
-
}
|
|
15
10
|
// Map of form studio widgets and their replacements in the shape editor
|
|
16
11
|
const widgetMigrations = {
|
|
17
12
|
object: 'shapeObject',
|
|
@@ -39,7 +34,7 @@ export function normalizeForms(projectSchema) {
|
|
|
39
34
|
if (propSchema) {
|
|
40
35
|
const ref = getRefOrItemsRef(projectSchema, propSchema);
|
|
41
36
|
if (ref && propConfig.properties && propConfig.widget !== 'shopify') {
|
|
42
|
-
const nestedShapeName =
|
|
37
|
+
const nestedShapeName = refItemToNamespacedShapeName(projectSchema, ref);
|
|
43
38
|
normalizedForms[nestedShapeName] = { default: deepClone(propConfig) };
|
|
44
39
|
storeSourceForm(shapeName, formConfig, propName);
|
|
45
40
|
normalizeNested(nestedShapeName, propConfig);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dereferenceSchema, getQuery, normalizePropertyRef, normalizeRefExpression, parsePropertyRef,
|
|
1
|
+
import { dereferenceSchema, getQuery, normalizePropertyRef, normalizeRefExpression, parsePropertyRef, parseRef, refItemToNamespacedShapeName } from "../refs.js";
|
|
2
2
|
import { buildRuntimeSchema } from "../runtime-schema.js";
|
|
3
3
|
import { getShape } from "../util/shapes.js";
|
|
4
4
|
import { Query } from './query.js';
|
|
@@ -18,16 +18,16 @@ class ProjectSchemaRefResolver {
|
|
|
18
18
|
const shapeRef = normalizeRefExpression(this.#runtimeSchemaJson, rawShapeRef);
|
|
19
19
|
let shape = this.#shapeCache.get(shapeRef);
|
|
20
20
|
if (!shape) {
|
|
21
|
-
const refItem =
|
|
21
|
+
const refItem = parseRef(this.#runtimeSchemaJson, rawShapeRef);
|
|
22
22
|
if (refItem) {
|
|
23
|
-
const namespacedName = refItemToNamespacedShapeName(refItem);
|
|
23
|
+
const namespacedName = refItemToNamespacedShapeName(this.#runtimeSchemaJson, refItem);
|
|
24
24
|
const shapeJson = getShape(this.#runtimeSchemaJson, namespacedName);
|
|
25
25
|
if (shapeJson) {
|
|
26
26
|
shape = new Shape(this, refItem, shapeJson);
|
|
27
27
|
this.#shapeCache.set(shapeRef, shape);
|
|
28
28
|
}
|
|
29
|
-
else if (refItem.
|
|
30
|
-
const layerSchema = this.#layers[refItem.
|
|
29
|
+
else if (refItem.layerId !== 'local') {
|
|
30
|
+
const layerSchema = this.#layers[refItem.layerId]?.schema;
|
|
31
31
|
if (layerSchema) {
|
|
32
32
|
const shapeJson = getShape(layerSchema, namespacedName);
|
|
33
33
|
if (shapeJson) {
|
|
@@ -51,8 +51,8 @@ class ProjectSchemaRefResolver {
|
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
const parsedRef = parsePropertyRef(queryRef);
|
|
54
|
-
if (parsedRef && parsedRef.
|
|
55
|
-
const layerSchema = this.#layers[parsedRef.
|
|
54
|
+
if (parsedRef && parsedRef.layerId !== 'local') {
|
|
55
|
+
const layerSchema = this.#layers[parsedRef.layerId]?.schema;
|
|
56
56
|
if (layerSchema) {
|
|
57
57
|
const queryEntry = getQuery(layerSchema, parsedRef.propertyName);
|
|
58
58
|
if (queryEntry) {
|
package/dist/models/shape.d.ts
CHANGED
package/dist/models/shape.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { serializeRef } from "../refs.js";
|
|
2
2
|
import { isObjectSchema } from "../types/utils.js";
|
|
3
3
|
export class Shape {
|
|
4
4
|
#refResolver;
|
|
@@ -14,11 +14,14 @@ export class Shape {
|
|
|
14
14
|
return this.#shape.name;
|
|
15
15
|
}
|
|
16
16
|
get ref() {
|
|
17
|
-
return
|
|
17
|
+
return serializeRef(this.#ref);
|
|
18
18
|
}
|
|
19
19
|
get refItem() {
|
|
20
20
|
return this.#ref;
|
|
21
21
|
}
|
|
22
|
+
get json() {
|
|
23
|
+
return this.#shape;
|
|
24
|
+
}
|
|
22
25
|
getObjectSchema() {
|
|
23
26
|
if (!this.#dereferencedSchema) {
|
|
24
27
|
this.#dereferencedSchema = this.#refResolver.dereferenceSchema(this.#shape.schema);
|
package/dist/refs.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { type Maybe } from '@takeshape/util';
|
|
2
2
|
import type { AIToolConfig, Args, ObjectSchema, ProjectSchemaJSON, PropertySchema, QueryJSON, Ref, ReturnShape, ShapeJSON, ShapeSchema } from './project-schema/index.ts';
|
|
3
|
-
import type { SchemaPath
|
|
3
|
+
import type { SchemaPath } from './types/index.ts';
|
|
4
4
|
export type ServicesContext = Pick<ProjectSchemaJSON, 'services'>;
|
|
5
5
|
export type ServicesShapesContext = Pick<ProjectSchemaJSON, 'services' | 'shapes'>;
|
|
6
|
+
export declare const LOCAL_LAYER_ID = "local";
|
|
6
7
|
/**
|
|
7
8
|
* This interface describes a parsed `@ref` or `$ref`.
|
|
8
9
|
* The intended usage is to convert a schema with a ref to a RefItem which can then
|
|
9
10
|
* be passed to the various rich utilities in this file.
|
|
10
11
|
*/
|
|
11
12
|
export type RefItem = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
serviceNamespace?: string;
|
|
13
|
+
shapeName: string;
|
|
14
|
+
layerId: string;
|
|
15
15
|
template?: string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
};
|
|
17
|
+
export type PropertyRefItem = RefItem & {
|
|
18
|
+
propertyName: string;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* Adds a schema path, needed when visiting a whole schema to report errors.
|
|
@@ -23,10 +23,6 @@ export type RefItem = {
|
|
|
23
23
|
export type RefItemWithPath = {
|
|
24
24
|
path: SchemaPath;
|
|
25
25
|
} & RefItem;
|
|
26
|
-
/**
|
|
27
|
-
* Guard for RefItemWithPath. Tests for presence of all required props.
|
|
28
|
-
*/
|
|
29
|
-
export declare function isRefItemWithPath(ref: Record<string, unknown>): ref is RefItemWithPath;
|
|
30
26
|
/**
|
|
31
27
|
* Parse a template like `PaginatedList<Post>` and return both the template and the shape name.
|
|
32
28
|
*/
|
|
@@ -40,7 +36,7 @@ export type ParsedReturnShape = {
|
|
|
40
36
|
shapeName: string;
|
|
41
37
|
ref?: RefItem;
|
|
42
38
|
};
|
|
43
|
-
export declare function parseReturnShape(
|
|
39
|
+
export declare function parseReturnShape(context: ServicesContext, shape: ReturnShape): ParsedReturnShape;
|
|
44
40
|
/**
|
|
45
41
|
* Convert Query.shape to a PropertySchema
|
|
46
42
|
*/
|
|
@@ -55,8 +51,7 @@ export declare function createTemplateShapeName(template: string, shapeName: str
|
|
|
55
51
|
*/
|
|
56
52
|
export declare const untemplate: (input: string) => string;
|
|
57
53
|
export declare function getFlattenedTemplateShapeName(shapeName: string, template?: string): string;
|
|
58
|
-
export declare function
|
|
59
|
-
export declare function refSchemaToPath(context: ServicesContext, refSchema: SchemaWithRef): string[];
|
|
54
|
+
export declare function refSchemaToPath(context: ServicesContext, refSchema: PropertySchema): string[];
|
|
60
55
|
/**
|
|
61
56
|
* Safely turn a "template" shape reference (`@args`, `args`, `shape`) into a `RefItem`
|
|
62
57
|
*
|
|
@@ -65,7 +60,8 @@ export declare function refSchemaToPath(context: ServicesContext, refSchema: Sch
|
|
|
65
60
|
* A ref expression might include "template" name and refer to a local or remote
|
|
66
61
|
* shape, `Foo` or `CreateArgs<Foo>` or `CreateArgs<remote:Foo>`.*
|
|
67
62
|
*/
|
|
68
|
-
export declare function
|
|
63
|
+
export declare function parseRef(context: ServicesContext, refExpression: string): RefItem;
|
|
64
|
+
export declare function isRefEqual(context: ServicesContext, a: string | RefItem, b: string | RefItem): boolean;
|
|
69
65
|
/**
|
|
70
66
|
* Converts a list of ref expressions into a list of ref items.
|
|
71
67
|
*/
|
|
@@ -79,24 +75,12 @@ export declare function refExpressionListToRefItemList(context: ServicesContext,
|
|
|
79
75
|
* A ref expression might include "template" name and refer to a local or remote
|
|
80
76
|
* shape, `Foo` or `CreateArgs<Foo>` or `CreateArgs<remote:Foo>`.
|
|
81
77
|
*/
|
|
82
|
-
export declare function
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* references, e.g., `shopify:my-store:ProductInput` or `my-store:ProductInput`.
|
|
86
|
-
*
|
|
87
|
-
* @returns
|
|
88
|
-
* A 2 member array, where 0 is the service name, 1 is the referenced type.
|
|
89
|
-
*/
|
|
90
|
-
export declare function splitAtRef(atRef: string): [string, string];
|
|
91
|
-
/**
|
|
92
|
-
* Parses and returns a typeName, serviceKey, and potentially a namespace for
|
|
93
|
-
* the type.
|
|
94
|
-
*/
|
|
95
|
-
export declare function atRefToRefItem(context: ServicesContext, atRef: string, template?: string): RefItem;
|
|
78
|
+
export declare function getShapeByRef(context: ServicesShapesContext, refExpression: string): Maybe<ShapeJSON>;
|
|
79
|
+
export declare function isValidServiceId(context: ServicesContext, serviceId: string): boolean;
|
|
80
|
+
export declare function isValidRefItem(context: ServicesContext): (refItem: RefItem) => boolean;
|
|
96
81
|
export declare function refToRefItem(context: ServicesContext, $ref: string, template?: string): RefItem;
|
|
97
82
|
export type ParsedName = {
|
|
98
|
-
|
|
99
|
-
serviceId: string;
|
|
83
|
+
layerId: string;
|
|
100
84
|
name: string;
|
|
101
85
|
};
|
|
102
86
|
/**
|
|
@@ -109,14 +93,14 @@ export declare function shapeToRefString(context: ServicesContext, shape: ShapeJ
|
|
|
109
93
|
* Given a property schema and project schema, finds a `@ref` or `$ref` and
|
|
110
94
|
* returns a `RefItem` suitable for loading a referenced schema...
|
|
111
95
|
*/
|
|
112
|
-
export declare function getRef(context: ServicesContext, refSchema:
|
|
113
|
-
export declare function getRefWithPath(context: ServicesContext, refSchema:
|
|
96
|
+
export declare function getRef(context: ServicesContext, refSchema: PropertySchema): Maybe<RefItem>;
|
|
97
|
+
export declare function getRefWithPath(context: ServicesContext, refSchema: PropertySchema, schemaPath?: SchemaPath): Maybe<RefItemWithPath>;
|
|
114
98
|
/**
|
|
115
99
|
* Tests for a `@ref` or `$ref` property directly on the passed schema.
|
|
116
100
|
*
|
|
117
101
|
* @param schema Any schema that might could have a ref property.
|
|
118
102
|
*/
|
|
119
|
-
export declare function hasRefProperty(schema:
|
|
103
|
+
export declare function hasRefProperty(schema: PropertySchema): boolean;
|
|
120
104
|
/**
|
|
121
105
|
* From a property that has oneOf or items with oneOf, get all refs
|
|
122
106
|
*/
|
|
@@ -125,19 +109,20 @@ export declare function getOneOfRefs(context: ServicesContext, propertySchema: P
|
|
|
125
109
|
* From a schema with a ref, will return the top-level ref, and potentially
|
|
126
110
|
* a ref item from a nested `items` property.
|
|
127
111
|
*/
|
|
128
|
-
export declare function getRefOrItemsRef(context: ServicesContext, refSchema:
|
|
112
|
+
export declare function getRefOrItemsRef(context: ServicesContext, refSchema: PropertySchema, schemaPath?: SchemaPath): Maybe<RefItemWithPath>;
|
|
129
113
|
/**
|
|
130
114
|
* Turns a `RefItem` into an `@ref`.
|
|
131
115
|
*/
|
|
132
|
-
export declare function
|
|
116
|
+
export declare function serializeRef(refItem: RefItem): string;
|
|
133
117
|
/**
|
|
134
118
|
* Turns a `RefItem` into a standard shape name, namespacing if present.
|
|
135
119
|
*/
|
|
136
|
-
export declare function refItemToNamespacedShapeName(refItem: RefItem): string;
|
|
120
|
+
export declare function refItemToNamespacedShapeName(context: ServicesContext, refItem: RefItem): string;
|
|
121
|
+
export declare function refExpressionToNamespacedName(context: ServicesContext, refExpression: string): string;
|
|
137
122
|
/**
|
|
138
123
|
* Turns a `RefItem` into a path suitable for `lodash.get`.
|
|
139
124
|
*/
|
|
140
|
-
export declare function refItemToShapePath(refItem: RefItem): string[];
|
|
125
|
+
export declare function refItemToShapePath(context: ServicesContext, refItem: RefItem): string[];
|
|
141
126
|
/**
|
|
142
127
|
* Get a Shape referenced by a `RefItem`.
|
|
143
128
|
*/
|
|
@@ -160,11 +145,11 @@ export declare function refItemToShapeSchema(context: ServicesShapesContext, ref
|
|
|
160
145
|
/**
|
|
161
146
|
* Sugar, for when you really just need a string...
|
|
162
147
|
*/
|
|
163
|
-
export declare function getRefShapeName(context: ServicesContext, refSchema:
|
|
148
|
+
export declare function getRefShapeName(context: ServicesContext, refSchema: PropertySchema): Maybe<string>;
|
|
164
149
|
/**
|
|
165
150
|
* Sugar, for when you really just need a path...
|
|
166
151
|
*/
|
|
167
|
-
export declare function
|
|
152
|
+
export declare function refSchemaToShapeSchemaPath(context: ServicesContext, refSchema: PropertySchema): Maybe<string[]>;
|
|
168
153
|
/**
|
|
169
154
|
* Helper fn to omit `ref` props from the target schema, and then extend it with the source schema.
|
|
170
155
|
*/
|
|
@@ -192,23 +177,16 @@ export declare function hasResolvableRef(context: ServicesShapesContext, schema:
|
|
|
192
177
|
*/
|
|
193
178
|
export declare function dereferenceSchema(context: ServicesShapesContext, shapeOrFieldSchema: PropertySchema, schemaPath?: SchemaPath): PropertySchema;
|
|
194
179
|
export declare function dereferenceObjectSchema(context: ServicesShapesContext, shapeOrFieldSchema: PropertySchema, schemaPath?: SchemaPath): ObjectSchema;
|
|
195
|
-
export type GetNamespace = (
|
|
180
|
+
export type GetNamespace = (layerId: string) => Maybe<string>;
|
|
196
181
|
export declare function createGetNamespace(context: ServicesContext): GetNamespace;
|
|
197
|
-
export type PropertyRefItem = {
|
|
198
|
-
serviceId: string;
|
|
199
|
-
shapeName: string;
|
|
200
|
-
propertyName: string;
|
|
201
|
-
};
|
|
202
182
|
export declare function parsePropertyRef(refStr: string): Maybe<PropertyRefItem>;
|
|
203
|
-
export declare function serializePropertyRef({ shapeName, propertyName,
|
|
183
|
+
export declare function serializePropertyRef({ shapeName, propertyName, layerId }: PropertyRefItem): string;
|
|
204
184
|
export declare function normalizePropertyRef(refStr: string): string;
|
|
205
185
|
export declare function propertyRefToShapeRef(propertyRef: string): string;
|
|
206
|
-
export declare function formatShapeRef(
|
|
186
|
+
export declare function formatShapeRef(layerId: string, shapeName: string): string;
|
|
207
187
|
export declare function applyNamespace(namespace: string | undefined, name: string): string;
|
|
208
188
|
export declare function propertyRefItemToResolverPath(getNamespace: GetNamespace, item: PropertyRefItem): string[];
|
|
209
189
|
export declare function propertyRefItemToArgsPath(getNamespace: GetNamespace, item: PropertyRefItem): string[];
|
|
210
|
-
export declare function propertyRefItemToLocalName(getNamespace: GetNamespace, item: PropertyRefItem): string;
|
|
211
|
-
export declare function queryRefToLocalName(context: ServicesContext, queryRef: string): string | undefined;
|
|
212
190
|
export declare function propertyRefItemToPath(getNamespace: GetNamespace, item: PropertyRefItem): string[];
|
|
213
191
|
export declare function propertyRefToArgs(projectSchema: ProjectSchemaJSON, ref: string | PropertyRefItem): Maybe<Args>;
|
|
214
192
|
/**
|
|
@@ -224,7 +202,8 @@ export type QueryEntry = {
|
|
|
224
202
|
};
|
|
225
203
|
export declare function getQuery(projectSchema: Pick<ProjectSchemaJSON, 'services' | 'shapes' | 'queries' | 'mutations'>, queryRef: string): Maybe<QueryEntry>;
|
|
226
204
|
export declare function ensureQuery(projectSchema: ProjectSchemaJSON, queryRef: string): QueryEntry;
|
|
227
|
-
export declare function normalizeRefs(projectSchema: ProjectSchemaJSON
|
|
205
|
+
export declare function normalizeRefs(projectSchema: ProjectSchemaJSON): ProjectSchemaJSON;
|
|
206
|
+
export declare function normalizeRefs(projectSchema: ProjectSchemaJSON, property?: PropertySchema): PropertySchema;
|
|
228
207
|
/**
|
|
229
208
|
* Get a ShapeJSON from a RefItem, with the schema dereferenced.
|
|
230
209
|
*/
|