@takeshape/schema 11.73.0 → 11.76.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/builtin-schema.js +1 -0
- package/dist/models/runtime-schema.js +1 -0
- package/dist/project-schema/latest.d.ts +6 -1
- package/dist/project-schema/v3.48.0.d.ts +6 -1
- package/dist/project-schema/v3.49.0.d.ts +6 -1
- package/dist/project-schema/v3.50.0.d.ts +6 -1
- package/dist/project-schema/v3.51.0.d.ts +6 -1
- package/dist/project-schema/v3.52.0.d.ts +6 -1
- package/dist/project-schema/v3.53.0.d.ts +6 -1
- package/dist/project-schema/v3.54.0.d.ts +6 -1
- package/dist/schemas/project-schema/experimental.json +20 -0
- package/dist/util/expressions.js +2 -2
- package/package.json +6 -6
- package/dist/__tests__/_examples.test.d.ts +0 -1
- package/dist/__tests__/_examples.test.js +0 -77
- package/dist/__tests__/agents.test.d.ts +0 -1
- package/dist/__tests__/agents.test.js +0 -163
- package/dist/__tests__/api-version.test.d.ts +0 -1
- package/dist/__tests__/api-version.test.js +0 -24
- package/dist/__tests__/builtin-schema.test.d.ts +0 -1
- package/dist/__tests__/builtin-schema.test.js +0 -18
- package/dist/__tests__/content-schema-transform.test.d.ts +0 -1
- package/dist/__tests__/content-schema-transform.test.js +0 -522
- package/dist/__tests__/create-input-schema.test.d.ts +0 -1
- package/dist/__tests__/create-input-schema.test.js +0 -184
- package/dist/__tests__/enum.test.d.ts +0 -1
- package/dist/__tests__/enum.test.js +0 -36
- package/dist/__tests__/flatten-templates.test.d.ts +0 -1
- package/dist/__tests__/flatten-templates.test.js +0 -40
- package/dist/__tests__/get-is-leaf.test.d.ts +0 -1
- package/dist/__tests__/get-is-leaf.test.js +0 -50
- package/dist/__tests__/interfaces.test.d.ts +0 -1
- package/dist/__tests__/interfaces.test.js +0 -219
- package/dist/__tests__/migration.test.d.ts +0 -1
- package/dist/__tests__/migration.test.js +0 -34
- package/dist/__tests__/mocks.test.d.ts +0 -1
- package/dist/__tests__/mocks.test.js +0 -24
- package/dist/__tests__/refs.test.d.ts +0 -1
- package/dist/__tests__/refs.test.js +0 -813
- package/dist/__tests__/relationships.test.d.ts +0 -1
- package/dist/__tests__/relationships.test.js +0 -638
- package/dist/__tests__/schema-transform.test.d.ts +0 -1
- package/dist/__tests__/schema-transform.test.js +0 -205
- package/dist/__tests__/schema-util.test.d.ts +0 -1
- package/dist/__tests__/schema-util.test.js +0 -1731
- package/dist/__tests__/service-dependencies.test.d.ts +0 -1
- package/dist/__tests__/service-dependencies.test.js +0 -360
- package/dist/__tests__/unions.test.d.ts +0 -1
- package/dist/__tests__/unions.test.js +0 -44
- package/dist/__tests__/validate.test.d.ts +0 -1
- package/dist/__tests__/validate.test.js +0 -1980
- package/dist/__tests__/workflows.test.d.ts +0 -3
- package/dist/__tests__/workflows.test.js +0 -149
- package/dist/layers/__tests__/layers.test.d.ts +0 -1
- package/dist/layers/__tests__/layers.test.js +0 -38
- package/dist/migration/to/__tests__/v3.10.0.test.d.ts +0 -1
- package/dist/migration/to/__tests__/v3.10.0.test.js +0 -90
- package/dist/migration/to/__tests__/v3.12.3.test.d.ts +0 -1
- package/dist/migration/to/__tests__/v3.12.3.test.js +0 -103
- package/dist/migration/to/__tests__/v3.17.test.d.ts +0 -1
- package/dist/migration/to/__tests__/v3.17.test.js +0 -71
- package/dist/migration/to/__tests__/v3.34.0.test.d.ts +0 -1
- package/dist/migration/to/__tests__/v3.34.0.test.js +0 -240
- package/dist/migration/to/__tests__/v3.39.0.test.d.ts +0 -1
- package/dist/migration/to/__tests__/v3.39.0.test.js +0 -116
- package/dist/migration/to/__tests__/v3.46.0.test.d.ts +0 -1
- package/dist/migration/to/__tests__/v3.46.0.test.js +0 -59
- package/dist/models/__tests__/fixtures.d.ts +0 -15
- package/dist/models/__tests__/fixtures.js +0 -56
- package/dist/models/__tests__/query.test.d.ts +0 -1
- package/dist/models/__tests__/query.test.js +0 -19
- package/dist/models/__tests__/runtime-schema.test.d.ts +0 -1
- package/dist/models/__tests__/runtime-schema.test.js +0 -43
- package/dist/models/__tests__/shape.test.d.ts +0 -1
- package/dist/models/__tests__/shape.test.js +0 -24
- package/dist/resolvers/ai/__tests__/rag-query.test.d.ts +0 -1
- package/dist/resolvers/ai/__tests__/rag-query.test.js +0 -49
- package/dist/services/__tests__/services.test.d.ts +0 -1
- package/dist/services/__tests__/services.test.js +0 -113
- package/dist/template-shapes/__tests__/index.test.d.ts +0 -1
- package/dist/template-shapes/__tests__/index.test.js +0 -40
- package/dist/template-shapes/__tests__/names.test.d.ts +0 -1
- package/dist/template-shapes/__tests__/names.test.js +0 -19
- package/dist/template-shapes/__tests__/templates.test.d.ts +0 -1
- package/dist/template-shapes/__tests__/templates.test.js +0 -80
- package/dist/template-shapes/__tests__/where.test.d.ts +0 -1
- package/dist/template-shapes/__tests__/where.test.js +0 -218
- package/dist/types/__tests__/utils.test.d.ts +0 -1
- package/dist/types/__tests__/utils.test.js +0 -159
- package/dist/util/__tests__/api-indexing.test.d.ts +0 -1
- package/dist/util/__tests__/api-indexing.test.js +0 -129
- package/dist/util/__tests__/detect-cycles.test.d.ts +0 -1
- package/dist/util/__tests__/detect-cycles.test.js +0 -193
- package/dist/util/__tests__/expressions.test.d.ts +0 -1
- package/dist/util/__tests__/expressions.test.js +0 -172
- package/dist/util/__tests__/find-shape-at-path.test.d.ts +0 -1
- package/dist/util/__tests__/find-shape-at-path.test.js +0 -41
- package/dist/util/__tests__/form-config.test.d.ts +0 -1
- package/dist/util/__tests__/form-config.test.js +0 -196
- package/dist/util/__tests__/get-return-shape.test.d.ts +0 -1
- package/dist/util/__tests__/get-return-shape.test.js +0 -27
- package/dist/util/__tests__/has-args.test.d.ts +0 -1
- package/dist/util/__tests__/has-args.test.js +0 -46
- package/dist/util/__tests__/merge.test.d.ts +0 -1
- package/dist/util/__tests__/merge.test.js +0 -1074
- package/dist/util/__tests__/patch-schema.test.d.ts +0 -1
- package/dist/util/__tests__/patch-schema.test.js +0 -82
- package/dist/util/__tests__/shapes.test.d.ts +0 -1
- package/dist/util/__tests__/shapes.test.js +0 -30
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { expect, test } from 'vitest';
|
|
2
|
-
import { createMockSchema } from "../../mocks.js";
|
|
3
|
-
import { normalizeForms } from "../form-config.js";
|
|
4
|
-
const projectSchema = createMockSchema('project-id', {
|
|
5
|
-
shapes: {
|
|
6
|
-
PostSeoMetaTags: {
|
|
7
|
-
id: 'PostSeoMetaTags',
|
|
8
|
-
name: 'PostSeoMetaTags',
|
|
9
|
-
title: 'PostSeoMetaTags',
|
|
10
|
-
schema: {
|
|
11
|
-
type: 'object',
|
|
12
|
-
properties: {
|
|
13
|
-
viewport: {
|
|
14
|
-
minLength: 0,
|
|
15
|
-
type: 'string',
|
|
16
|
-
title: 'Viewport',
|
|
17
|
-
'@mapping': 'shapedb:AObjectObject.hwoob0l_q'
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
PostSeo: {
|
|
23
|
-
id: 'PostSeo',
|
|
24
|
-
name: 'PostSeo',
|
|
25
|
-
title: 'Post Seo',
|
|
26
|
-
schema: {
|
|
27
|
-
type: 'object',
|
|
28
|
-
properties: {
|
|
29
|
-
documentTitle: {
|
|
30
|
-
minLength: 0,
|
|
31
|
-
type: 'string',
|
|
32
|
-
title: 'Document Title',
|
|
33
|
-
'@mapping': 'shapedb:PostSeo.hwZvb0l_q'
|
|
34
|
-
},
|
|
35
|
-
favicon: {
|
|
36
|
-
'@args': 'TSRelationshipArgs',
|
|
37
|
-
'@resolver': {
|
|
38
|
-
name: 'shapedb:getRelated',
|
|
39
|
-
service: 'shapedb'
|
|
40
|
-
},
|
|
41
|
-
'@ref': 'local:Asset',
|
|
42
|
-
'@input': { '@ref': 'local:TSRelationship' },
|
|
43
|
-
title: 'Favicon',
|
|
44
|
-
'@backreference': { enabled: true },
|
|
45
|
-
'@mapping': 'shapedb:PostSeo.8PWcKmdvb'
|
|
46
|
-
},
|
|
47
|
-
metaTags: {
|
|
48
|
-
title: 'Meta Tags',
|
|
49
|
-
'@ref': 'local:PostSeoMetaTags',
|
|
50
|
-
'@mapping': 'shapedb:PostSeo.rSZsienVNw'
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
PostSlider: {
|
|
56
|
-
id: 'PostSlider',
|
|
57
|
-
name: 'PostSlider',
|
|
58
|
-
title: 'Post Slider',
|
|
59
|
-
schema: {
|
|
60
|
-
type: 'object',
|
|
61
|
-
properties: {
|
|
62
|
-
image: {
|
|
63
|
-
title: 'Image',
|
|
64
|
-
'@mapping': 'shapedb:ProjectImagesSlider.ryus8FF64',
|
|
65
|
-
'@backreference': {
|
|
66
|
-
enabled: true
|
|
67
|
-
},
|
|
68
|
-
'@ref': 'local:Asset',
|
|
69
|
-
'@input': {
|
|
70
|
-
'@ref': 'local:TSRelationship'
|
|
71
|
-
},
|
|
72
|
-
'@args': 'TSRelationshipArgs',
|
|
73
|
-
'@resolver': {
|
|
74
|
-
name: 'shapedb:getRelated',
|
|
75
|
-
service: 'shapedb',
|
|
76
|
-
options: {
|
|
77
|
-
nullable: true
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
required: ['list']
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
Post: {
|
|
86
|
-
id: 'Post',
|
|
87
|
-
name: 'Post',
|
|
88
|
-
title: 'Post',
|
|
89
|
-
schema: {
|
|
90
|
-
type: 'object',
|
|
91
|
-
properties: {
|
|
92
|
-
title: {
|
|
93
|
-
minLength: 1,
|
|
94
|
-
type: 'string',
|
|
95
|
-
title: 'title',
|
|
96
|
-
'@mapping': 'shapedb:Post.7M3-Zj6IT'
|
|
97
|
-
},
|
|
98
|
-
body: {
|
|
99
|
-
minLength: 1,
|
|
100
|
-
type: 'string',
|
|
101
|
-
'@tag': 'mdx',
|
|
102
|
-
title: 'Block Canvas MDX',
|
|
103
|
-
'@mapping': 'shapedb:Post.cgPEfNcFq'
|
|
104
|
-
},
|
|
105
|
-
slider: {
|
|
106
|
-
title: 'Slider',
|
|
107
|
-
items: {
|
|
108
|
-
'@ref': 'local:PostSlider'
|
|
109
|
-
},
|
|
110
|
-
minItems: 1,
|
|
111
|
-
type: 'array',
|
|
112
|
-
'@mapping': 'shapedb:ProjectImages.r1-jLYtT4'
|
|
113
|
-
},
|
|
114
|
-
seo: {
|
|
115
|
-
title: 'Seo',
|
|
116
|
-
'@ref': 'local:PostSeo',
|
|
117
|
-
'@mapping': 'shapedb:Post.rSZscwVNw'
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
required: ['title', 'body']
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
workflows: {},
|
|
125
|
-
forms: {
|
|
126
|
-
Post: {
|
|
127
|
-
default: {
|
|
128
|
-
properties: {
|
|
129
|
-
title: { widget: 'singleLineText' },
|
|
130
|
-
body: { widget: 'wysiwygTextMdx' },
|
|
131
|
-
slider: {
|
|
132
|
-
widget: 'repeater',
|
|
133
|
-
properties: {
|
|
134
|
-
image: {
|
|
135
|
-
widget: 'image'
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
order: ['list']
|
|
139
|
-
},
|
|
140
|
-
seo: {
|
|
141
|
-
widget: 'object',
|
|
142
|
-
properties: {
|
|
143
|
-
documentTitle: { widget: 'singleLineText' },
|
|
144
|
-
favicon: { widget: 'relationship' },
|
|
145
|
-
metaTags: {
|
|
146
|
-
widget: 'object',
|
|
147
|
-
properties: {
|
|
148
|
-
viewport: { widget: 'singleLineText' }
|
|
149
|
-
},
|
|
150
|
-
order: ['viewport']
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
order: ['documentTitle', 'favicon', 'metaTags']
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
order: ['title', 'body', 'seo']
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
const expected = {
|
|
162
|
-
Post: projectSchema.forms?.Post,
|
|
163
|
-
PostSlider: {
|
|
164
|
-
default: {
|
|
165
|
-
order: ['list'],
|
|
166
|
-
properties: {
|
|
167
|
-
image: {
|
|
168
|
-
widget: 'image'
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
widget: 'repeater'
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
PostSeo: {
|
|
175
|
-
default: {
|
|
176
|
-
widget: 'object',
|
|
177
|
-
properties: {
|
|
178
|
-
documentTitle: { widget: 'singleLineText' },
|
|
179
|
-
favicon: { widget: 'relationship' }
|
|
180
|
-
},
|
|
181
|
-
order: ['documentTitle', 'favicon', 'metaTags']
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
PostSeoMetaTags: {
|
|
185
|
-
default: {
|
|
186
|
-
widget: 'object',
|
|
187
|
-
properties: {
|
|
188
|
-
viewport: { widget: 'singleLineText' }
|
|
189
|
-
},
|
|
190
|
-
order: ['viewport']
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
test('normalizeForms', () => {
|
|
195
|
-
expect(normalizeForms(projectSchema)).toEqual(expected);
|
|
196
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'vitest';
|
|
2
|
-
import shopifySchema from '@/examples/latest/pruned-shopify-product-schema.json';
|
|
3
|
-
import { getReturnShape } from "../get-return-shape.js";
|
|
4
|
-
describe('getReturnShape', () => {
|
|
5
|
-
test('query', () => {
|
|
6
|
-
expect(getReturnShape(shopifySchema, shopifySchema.queries.Shopify_products)).toEqual(shopifySchema.shapes.Shopify_ProductConnection);
|
|
7
|
-
// again from cache
|
|
8
|
-
expect(getReturnShape(shopifySchema, shopifySchema.queries.Shopify_products)).toEqual(shopifySchema.shapes.Shopify_ProductConnection);
|
|
9
|
-
});
|
|
10
|
-
test('property', () => {
|
|
11
|
-
const { collections } = shopifySchema.shapes.Shopify_Product.schema.properties;
|
|
12
|
-
expect(getReturnShape(shopifySchema, collections)).toEqual(shopifySchema.shapes.Shopify_CollectionConnection);
|
|
13
|
-
// again from cache
|
|
14
|
-
expect(getReturnShape(shopifySchema, collections)).toEqual(shopifySchema.shapes.Shopify_CollectionConnection);
|
|
15
|
-
});
|
|
16
|
-
test('none found', () => {
|
|
17
|
-
const query = {
|
|
18
|
-
shape: 'Bogus',
|
|
19
|
-
resolver: {
|
|
20
|
-
name: 'util:noop'
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
expect(getReturnShape(shopifySchema, query)).toEqual(undefined);
|
|
24
|
-
// again from cache
|
|
25
|
-
expect(getReturnShape(shopifySchema, query)).toEqual(undefined);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'vitest';
|
|
2
|
-
import shopifySchema from '@/examples/latest/pruned-shopify-product-schema.json';
|
|
3
|
-
import { createMockSchema } from "../../mocks.js";
|
|
4
|
-
import { createShape } from "../../schema-util.js";
|
|
5
|
-
import { hasArg } from "../has-arg.js";
|
|
6
|
-
describe('hasArg', () => {
|
|
7
|
-
test('query inline args', () => {
|
|
8
|
-
expect(hasArg(shopifySchema, shopifySchema.queries.Shopify_products, 'first')).toBe(true);
|
|
9
|
-
expect(hasArg(shopifySchema, shopifySchema.queries.Shopify_products, 'bogus')).toBe(false);
|
|
10
|
-
});
|
|
11
|
-
test('property inline @args', () => {
|
|
12
|
-
const { collections } = shopifySchema.shapes.Shopify_Product.schema.properties;
|
|
13
|
-
expect(hasArg(shopifySchema, collections, 'first')).toBe(true);
|
|
14
|
-
expect(hasArg(shopifySchema, collections, 'bogus')).toBe(false);
|
|
15
|
-
});
|
|
16
|
-
test('query reference args', () => {
|
|
17
|
-
const projectSchema = createMockSchema('project-id', {
|
|
18
|
-
queries: {
|
|
19
|
-
getA: {
|
|
20
|
-
shape: 'A',
|
|
21
|
-
resolver: {
|
|
22
|
-
name: 'util:noop'
|
|
23
|
-
},
|
|
24
|
-
args: 'AArgs'
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
shapes: {
|
|
28
|
-
A: createShape('A', {
|
|
29
|
-
type: 'object',
|
|
30
|
-
properties: {
|
|
31
|
-
title: { type: 'string' }
|
|
32
|
-
},
|
|
33
|
-
required: ['title']
|
|
34
|
-
}),
|
|
35
|
-
AArgs: createShape('AArgs', {
|
|
36
|
-
type: 'object',
|
|
37
|
-
properties: {
|
|
38
|
-
locale: { type: 'string' }
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
expect(hasArg(projectSchema, projectSchema.queries.getA, 'locale')).toBe(true);
|
|
44
|
-
expect(hasArg(projectSchema, projectSchema.queries.getA, 'bogus')).toBe(false);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|