create-keystone-app 9.0.0 → 9.0.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/package.json
CHANGED
|
@@ -32,24 +32,43 @@ var import_fields = require("@keystone-6/core/fields");
|
|
|
32
32
|
var import_fields_document = require("@keystone-6/fields-document");
|
|
33
33
|
var lists = {
|
|
34
34
|
User: (0, import_core.list)({
|
|
35
|
+
// WARNING
|
|
36
|
+
// for this starter project, anyone can create, query, update and delete anything
|
|
37
|
+
// if you want to prevent random people on the internet from accessing your data,
|
|
38
|
+
// you can find out more at https://keystonejs.com/docs/guides/auth-and-access-control
|
|
35
39
|
access: import_access.allowAll,
|
|
40
|
+
// this is the fields for our User list
|
|
36
41
|
fields: {
|
|
42
|
+
// by adding isRequired, we enforce that every User should have a name
|
|
43
|
+
// if no name is provided, an error will be displayed
|
|
37
44
|
name: (0, import_fields.text)({ validation: { isRequired: true } }),
|
|
38
45
|
email: (0, import_fields.text)({
|
|
39
46
|
validation: { isRequired: true },
|
|
47
|
+
// by adding isIndexed: 'unique', we're saying that no user can have the same
|
|
48
|
+
// email as another user - this may or may not be a good idea for your project
|
|
40
49
|
isIndexed: "unique"
|
|
41
50
|
}),
|
|
42
51
|
password: (0, import_fields.password)({ validation: { isRequired: true } }),
|
|
52
|
+
// we can use this field to see what Posts this User has authored
|
|
53
|
+
// more on that in the Post list below
|
|
43
54
|
posts: (0, import_fields.relationship)({ ref: "Post.author", many: true }),
|
|
44
55
|
createdAt: (0, import_fields.timestamp)({
|
|
56
|
+
// this sets the timestamp to Date.now() when the user is first created
|
|
45
57
|
defaultValue: { kind: "now" }
|
|
46
58
|
})
|
|
47
59
|
}
|
|
48
60
|
}),
|
|
49
61
|
Post: (0, import_core.list)({
|
|
62
|
+
// WARNING
|
|
63
|
+
// for this starter project, anyone can create, query, update and delete anything
|
|
64
|
+
// if you want to prevent random people on the internet from accessing your data,
|
|
65
|
+
// you can find out more at https://keystonejs.com/docs/guides/auth-and-access-control
|
|
50
66
|
access: import_access.allowAll,
|
|
67
|
+
// this is the fields for our Post list
|
|
51
68
|
fields: {
|
|
52
69
|
title: (0, import_fields.text)({ validation: { isRequired: true } }),
|
|
70
|
+
// the document field can be used for making rich editable content
|
|
71
|
+
// you can find out more at https://keystonejs.com/docs/guides/document-fields
|
|
53
72
|
content: (0, import_fields_document.document)({
|
|
54
73
|
formatting: true,
|
|
55
74
|
layouts: [
|
|
@@ -62,8 +81,11 @@ var lists = {
|
|
|
62
81
|
links: true,
|
|
63
82
|
dividers: true
|
|
64
83
|
}),
|
|
84
|
+
// with this field, you can set a User as the author for a Post
|
|
65
85
|
author: (0, import_fields.relationship)({
|
|
86
|
+
// we could have used 'User', but then the relationship would only be 1-way
|
|
66
87
|
ref: "User.posts",
|
|
88
|
+
// this is some customisations for changing how this will look in the AdminUI
|
|
67
89
|
ui: {
|
|
68
90
|
displayMode: "cards",
|
|
69
91
|
cardFields: ["name", "email"],
|
|
@@ -71,11 +93,17 @@ var lists = {
|
|
|
71
93
|
linkToItem: true,
|
|
72
94
|
inlineConnect: true
|
|
73
95
|
},
|
|
96
|
+
// a Post can only have one author
|
|
97
|
+
// this is the default, but we show it here for verbosity
|
|
74
98
|
many: false
|
|
75
99
|
}),
|
|
100
|
+
// with this field, you can add some Tags to Posts
|
|
76
101
|
tags: (0, import_fields.relationship)({
|
|
102
|
+
// we could have used 'Tag', but then the relationship would only be 1-way
|
|
77
103
|
ref: "Tag.posts",
|
|
104
|
+
// a Post can have many Tags, not just one
|
|
78
105
|
many: true,
|
|
106
|
+
// this is some customisations for changing how this will look in the AdminUI
|
|
79
107
|
ui: {
|
|
80
108
|
displayMode: "cards",
|
|
81
109
|
cardFields: ["name"],
|
|
@@ -87,13 +115,21 @@ var lists = {
|
|
|
87
115
|
})
|
|
88
116
|
}
|
|
89
117
|
}),
|
|
118
|
+
// this last list is our Tag list, it only has a name field for now
|
|
90
119
|
Tag: (0, import_core.list)({
|
|
120
|
+
// WARNING
|
|
121
|
+
// for this starter project, anyone can create, query, update and delete anything
|
|
122
|
+
// if you want to prevent random people on the internet from accessing your data,
|
|
123
|
+
// you can find out more at https://keystonejs.com/docs/guides/auth-and-access-control
|
|
91
124
|
access: import_access.allowAll,
|
|
125
|
+
// setting this to isHidden for the user interface prevents this list being visible in the Admin UI
|
|
92
126
|
ui: {
|
|
93
127
|
isHidden: true
|
|
94
128
|
},
|
|
129
|
+
// this is the fields for our Tag list
|
|
95
130
|
fields: {
|
|
96
131
|
name: (0, import_fields.text)(),
|
|
132
|
+
// this can be helpful to find out all the Posts associated with a Tag
|
|
97
133
|
posts: (0, import_fields.relationship)({ ref: "Post.tags", many: true })
|
|
98
134
|
}
|
|
99
135
|
})
|
|
@@ -110,10 +146,20 @@ if (!sessionSecret && process.env.NODE_ENV !== "production") {
|
|
|
110
146
|
var { withAuth } = (0, import_auth.createAuth)({
|
|
111
147
|
listKey: "User",
|
|
112
148
|
identityField: "email",
|
|
149
|
+
// this is a GraphQL query fragment for fetching what data will be attached to a context.session
|
|
150
|
+
// this can be helpful for when you are writing your access control functions
|
|
151
|
+
// you can find out more at https://keystonejs.com/docs/guides/auth-and-access-control
|
|
113
152
|
sessionData: "name createdAt",
|
|
114
153
|
secretField: "password",
|
|
154
|
+
// WARNING: remove initFirstItem functionality in production
|
|
155
|
+
// see https://keystonejs.com/docs/config/auth#init-first-item for more
|
|
115
156
|
initFirstItem: {
|
|
157
|
+
// if there are no items in the database, by configuring this field
|
|
158
|
+
// you are asking the Keystone AdminUI to create a new user
|
|
159
|
+
// providing inputs for these fields
|
|
116
160
|
fields: ["name", "email", "password"]
|
|
161
|
+
// it uses context.sudo() to do this, which bypasses any access control you might have
|
|
162
|
+
// you shouldn't use this in production
|
|
117
163
|
}
|
|
118
164
|
});
|
|
119
165
|
var sessionMaxAge = 60 * 60 * 24 * 30;
|
|
@@ -126,6 +172,9 @@ var session = (0, import_session.statelessSessions)({
|
|
|
126
172
|
var keystone_default = withAuth(
|
|
127
173
|
(0, import_core2.config)({
|
|
128
174
|
db: {
|
|
175
|
+
// we're using sqlite for the fastest startup experience
|
|
176
|
+
// for more information on what database might be appropriate for you
|
|
177
|
+
// see https://keystonejs.com/docs/guides/choosing-a-database#title
|
|
129
178
|
provider: "sqlite",
|
|
130
179
|
url: "file:./keystone.db"
|
|
131
180
|
},
|
package/starter/package.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"dev": "keystone dev",
|
|
7
7
|
"start": "keystone start",
|
|
8
8
|
"build": "keystone build",
|
|
9
|
-
"postinstall": "keystone
|
|
9
|
+
"postinstall": "keystone build --no-ui --frozen"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@keystone-6/auth": "^
|
|
13
|
-
"@keystone-6/core": "^
|
|
14
|
-
"@keystone-6/fields-document": "^
|
|
15
|
-
"typescript": "^4.
|
|
12
|
+
"@keystone-6/auth": "^7.0.0",
|
|
13
|
+
"@keystone-6/core": "^5.0.0",
|
|
14
|
+
"@keystone-6/fields-document": "^7.0.0",
|
|
15
|
+
"typescript": "^4.9.5"
|
|
16
16
|
}
|
|
17
17
|
}
|
package/starter/schema.graphql
CHANGED
|
@@ -6,7 +6,7 @@ type User {
|
|
|
6
6
|
name: String
|
|
7
7
|
email: String
|
|
8
8
|
password: PasswordState
|
|
9
|
-
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0): [Post!]
|
|
9
|
+
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!]
|
|
10
10
|
postsCount(where: PostWhereInput! = {}): Int
|
|
11
11
|
createdAt: DateTime
|
|
12
12
|
}
|
|
@@ -139,7 +139,7 @@ type Post {
|
|
|
139
139
|
title: String
|
|
140
140
|
content: Post_content_Document
|
|
141
141
|
author: User
|
|
142
|
-
tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0): [Tag!]
|
|
142
|
+
tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!]
|
|
143
143
|
tagsCount(where: TagWhereInput! = {}): Int
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -217,7 +217,7 @@ input TagRelateToManyForCreateInput {
|
|
|
217
217
|
type Tag {
|
|
218
218
|
id: ID!
|
|
219
219
|
name: String
|
|
220
|
-
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0): [Post!]
|
|
220
|
+
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!]
|
|
221
221
|
postsCount(where: PostWhereInput! = {}): Int
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -301,13 +301,13 @@ input CreateInitialUserInput {
|
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
type Query {
|
|
304
|
-
users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0): [User!]
|
|
304
|
+
users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!]
|
|
305
305
|
user(where: UserWhereUniqueInput!): User
|
|
306
306
|
usersCount(where: UserWhereInput! = {}): Int
|
|
307
|
-
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0): [Post!]
|
|
307
|
+
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!]
|
|
308
308
|
post(where: PostWhereUniqueInput!): Post
|
|
309
309
|
postsCount(where: PostWhereInput! = {}): Int
|
|
310
|
-
tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0): [Tag!]
|
|
310
|
+
tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!]
|
|
311
311
|
tag(where: TagWhereUniqueInput!): Tag
|
|
312
312
|
tagsCount(where: TagWhereInput! = {}): Int
|
|
313
313
|
keystone: KeystoneMeta!
|
|
@@ -352,6 +352,7 @@ type KeystoneAdminUIFieldMeta {
|
|
|
352
352
|
description: String
|
|
353
353
|
isOrderable: Boolean!
|
|
354
354
|
isFilterable: Boolean!
|
|
355
|
+
isNonNull: [KeystoneAdminUIFieldMetaIsNonNull!]
|
|
355
356
|
fieldMeta: JSON
|
|
356
357
|
viewsIndex: Int!
|
|
357
358
|
customViewsIndex: Int
|
|
@@ -361,6 +362,12 @@ type KeystoneAdminUIFieldMeta {
|
|
|
361
362
|
search: QueryMode
|
|
362
363
|
}
|
|
363
364
|
|
|
365
|
+
enum KeystoneAdminUIFieldMetaIsNonNull {
|
|
366
|
+
read
|
|
367
|
+
create
|
|
368
|
+
update
|
|
369
|
+
}
|
|
370
|
+
|
|
364
371
|
type KeystoneAdminUIFieldMetaCreateView {
|
|
365
372
|
fieldMode: KeystoneAdminUIFieldMetaCreateViewFieldMode!
|
|
366
373
|
}
|