Skip to content

Commit

Permalink
gqlToString (graphql/language) removed
Browse files Browse the repository at this point in the history
  • Loading branch information
vahdet committed May 5, 2019
1 parent 4b57a30 commit bcd3d88
Show file tree
Hide file tree
Showing 21 changed files with 74 additions and 96 deletions.
3 changes: 1 addition & 2 deletions src/components/auth/ForgotPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@

<script >
import { API, graphqlOperation, Auth, Logger } from 'aws-amplify'
import { print as gqlToString } from 'graphql/language'
import { mapActions } from 'vuex'
import { minUsernameLength, maxUsernameLength, minPasswordLength } from '@/utils/Constants'
import { CheckPassword } from '@/utils/Validator'
Expand Down Expand Up @@ -182,7 +181,7 @@ export default {
const token = await this.$recaptcha('login')
// Validate it
const validationGraphqlResult = await API.graphql(graphqlOperation(gqlToString(GetRecaptchaTokenResult), {
const validationGraphqlResult = await API.graphql(graphqlOperation(GetRecaptchaTokenResult, {
token
}))
Expand Down
5 changes: 2 additions & 3 deletions src/components/auth/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
<script>
import { Auth, API, Logger, graphqlOperation } from 'aws-amplify'
import { mapActions } from 'vuex'
import { print as gqlToString } from 'graphql/language'
import { GetUserProfileData, UpdateUserCognitoIdentityId } from '@/graphql/Profile'
import { minUsernameOrEmailLength, maxUsernameOrEmailLength, minPasswordLength } from '@/utils/Constants'
import { GetStoreUserWithCognitoIdentityId } from '@/utils/StorageObjectHelper'
Expand Down Expand Up @@ -111,7 +110,7 @@ export default {
const user = await Auth.signIn(this.username, this.password)
const credentials = await Auth.currentCredentials()
const dbUsers = await API.graphql(graphqlOperation(gqlToString(GetUserProfileData), {
const dbUsers = await API.graphql(graphqlOperation(GetUserProfileData, {
username: user.username
}))
Expand All @@ -120,7 +119,7 @@ export default {
// Update DB record of the logged in user with cognito identity id
const cognitoIdentityId = credentials.identityId
await API.graphql(graphqlOperation(gqlToString(UpdateUserCognitoIdentityId), {
await API.graphql(graphqlOperation(UpdateUserCognitoIdentityId, {
userId: dbUser.id,
cognitoIdentityId: cognitoIdentityId
}))
Expand Down
5 changes: 2 additions & 3 deletions src/components/comment/stream/StreamCommentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
<script>
import { mapGetters, mapMutations } from 'vuex'
import { API, graphqlOperation } from 'aws-amplify'
import { print as gqlToString } from 'graphql/language'
import { ListPaginatedStreamComments } from '@/graphql/StreamReaction'
import { GetElapsedTimeTillNow } from '@/utils/TimeUtils'
// import { GetElapsedTimeTillNow } from '@/utils/TimeUtils'
import { streamCommentFetchLength } from '@/utils/Constants'
import TafalkStreamComment from '@/components/comment/stream/StreamComment.vue'

Expand Down Expand Up @@ -86,7 +85,7 @@ export default {
if (this.paginatedStreamCommentNextToken == null) {
$state.complete()
} else {
const scrollEndNewFetchResult = await API.graphql(graphqlOperation(gqlToString(ListPaginatedStreamComments), {
const scrollEndNewFetchResult = await API.graphql(graphqlOperation(ListPaginatedStreamComments, {
streamId: this.stream.id,
limit: this.fetchLimit,
nextToken: this.paginatedStreamCommentNextToken
Expand Down
5 changes: 2 additions & 3 deletions src/components/flag/dialogs/FlagDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@
<script>
import { API, graphqlOperation, Logger } from 'aws-amplify'
import { mapGetters, mapMutations } from 'vuex'
import { print as gqlToString } from 'graphql/language'
import { CreateStreamFlag, CreateCommentFlag } from '@/graphql/Flag'
const logger = new Logger('FlagDialog')
Expand Down Expand Up @@ -302,7 +301,7 @@ export default {
if (this.flag.type === 'stream') {
console.log('flagging stream ' + this.flagId)
// stream flag
const flagGraphqlResult = await API.graphql(graphqlOperation(gqlToString(CreateStreamFlag), {
const flagGraphqlResult = await API.graphql(graphqlOperation(CreateStreamFlag, {
streamId: this.flag.streamId,
commentId: null,
userId: this.authenticatedUser.id,
Expand All @@ -317,7 +316,7 @@ export default {
this.setStream(currentStream)
} else if (this.flag.type === 'comment') {
// comment flag
await API.graphql(graphqlOperation(gqlToString(CreateCommentFlag), {
await API.graphql(graphqlOperation(CreateCommentFlag, {
streamId: null,
commentId: this.flag.commentId,
userId: this.authenticatedUser.id,
Expand Down
4 changes: 2 additions & 2 deletions src/components/flag/dialogs/RetractFlagConfirmationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<script>
import { mapGetters, mapActions, mapMutations } from 'vuex'
import { API, graphqlOperation, Logger } from 'aws-amplify'
import { print as gqlToString } from 'graphql/language'
import { DeleteFlag } from '@/graphql/Flag'
const logger = new Logger('RetractFlagConfirmationDialog')
Expand Down Expand Up @@ -51,7 +51,7 @@ export default {
}),
async onRetractFlagConfirmClick () {
try {
await API.graphql(graphqlOperation(gqlToString(DeleteFlag), {
await API.graphql(graphqlOperation(DeleteFlag, {
id: this.getRetractFlag.retractFlagId
}))
Expand Down
17 changes: 8 additions & 9 deletions src/components/home/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@

<script>
import { API, graphqlOperation } from 'aws-amplify'
import { print as gqlToString } from 'graphql/language'
import { mapGetters } from 'vuex'
import TafalkNewStreamFab from '@/components/home/buttons/NewStreamFab.vue'
import TafalkBriefStreamCard from '@/components/stream/cards/BriefStreamCard.vue'
Expand Down Expand Up @@ -142,21 +141,21 @@ export default {
this.pageReady = false
if (this.recentValue === val) {
const rawFetch = this.streamList = await API.graphql(graphqlOperation(gqlToString(ListSealedBriefStreams), {
const rawFetch = this.streamList = await API.graphql(graphqlOperation(ListSealedBriefStreams, {
limit: this.fetchLimit,
nextToken: null
}))
this.streamList = rawFetch.data.listSealedStreams.items
this.nextToken = rawFetch.data.listSealedStreams.nextToken
} else if (this.liveNowValue === val) {
const rawFetch = await API.graphql(graphqlOperation(gqlToString(ListLiveBriefStreams), {
const rawFetch = await API.graphql(graphqlOperation(ListLiveBriefStreams, {
limit: this.fetchLimit,
nextToken: null
}))
this.streamList = rawFetch.data.listLiveStreams.items
this.nextToken = rawFetch.data.listLiveStreams.nextToken
} else if (this.byFaveUsersValue === val) {
const rawFetch = await API.graphql(graphqlOperation(gqlToString(ListSealedBriefStreams), {
const rawFetch = await API.graphql(graphqlOperation(ListSealedBriefStreams, {
limit: this.fetchLimit,
nextToken: null
}))
Expand All @@ -167,7 +166,7 @@ export default {
/*
let countOfByFaveOthers = 0
while (countOfByFaveOthers < this.fetchLimit && this.nextToken != null) {
const rawNewFetch = await API.graphql(graphqlOperation(gqlToString(ListSealedBriefStreams), {
const rawNewFetch = await API.graphql(ListSealedBriefStreams, {
limit: this.fetchLimit,
nextToken: this.nextToken
}))
Expand Down Expand Up @@ -218,23 +217,23 @@ export default {
$state.complete()
} else {
if (this.footerEl === this.recentValue) {
const scrollEndNewFetch = await API.graphql(graphqlOperation(gqlToString(ListSealedBriefStreams), {
const scrollEndNewFetch = await API.graphql(graphqlOperation(ListSealedBriefStreams, {
limit: this.fetchLimit,
nextToken: this.nextToken
}))
this.streamList.push(...scrollEndNewFetch.data.listSealedStreams.items)
this.nextToken = scrollEndNewFetch.data.listSealedStreams.nextToken
$state.loaded()
} else if (this.footerEl === this.liveNowValue) {
const scrollEndNewFetch = await API.graphql(graphqlOperation(gqlToString(ListLiveBriefStreams), {
const scrollEndNewFetch = await API.graphql(graphqlOperation(ListLiveBriefStreams, {
limit: this.fetchLimit,
nextToken: this.nextToken
}))
this.streamList.push(...scrollEndNewFetch.data.listLiveStreams.items)
this.nextToken = scrollEndNewFetch.data.listLiveStreams.nextToken
$state.loaded()
} else if (this.footerEl === this.byFaveUsersValue) {
const scrollEndNewFetch = await API.graphql(graphqlOperation(gqlToString(ListSealedBriefStreams), {
const scrollEndNewFetch = await API.graphql(graphqlOperation(ListSealedBriefStreams, {
limit: this.fetchLimit,
nextToken: this.nextToken
}))
Expand All @@ -243,7 +242,7 @@ export default {
// If the filtered result is not enough fetch a new portion
let countOfByFaveOthers = 0
while (countOfByFaveOthers < this.fetchLimit && this.nextToken != null) {
const rawNewFetch = await API.graphql(graphqlOperation(gqlToString(ListSealedBriefStreams), {
const rawNewFetch = await API.graphql(graphqlOperation(ListSealedBriefStreams, {
limit: this.fetchLimit,
nextToken: this.nextToken
}))
Expand Down
11 changes: 5 additions & 6 deletions src/components/stream/Pour.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
<script>
import { API, graphqlOperation, Logger } from 'aws-amplify'
import { mapGetters, mapActions, mapMutations } from 'vuex'
import { print as gqlToString } from 'graphql/language'
import TafalkStreamAuthorizationRequired from '@/components/nocontent/AuthorizationRequired.vue'
import { CreateStream, UpdateStreamBody, UpdatePosition, UpdateMood, SealStreamForEver } from '@/graphql/Stream'
import TafalkStreamAddTitleDialog from '@/components/stream/dialogs/AddTitleDialog.vue'
Expand Down Expand Up @@ -190,7 +189,7 @@ export default {
// Old body is null or empty, so create the entry here
try {
this.processState = this.savingStateConstant
await API.graphql(graphqlOperation(gqlToString(CreateStream), {
await API.graphql(graphqlOperation(CreateStream, {
// Setting the optional values to null, because DynamoDB rejects empty strings -but accepts null anyway
id: this.streamId,
userId: this.authenticatedUserId,
Expand All @@ -216,7 +215,7 @@ export default {
// Update the entry
try {
this.processState = this.savingStateConstant
await API.graphql(graphqlOperation(gqlToString(UpdateStreamBody), {
await API.graphql(graphqlOperation(UpdateStreamBody, {
id: this.streamId,
body: newBody
}))
Expand Down Expand Up @@ -386,7 +385,7 @@ export default {
try {
this.processState = this.savingStateConstant
await API.graphql(graphqlOperation(gqlToString(UpdateMood), {
await API.graphql(graphqlOperation(UpdateMood, {
// Setting the optional values to null, because DynamoDB rejects empty strings -but accepts null anyway
id: this.streamId,
mood: (this.moodModel != null && this.moodModel.length > 0) ? this.moodModel.map(b => b.backendValue) : null
Expand All @@ -407,7 +406,7 @@ export default {
try {
this.processState = this.savingStateConstant
await API.graphql(graphqlOperation(gqlToString(UpdatePosition), {
await API.graphql(graphqlOperation(UpdatePosition, {
// Setting the optional values to null, because DynamoDB rejects empty strings -but accepts null anyway
id: this.streamId,
position: (this.positionModel != null && this.positionModel.length > 0) ? this.positionModel.map(b => b.backendValue) : null
Expand Down Expand Up @@ -439,7 +438,7 @@ export default {
// Check if nothing to seal
if (this.body != null && this.body.length > 0) {
try {
await API.graphql(graphqlOperation(gqlToString(SealStreamForEver), {
await API.graphql(graphqlOperation(SealStreamForEver, {
id: this.streamId,
title: this.title,
body: this.body,
Expand Down
21 changes: 10 additions & 11 deletions src/components/stream/Stream.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@

<script>
import { Storage, API, graphqlOperation, Logger } from 'aws-amplify'
import { print as gqlToString } from 'graphql/language'
import { mapGetters, mapMutations, mapActions } from 'vuex'
import { GetStream, OnUpdateStream } from '@/graphql/Stream'
import { ListStreamLikes, CreateLike, DeleteLike, OnCreateOrDeleteStreamLike, CreateComment, ListPaginatedStreamComments } from '@/graphql/StreamReaction'
Expand Down Expand Up @@ -349,8 +348,8 @@ export default {
}),
async getInitialInfo (streamId) {
try {
const streamGraphqlAsync = API.graphql(graphqlOperation(gqlToString(GetStream), { streamId }))
const paginatedCommentsGraphqlAsync = API.graphql(graphqlOperation(gqlToString(ListPaginatedStreamComments), {
const streamGraphqlAsync = API.graphql(graphqlOperation(GetStream, { streamId }))
const paginatedCommentsGraphqlAsync = API.graphql(graphqlOperation(ListPaginatedStreamComments, {
streamId: streamId,
limit: this.commentFetchLimit,
nextToken: null
Expand All @@ -371,7 +370,7 @@ export default {
// Subscribe to stream itself for live content changes
this.streamChangeSubscription = API.graphql(
graphqlOperation(gqlToString(OnUpdateStream), { id: this.stream.id })
graphqlOperation(OnUpdateStream, { id: this.stream.id })
).subscribe({
next: (eventData) => {
this.streamChange = eventData.value.data.onUpdateStream
Expand All @@ -381,19 +380,19 @@ export default {
// Subscribe to likes
this.likeChangeSubscription = API.graphql(
graphqlOperation(gqlToString(OnCreateOrDeleteStreamLike), { streamId: this.stream.id })
graphqlOperation(OnCreateOrDeleteStreamLike, { streamId: this.stream.id })
).subscribe({
next: async (eventData) => {
const graphqlLikeListResult = await API.graphql(
graphqlOperation(gqlToString(ListStreamLikes), { streamId: this.stream.id })
graphqlOperation(ListStreamLikes, { streamId: this.stream.id })
)
this.likeObjects = graphqlLikeListResult.data.listStreamLikes
// this.likeObjects = eventData.value.data.onCreateOrDeleteLike
},
error: (err) => this.setNewSiteError(err.message || err)
})
const graphqlConnectionsFromVisitedStreamAuthorToAuthenticatedUserResult = await API.graphql(graphqlOperation(gqlToString(GetInteractionsBetweenUsers), {
const graphqlConnectionsFromVisitedStreamAuthorToAuthenticatedUserResult = await API.graphql(graphqlOperation(GetInteractionsBetweenUsers, {
actorUserId: this.author.id,
targetUserId: this.authenticatedUser.id
}))
Expand All @@ -417,7 +416,7 @@ export default {
async onLikeClick () {
this.isLikeLoading = true
try {
await API.graphql(graphqlOperation(gqlToString(CreateLike), {
await API.graphql(graphqlOperation(CreateLike, {
streamId: this.stream.id,
userId: this.authenticatedUser.id,
time: new Date().toISOString()
Expand All @@ -432,7 +431,7 @@ export default {
async onRemoveLikeClick () {
this.isLikeLoading = true
try {
await API.graphql(graphqlOperation(gqlToString(DeleteLike), {
await API.graphql(graphqlOperation(DeleteLike, {
id: this.authenticatedUserLikeId
}))
} catch (err) {
Expand Down Expand Up @@ -472,7 +471,7 @@ export default {
// Yes, comments are not saved instantly. Braveness is not required for commenters.
this.isCommentLoading = true
try {
await API.graphql(graphqlOperation(gqlToString(CreateComment), {
await API.graphql(graphqlOperation(CreateComment, {
streamId: this.stream.id,
userId: this.authenticatedUser.id,
time: new Date().toISOString(),
Expand All @@ -481,7 +480,7 @@ export default {
this.setNewUserInteractionResultSuccess(this.$i18n.t('stream.comments.message.genericAddSuccess'))
// Load comments
const commentsGraphqlResult = await API.graphql(graphqlOperation(gqlToString(ListPaginatedStreamComments), {
const commentsGraphqlResult = await API.graphql(graphqlOperation(ListPaginatedStreamComments, {
streamId: this.stream.id,
limit: this.commentFetchLimit,
nextToken: null
Expand Down
3 changes: 1 addition & 2 deletions src/components/stream/cards/SlimProfileLikedStreamCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
<script>
import { mapGetters, mapActions } from 'vuex'
import { Storage, API, graphqlOperation, Logger } from 'aws-amplify'
import { print as gqlToString } from 'graphql/language'
import { DeleteLike } from '@/graphql/StreamReaction'
import { GetUserHue } from '@/utils/DefaultProfilePainter'
import { GetElapsedTimeTillNow, GetElapsedTimeBetween } from '@/utils/TimeUtils'
Expand Down Expand Up @@ -195,7 +194,7 @@ export default {
async unlikeStream () {
this.isLoading = true
try {
await API.graphql(graphqlOperation(gqlToString(DeleteLike), {
await API.graphql(graphqlOperation(DeleteLike, {
id: this.profileUserLikeId
}))
} catch (err) {
Expand Down
3 changes: 1 addition & 2 deletions src/components/stream/dialogs/AddTitleDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<script>
import { API, graphqlOperation, Logger } from 'aws-amplify'
import { mapGetters, mapMutations } from 'vuex'
import { print as gqlToString } from 'graphql/language'
import { UpdateStreamTitle } from '@/graphql/Stream'
import { GetKeyName } from '@/utils/IOUtils'
import { pourStrikethroughTimeToIdle } from '@/utils/Constants'
Expand Down Expand Up @@ -58,7 +57,7 @@ export default {
// Update the title, if body is not null
try {
this.processState = this.savingStateConstant
await API.graphql(graphqlOperation(gqlToString(UpdateStreamTitle), {
await API.graphql(graphqlOperation(UpdateStreamTitle, {
id: this.streamId,
title: newTitle
}))
Expand Down
7 changes: 3 additions & 4 deletions src/components/user/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@

<script>
import { API, graphqlOperation, Logger } from 'aws-amplify'
import { print as gqlToString } from 'graphql/language'
import { mapGetters, mapMutations, mapActions } from 'vuex'
import { GetUserProfileData } from '@/graphql/Profile'
import { GetInteractionsBetweenUsers } from '@/graphql/UserInteraction'
Expand Down Expand Up @@ -233,7 +232,7 @@ export default {
let visitedUserStoreObject = null
try {
const graphqlVisitedProfileResult = await API.graphql(graphqlOperation(gqlToString(GetUserProfileData), { username }))
const graphqlVisitedProfileResult = await API.graphql(graphqlOperation(GetUserProfileData, { username }))
const visitedUserDbResult = graphqlVisitedProfileResult.data.getUserByUsername[0]
if (!visitedUserDbResult) {
Expand All @@ -245,12 +244,12 @@ export default {
visitedUserStoreObject = await GetStoreUser(visitedUserDbResult)
// get connections
const graphqlConnectionsFromAuthenticatedUserToVisitedUserResult = await API.graphql(graphqlOperation(gqlToString(GetInteractionsBetweenUsers), {
const graphqlConnectionsFromAuthenticatedUserToVisitedUserResult = await API.graphql(graphqlOperation(GetInteractionsBetweenUsers, {
actorUserId: this.authenticatedUser.id,
targetUserId: visitedUserDbResult.id
}))
const graphqlConnectionsFromVisitedUserToAuthenticatedUserResult = await API.graphql(graphqlOperation(gqlToString(GetInteractionsBetweenUsers), {
const graphqlConnectionsFromVisitedUserToAuthenticatedUserResult = await API.graphql(graphqlOperation(GetInteractionsBetweenUsers, {
actorUserId: visitedUserDbResult.id,
targetUserId: this.authenticatedUser.id
}))
Expand Down
Loading

0 comments on commit bcd3d88

Please sign in to comment.