@platecms/delta-client 1.3.0 → 1.4.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/package.json +2 -2
- package/src/graphql/fragments/building-block-field-fullfillment.fragments.gql +35 -39
- package/src/graphql/path-parts/path-parts.query.gql +1 -3
- package/src/schema/index.spec.ts +9 -0
- package/src/schema/lib/schemas/array.spec.ts +1 -0
- package/src/schema/lib/schemas/contentItem.spec.ts +2 -2
- package/src/schema/lib/schemas/contentItem.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platecms/delta-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Utilities and functions to interact with the Delta CMS.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"src/**/*"
|
|
19
19
|
],
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@platecms/delta-cast": "1.
|
|
21
|
+
"@platecms/delta-cast": "1.4.0",
|
|
22
22
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
23
23
|
"graphql": "16.11.0",
|
|
24
24
|
"tslib": "2.8.1",
|
|
@@ -1,45 +1,41 @@
|
|
|
1
1
|
fragment buildingBlockFieldFulfillmentFragment on BuildingBlockFieldFulfillment {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
_id: prn
|
|
3
|
+
prn
|
|
4
|
+
contentValue {
|
|
5
|
+
...contentValueFragment
|
|
6
|
+
contentItem {
|
|
7
|
+
prn
|
|
8
|
+
}
|
|
9
|
+
...relatedAssetFragment
|
|
10
|
+
linkedPathPart {
|
|
11
|
+
...pathPartFragment
|
|
12
|
+
}
|
|
13
|
+
linkedGridPlacement {
|
|
14
|
+
...gridPlacementFragment
|
|
15
|
+
experienceComponent {
|
|
16
|
+
...experienceComponentFragment
|
|
17
|
+
buildingBlock {
|
|
18
|
+
...buildingBlockFragment
|
|
14
19
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
relatedContentItem {
|
|
23
|
+
...contentItemFragment
|
|
24
|
+
contentType {
|
|
25
|
+
...contentTypeFragment
|
|
26
|
+
contentFields {
|
|
27
|
+
...contentFieldFragment
|
|
23
28
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
...contentFieldFragment
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
contentValues {
|
|
33
|
-
...contentValueFragment
|
|
34
|
-
contentField {
|
|
35
|
-
...contentFieldFragment
|
|
36
|
-
}
|
|
37
|
-
relatedAsset {
|
|
38
|
-
...assetFragment
|
|
39
|
-
}
|
|
40
|
-
}
|
|
29
|
+
}
|
|
30
|
+
contentValues {
|
|
31
|
+
...contentValueFragment
|
|
32
|
+
contentField {
|
|
33
|
+
...contentFieldFragment
|
|
41
34
|
}
|
|
35
|
+
...relatedAssetFragment
|
|
36
|
+
}
|
|
42
37
|
}
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
}
|
|
39
|
+
createdAt
|
|
40
|
+
updatedAt
|
|
45
41
|
}
|
package/src/schema/index.spec.ts
CHANGED
|
@@ -8,12 +8,14 @@ const johnDoe: ContentItem = {
|
|
|
8
8
|
{
|
|
9
9
|
contentField: {
|
|
10
10
|
name: "name",
|
|
11
|
+
slug: "name",
|
|
11
12
|
},
|
|
12
13
|
primitiveValue: "John Doe",
|
|
13
14
|
},
|
|
14
15
|
{
|
|
15
16
|
contentField: {
|
|
16
17
|
name: "email",
|
|
18
|
+
slug: "email",
|
|
17
19
|
},
|
|
18
20
|
primitiveValue: "john.doe@example.com",
|
|
19
21
|
},
|
|
@@ -25,18 +27,21 @@ const broccoli: ContentItem = {
|
|
|
25
27
|
{
|
|
26
28
|
contentField: {
|
|
27
29
|
name: "name",
|
|
30
|
+
slug: "name",
|
|
28
31
|
},
|
|
29
32
|
primitiveValue: "Broccoli",
|
|
30
33
|
},
|
|
31
34
|
{
|
|
32
35
|
contentField: {
|
|
33
36
|
name: "calories",
|
|
37
|
+
slug: "calories",
|
|
34
38
|
},
|
|
35
39
|
primitiveValue: 200,
|
|
36
40
|
},
|
|
37
41
|
{
|
|
38
42
|
contentField: {
|
|
39
43
|
name: "author",
|
|
44
|
+
slug: "author",
|
|
40
45
|
},
|
|
41
46
|
relatedContentItem: johnDoe,
|
|
42
47
|
},
|
|
@@ -48,12 +53,14 @@ const carrot: ContentItem = {
|
|
|
48
53
|
{
|
|
49
54
|
contentField: {
|
|
50
55
|
name: "name",
|
|
56
|
+
slug: "name",
|
|
51
57
|
},
|
|
52
58
|
primitiveValue: "Carrot",
|
|
53
59
|
},
|
|
54
60
|
{
|
|
55
61
|
contentField: {
|
|
56
62
|
name: "calories",
|
|
63
|
+
slug: "calories",
|
|
57
64
|
},
|
|
58
65
|
primitiveValue: 100,
|
|
59
66
|
},
|
|
@@ -123,6 +130,7 @@ const experienceComponent: ExperienceComponent = {
|
|
|
123
130
|
contentFields: [
|
|
124
131
|
{
|
|
125
132
|
name: "title",
|
|
133
|
+
slug: "title",
|
|
126
134
|
},
|
|
127
135
|
],
|
|
128
136
|
},
|
|
@@ -203,6 +211,7 @@ describe("Schema", () => {
|
|
|
203
211
|
contentFields: [
|
|
204
212
|
{
|
|
205
213
|
name: "title",
|
|
214
|
+
slug: "title",
|
|
206
215
|
},
|
|
207
216
|
],
|
|
208
217
|
},
|
|
@@ -23,7 +23,7 @@ describe("ContentItem schema", () => {
|
|
|
23
23
|
contentValues: [
|
|
24
24
|
{
|
|
25
25
|
contentField: {
|
|
26
|
-
|
|
26
|
+
slug: "title",
|
|
27
27
|
},
|
|
28
28
|
primitiveValue: "hello",
|
|
29
29
|
},
|
|
@@ -46,7 +46,7 @@ describe("ContentItem schema", () => {
|
|
|
46
46
|
contentValues: [
|
|
47
47
|
{
|
|
48
48
|
contentField: {
|
|
49
|
-
|
|
49
|
+
slug: "title",
|
|
50
50
|
},
|
|
51
51
|
primitiveValue: "hello",
|
|
52
52
|
},
|
|
@@ -25,7 +25,7 @@ export class ContentItemSchema<T extends Record<string, Schema | Schema[]>>
|
|
|
25
25
|
const relatedContentItem = isContentValue(data) ? data.relatedContentItem : null;
|
|
26
26
|
|
|
27
27
|
const contentValuesForKey =
|
|
28
|
-
relatedContentItem?.contentValues.filter((contentValue) => contentValue.contentField?.
|
|
28
|
+
relatedContentItem?.contentValues.filter((contentValue) => contentValue.contentField?.slug === key) ?? [];
|
|
29
29
|
const shapes = Array.isArray(value) ? value : [value];
|
|
30
30
|
const parsedValues = shapes.map((shape) => shape.parse(contentValuesForKey, config));
|
|
31
31
|
|