@contember/client-content 2.1.0-alpha.9 → 2.1.0-beta.1
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/CLAUDE.md +52 -0
- package/dist/development/src/ContentClient.cjs +12 -0
- package/dist/development/src/ContentClient.cjs.map +1 -1
- package/dist/development/src/ContentClient.js +12 -0
- package/dist/development/src/ContentClient.js.map +1 -1
- package/dist/development/src/ContentQueryBuilder.cjs +26 -15
- package/dist/development/src/ContentQueryBuilder.cjs.map +1 -1
- package/dist/development/src/ContentQueryBuilder.js +26 -15
- package/dist/development/src/ContentQueryBuilder.js.map +1 -1
- package/dist/development/src/MutationFailedError.cjs +11 -0
- package/dist/development/src/MutationFailedError.cjs.map +1 -0
- package/dist/development/src/MutationFailedError.js +11 -0
- package/dist/development/src/MutationFailedError.js.map +1 -0
- package/dist/development/src/nodes/ContentEntitySelection.cjs +47 -12
- package/dist/development/src/nodes/ContentEntitySelection.cjs.map +1 -1
- package/dist/development/src/nodes/ContentEntitySelection.js +47 -12
- package/dist/development/src/nodes/ContentEntitySelection.js.map +1 -1
- package/dist/development/src/nodes/ContentOperation.cjs.map +1 -1
- package/dist/development/src/nodes/ContentOperation.js.map +1 -1
- package/dist/development/src/utils/ContentOperationSet.cjs.map +1 -1
- package/dist/development/src/utils/ContentOperationSet.js.map +1 -1
- package/dist/development/src/utils/createListArgs.cjs.map +1 -1
- package/dist/development/src/utils/createListArgs.js.map +1 -1
- package/dist/development/src/utils/createMutationOperationSet.cjs +8 -6
- package/dist/development/src/utils/createMutationOperationSet.cjs.map +1 -1
- package/dist/development/src/utils/createMutationOperationSet.js +8 -6
- package/dist/development/src/utils/createMutationOperationSet.js.map +1 -1
- package/dist/development/src/utils/createQueryOperationSet.cjs.map +1 -1
- package/dist/development/src/utils/createQueryOperationSet.js.map +1 -1
- package/dist/development/src/utils/createTypedArgs.cjs.map +1 -1
- package/dist/development/src/utils/createTypedArgs.js.map +1 -1
- package/dist/development/src/utils/mutationFragments.cjs.map +1 -1
- package/dist/development/src/utils/mutationFragments.js.map +1 -1
- package/dist/production/src/ContentClient.cjs +12 -0
- package/dist/production/src/ContentClient.cjs.map +1 -1
- package/dist/production/src/ContentClient.js +12 -0
- package/dist/production/src/ContentClient.js.map +1 -1
- package/dist/production/src/ContentQueryBuilder.cjs +26 -15
- package/dist/production/src/ContentQueryBuilder.cjs.map +1 -1
- package/dist/production/src/ContentQueryBuilder.js +26 -15
- package/dist/production/src/ContentQueryBuilder.js.map +1 -1
- package/dist/production/src/MutationFailedError.cjs +11 -0
- package/dist/production/src/MutationFailedError.cjs.map +1 -0
- package/dist/production/src/MutationFailedError.js +11 -0
- package/dist/production/src/MutationFailedError.js.map +1 -0
- package/dist/production/src/nodes/ContentEntitySelection.cjs +47 -12
- package/dist/production/src/nodes/ContentEntitySelection.cjs.map +1 -1
- package/dist/production/src/nodes/ContentEntitySelection.js +47 -12
- package/dist/production/src/nodes/ContentEntitySelection.js.map +1 -1
- package/dist/production/src/nodes/ContentOperation.cjs.map +1 -1
- package/dist/production/src/nodes/ContentOperation.js.map +1 -1
- package/dist/production/src/utils/ContentOperationSet.cjs.map +1 -1
- package/dist/production/src/utils/ContentOperationSet.js.map +1 -1
- package/dist/production/src/utils/createListArgs.cjs.map +1 -1
- package/dist/production/src/utils/createListArgs.js.map +1 -1
- package/dist/production/src/utils/createMutationOperationSet.cjs +8 -6
- package/dist/production/src/utils/createMutationOperationSet.cjs.map +1 -1
- package/dist/production/src/utils/createMutationOperationSet.js +8 -6
- package/dist/production/src/utils/createMutationOperationSet.js.map +1 -1
- package/dist/production/src/utils/createQueryOperationSet.cjs.map +1 -1
- package/dist/production/src/utils/createQueryOperationSet.js.map +1 -1
- package/dist/production/src/utils/createTypedArgs.cjs.map +1 -1
- package/dist/production/src/utils/createTypedArgs.js.map +1 -1
- package/dist/production/src/utils/mutationFragments.cjs.map +1 -1
- package/dist/production/src/utils/mutationFragments.js.map +1 -1
- package/dist/types/ContentClient.d.ts +10 -0
- package/dist/types/ContentClient.d.ts.map +1 -1
- package/dist/types/ContentQueryBuilder.d.ts.map +1 -1
- package/dist/types/MutationFailedError.d.ts +13 -0
- package/dist/types/MutationFailedError.d.ts.map +1 -0
- package/dist/types/TypedContentQueryBuilder.d.ts.map +1 -1
- package/dist/types/nodes/ContentEntitySelection.d.ts +4 -1
- package/dist/types/nodes/ContentEntitySelection.d.ts.map +1 -1
- package/dist/types/nodes/TypedEntitySelection.d.ts +1 -0
- package/dist/types/nodes/TypedEntitySelection.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types/Input.d.ts.map +1 -1
- package/dist/types/types/Result.d.ts +30 -9
- package/dist/types/types/Result.d.ts.map +1 -1
- package/dist/types/utils/createListArgs.d.ts.map +1 -1
- package/dist/types/utils/createMutationOperationSet.d.ts.map +1 -1
- package/dist/types/utils/createQueryOperationSet.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/ContentClient.ts +36 -9
- package/src/ContentQueryBuilder.ts +45 -35
- package/src/MutationFailedError.ts +19 -0
- package/src/TypedContentQueryBuilder.ts +0 -4
- package/src/nodes/ContentEntitySelection.ts +67 -23
- package/src/nodes/TypedEntitySelection.ts +96 -48
- package/src/types/Input.ts +1 -9
- package/src/types/Result.ts +41 -9
- package/src/types/Schema.ts +0 -1
- package/src/utils/createListArgs.ts +5 -1
- package/src/utils/createMutationOperationSet.ts +9 -7
- package/src/utils/createQueryOperationSet.ts +0 -1
- package/tests/cases/unit/__snapshots__/mutation.test.ts.snap +952 -818
- package/tests/cases/unit/__snapshots__/query.test.ts.snap +216 -60
- package/tests/cases/unit/mutation.test.ts +48 -3
- package/tests/cases/unit/query.test.ts +103 -82
- package/tests/cases/unit/types.test.ts +31 -27
- package/tests/client/entities.ts +2 -0
- package/tests/client/enums.ts +5 -0
- package/tests/client/names.ts +129 -117
- package/tests/generate.ts +0 -1
- package/tests/lib.ts +0 -1
- package/tests/schema.ts +1 -2
package/tests/client/names.ts
CHANGED
|
@@ -1,117 +1,129 @@
|
|
|
1
|
-
import { SchemaNames } from '@contember/client-content'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
1
|
+
import type { SchemaNames, SchemaEntityNames } from '@contember/client-content'
|
|
2
|
+
import type { ContemberClientEntities } from './entities'
|
|
3
|
+
import type { ContemberClientEnums } from './enums'
|
|
4
|
+
export const ContemberClientNames = {
|
|
5
|
+
entities: {
|
|
6
|
+
"Locale": {
|
|
7
|
+
"name": "Locale",
|
|
8
|
+
"fields": {
|
|
9
|
+
"id": {
|
|
10
|
+
"type": "column"
|
|
11
|
+
},
|
|
12
|
+
"code": {
|
|
13
|
+
"type": "column"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"scalars": [
|
|
17
|
+
"id",
|
|
18
|
+
"code"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"Author": {
|
|
22
|
+
"name": "Author",
|
|
23
|
+
"fields": {
|
|
24
|
+
"id": {
|
|
25
|
+
"type": "column"
|
|
26
|
+
},
|
|
27
|
+
"name": {
|
|
28
|
+
"type": "column"
|
|
29
|
+
},
|
|
30
|
+
"email": {
|
|
31
|
+
"type": "column"
|
|
32
|
+
},
|
|
33
|
+
"posts": {
|
|
34
|
+
"type": "many",
|
|
35
|
+
"entity": "Post"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"scalars": [
|
|
39
|
+
"id",
|
|
40
|
+
"name",
|
|
41
|
+
"email"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"Post": {
|
|
45
|
+
"name": "Post",
|
|
46
|
+
"fields": {
|
|
47
|
+
"id": {
|
|
48
|
+
"type": "column"
|
|
49
|
+
},
|
|
50
|
+
"publishedAt": {
|
|
51
|
+
"type": "column"
|
|
52
|
+
},
|
|
53
|
+
"tags": {
|
|
54
|
+
"type": "many",
|
|
55
|
+
"entity": "Tag"
|
|
56
|
+
},
|
|
57
|
+
"author": {
|
|
58
|
+
"type": "one",
|
|
59
|
+
"entity": "Author"
|
|
60
|
+
},
|
|
61
|
+
"locales": {
|
|
62
|
+
"type": "many",
|
|
63
|
+
"entity": "PostLocale"
|
|
64
|
+
},
|
|
65
|
+
"status": {
|
|
66
|
+
"type": "column"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"scalars": [
|
|
70
|
+
"id",
|
|
71
|
+
"publishedAt",
|
|
72
|
+
"status"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"PostLocale": {
|
|
76
|
+
"name": "PostLocale",
|
|
77
|
+
"fields": {
|
|
78
|
+
"id": {
|
|
79
|
+
"type": "column"
|
|
80
|
+
},
|
|
81
|
+
"locale": {
|
|
82
|
+
"type": "one",
|
|
83
|
+
"entity": "Locale"
|
|
84
|
+
},
|
|
85
|
+
"title": {
|
|
86
|
+
"type": "column"
|
|
87
|
+
},
|
|
88
|
+
"content": {
|
|
89
|
+
"type": "column"
|
|
90
|
+
},
|
|
91
|
+
"post": {
|
|
92
|
+
"type": "one",
|
|
93
|
+
"entity": "Post"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"scalars": [
|
|
97
|
+
"id",
|
|
98
|
+
"title",
|
|
99
|
+
"content"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"Tag": {
|
|
103
|
+
"name": "Tag",
|
|
104
|
+
"fields": {
|
|
105
|
+
"id": {
|
|
106
|
+
"type": "column"
|
|
107
|
+
},
|
|
108
|
+
"name": {
|
|
109
|
+
"type": "column"
|
|
110
|
+
},
|
|
111
|
+
"posts": {
|
|
112
|
+
"type": "many",
|
|
113
|
+
"entity": "Post"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"scalars": [
|
|
117
|
+
"id",
|
|
118
|
+
"name"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
} satisfies {[K in keyof ContemberClientEntities]: SchemaEntityNames<K>},
|
|
122
|
+
enums: {
|
|
123
|
+
"PostStatus": [
|
|
124
|
+
"draft",
|
|
125
|
+
"published",
|
|
126
|
+
"archived"
|
|
127
|
+
]
|
|
128
|
+
} satisfies {[K in keyof ContemberClientEnums]: readonly ContemberClientEnums[K][]},
|
|
129
|
+
} satisfies SchemaNames
|
package/tests/generate.ts
CHANGED
package/tests/lib.ts
CHANGED
package/tests/schema.ts
CHANGED
|
@@ -5,7 +5,6 @@ namespace Schema {
|
|
|
5
5
|
code = c.stringColumn().unique().notNull()
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
export class Author {
|
|
10
9
|
name = c.stringColumn()
|
|
11
10
|
email = c.stringColumn()
|
|
@@ -17,6 +16,7 @@ namespace Schema {
|
|
|
17
16
|
tags = c.manyHasMany(Tag, 'posts')
|
|
18
17
|
author = c.manyHasOne(Author, 'posts')
|
|
19
18
|
locales = c.oneHasMany(PostLocale, 'post')
|
|
19
|
+
status = c.enumColumn(c.createEnum('draft', 'published', 'archived'))
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
@c.Unique('locale', 'post')
|
|
@@ -33,5 +33,4 @@ namespace Schema {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
36
|
export const schema = createSchema(Schema)
|