我有两个具有相同架构的不同端点,我想从一个GraphQL端点读取所有数据,然后将其写入另一个。
https://graphcms.com/服务提供了一个端点,我最近基于https://strapi.io项目在AWS上设置了GraphQL服务器。我想避免使用graphcms上已经存在的数据手动填充新服务器,因此我希望编写两个graphql查询-一个查询以从graphcms端点读取所有节点,然后将其写入另一个端点。
这是目标服务器的完整架构(我只需要填充Microsite类型):
directive @cacheControl(
maxAge: Int
scope: CacheControlScope
) on FIELD_DEFINITION | OBJECT | INTERFACE
enum CacheControlScope {
PUBLIC
PRIVATE
}
input createMicrositeInput {
data: MicrositeInput
}
type createMicrositePayload {
microsite: Microsite
}
input createRoleInput {
data: RoleInput
}
type createRolePayload {
role: UsersPermissionsRole
}
input createUserInput {
data: UserInput
}
type createUserPayload {
user: UsersPermissionsUser
}
scalar DateTime
input deleteMicrositeInput {
where: InputID
}
type deleteMicrositePayload {
microsite: Microsite
}
input deleteRoleInput {
where: InputID
}
type deleteRolePayload {
role: UsersPermissionsRole
}
input deleteUserInput {
where: InputID
}
type deleteUserPayload {
user: UsersPermissionsUser
}
input editFileInput {
name: String
hash: String
sha256: String
ext: String
mime: String
size: String
url: String
provider: String
public_id: String
related: [ID]
}
input editMicrositeInput {
name: String
url: String
image: String
isVideo: Boolean
importance: Int
location: String
parent: ID
children: [ID]
}
input editRoleInput {
name: String
description: String
type: String
permissions: [ID]
users: [ID]
}
input editUserInput {
username: String
email: String
provider: String
password: String
resetPasswordToken: String
confirmed: Boolean
blocked: Boolean
role: ID
}
input FileInput {
name: String!
hash: String!
sha256: String
ext: String
mime: String!
size: String!
url: String!
provider: String!
public_id: String
related: [ID]
}
input InputID {
id: ID!
}
scalar JSON
scalar Long
type Microsite {
id: ID!
created_at: DateTime!
updated_at: DateTime!
name: String
url: String
image: String
isVideo: Boolean
importance: Int
location: String
parent: Microsite
children(sort: String, limit: Int, start: Int, where: JSON): [Microsite]
}
input MicrositeInput {
name: String
url: String
image: String
isVideo: Boolean
importance: Int
location: String
parent: ID
children: [ID]
}
union Morph =
UsersPermissionsMe
| UsersPermissionsMeRole
| Microsite
| createMicrositePayload
| updateMicrositePayload
| deleteMicrositePayload
| UploadFile
| UsersPermissionsPermission
| UsersPermissionsRole
| createRolePayload
| updateRolePayload
| deleteRolePayload
| UsersPermissionsUser
| createUserPayload
| updateUserPayload
| deleteUserPayload
type Mutation {
createMicrosite(input: createMicrositeInput): createMicrositePayload
updateMicrosite(input: updateMicrositeInput): updateMicrositePayload
deleteMicrosite(input: deleteMicrositeInput): deleteMicrositePayload
createRole(input: createRoleInput): createRolePayload
updateRole(input: updateRoleInput): updateRolePayload
deleteRole(input: deleteRoleInput): deleteRolePayload
createUser(input: createUserInput): createUserPayload
updateUser(input: updateUserInput): updateUserPayload
deleteUser(input: deleteUserInput): deleteUserPayload
upload(refId: ID, ref: String, source: String, file: Upload!): UploadFile!
}
type Query {
microsite(id: ID!): Microsite
microsites(sort: String, limit: Int, start: Int, where: JSON): [Microsite]
files(sort: String, limit: Int, start: Int, where: JSON): [UploadFile]
role(id: ID!): UsersPermissionsRole
roles(
sort: String
limit: Int
start: Int
where: JSON
): [UsersPermissionsRole]
user(id: ID!): UsersPermissionsUser
users(
sort: String
limit: Int
start: Int
where: JSON
): [UsersPermissionsUser]
me: UsersPermissionsMe
}
input RoleInput {
name: String!
description: String
type: String
permissions: [ID]
users: [ID]
}
input updateMicrositeInput {
where: InputID
data: editMicrositeInput
}
type updateMicrositePayload {
microsite: Microsite
}
input updateRoleInput {
where: InputID
data: editRoleInput
}
type updateRolePayload {
role: UsersPermissionsRole
}
input updateUserInput {
where: InputID
data: editUserInput
}
type updateUserPayload {
user: UsersPermissionsUser
}
scalar Upload
type UploadFile {
id: ID!
created_at: DateTime!
updated_at: DateTime!
name: String!
hash: String!
sha256: String
ext: String
mime: String!
size: String!
url: String!
provider: String!
public_id: String
related(sort: String, limit: Int, start: Int, where: JSON): [Morph]
}
input UserInput {
username: String!
email: String!
provider: String
password: String
resetPasswordToken: String
confirmed: Boolean
blocked: Boolean
role: ID
}
type UsersPermissionsMe {
_id: ID!
username: String!
email: String!
confirmed: Boolean
blocked: Boolean
role: UsersPermissionsMeRole
}
type UsersPermissionsMeRole {
_id: ID!
name: String!
description: String
type: String
}
type UsersPermissionsPermission {
id: ID!
type: String!
controller: String!
action: String!
enabled: Boolean!
policy: String
role: UsersPermissionsRole
}
type UsersPermissionsRole {
id: ID!
name: String!
description: String
type: String
permissions(
sort: String
limit: Int
start: Int
where: JSON
): [UsersPermissionsPermission]
users(
sort: String
limit: Int
start: Int
where: JSON
): [UsersPermissionsUser]
}
type UsersPermissionsUser {
id: ID!
created_at: DateTime!
updated_at: DateTime!
username: String!
email: String!
provider: String
confirmed: Boolean
blocked: Boolean
role: UsersPermissionsRole
}