Renamed operations to handlers in usage

This commit is contained in:
Luis Alvarez 2021-05-20 21:05:56 -05:00
parent 35c5b1b4a3
commit 066a53d52d
18 changed files with 23 additions and 23 deletions

View File

@ -3,7 +3,7 @@ import { parseCartItem } from '../../utils/parse-item'
import getCartCookie from '../../utils/get-cart-cookie' import getCartCookie from '../../utils/get-cart-cookie'
import type { CartEndpoint } from '.' import type { CartEndpoint } from '.'
const addItem: CartEndpoint['operations']['addItem'] = async ({ const addItem: CartEndpoint['handlers']['addItem'] = async ({
res, res,
body: { cartId, item }, body: { cartId, item },
config, config,

View File

@ -5,7 +5,7 @@ import type { BigcommerceCart } from '../../../types'
import type { CartEndpoint } from '.' import type { CartEndpoint } from '.'
// Return current cart info // Return current cart info
const getCart: CartEndpoint['operations']['getCart'] = async ({ const getCart: CartEndpoint['handlers']['getCart'] = async ({
res, res,
body: { cartId }, body: { cartId },
config, config,

View File

@ -10,4 +10,4 @@ export type CartAPI = GetAPISchema<BigcommerceAPI, CartSchema>
export type CartEndpoint = CartAPI['endpoint'] export type CartEndpoint = CartAPI['endpoint']
export const operations = { getCart, addItem, updateItem, removeItem } export const handlers = { getCart, addItem, updateItem, removeItem }

View File

@ -2,7 +2,7 @@ import { normalizeCart } from '@framework/lib/normalize'
import getCartCookie from '../../utils/get-cart-cookie' import getCartCookie from '../../utils/get-cart-cookie'
import type { CartEndpoint } from '.' import type { CartEndpoint } from '.'
const removeItem: CartEndpoint['operations']['removeItem'] = async ({ const removeItem: CartEndpoint['handlers']['removeItem'] = async ({
res, res,
body: { cartId, itemId }, body: { cartId, itemId },
config, config,

View File

@ -3,7 +3,7 @@ import { parseCartItem } from '../../utils/parse-item'
import getCartCookie from '../../utils/get-cart-cookie' import getCartCookie from '../../utils/get-cart-cookie'
import type { CartEndpoint } from '.' import type { CartEndpoint } from '.'
const updateItem: CartEndpoint['operations']['updateItem'] = async ({ const updateItem: CartEndpoint['handlers']['updateItem'] = async ({
res, res,
body: { cartId, itemId, item }, body: { cartId, itemId, item },
config, config,

View File

@ -24,7 +24,7 @@ export const getLoggedInCustomerQuery = /* GraphQL */ `
export type Customer = NonNullable<GetLoggedInCustomerQuery['customer']> export type Customer = NonNullable<GetLoggedInCustomerQuery['customer']>
const getLoggedInCustomer: CustomerEndpoint['operations']['getLoggedInCustomer'] = async ({ const getLoggedInCustomer: CustomerEndpoint['handlers']['getLoggedInCustomer'] = async ({
req, req,
res, res,
config, config,

View File

@ -7,4 +7,4 @@ export type CustomerAPI = GetAPISchema<BigcommerceAPI, CustomerSchema>
export type CustomerEndpoint = CustomerAPI['endpoint'] export type CustomerEndpoint = CustomerAPI['endpoint']
export const operations = { getLoggedInCustomer } export const handlers = { getLoggedInCustomer }

View File

@ -7,4 +7,4 @@ export type LoginAPI = GetAPISchema<BigcommerceAPI, LoginSchema>
export type LoginEndpoint = LoginAPI['endpoint'] export type LoginEndpoint = LoginAPI['endpoint']
export const operations = { login } export const handlers = { login }

View File

@ -3,7 +3,7 @@ import type { LoginEndpoint } from '.'
const invalidCredentials = /invalid credentials/i const invalidCredentials = /invalid credentials/i
const login: LoginEndpoint['operations']['login'] = async ({ const login: LoginEndpoint['handlers']['login'] = async ({
res, res,
body: { email, password }, body: { email, password },
config, config,

View File

@ -7,4 +7,4 @@ export type LogoutAPI = GetAPISchema<BigcommerceAPI, LogoutSchema>
export type LogoutEndpoint = LogoutAPI['endpoint'] export type LogoutEndpoint = LogoutAPI['endpoint']
export const operations = { logout } export const handlers = { logout }

View File

@ -1,7 +1,7 @@
import { serialize } from 'cookie' import { serialize } from 'cookie'
import type { LogoutEndpoint } from '.' import type { LogoutEndpoint } from '.'
const logout: LogoutEndpoint['operations']['logout'] = async ({ const logout: LogoutEndpoint['handlers']['logout'] = async ({
res, res,
body: { redirectTo }, body: { redirectTo },
config, config,

View File

@ -7,4 +7,4 @@ export type SignupAPI = GetAPISchema<BigcommerceAPI, SignupSchema>
export type SignupEndpoint = SignupAPI['endpoint'] export type SignupEndpoint = SignupAPI['endpoint']
export const operations = { signup } export const handlers = { signup }

View File

@ -1,7 +1,7 @@
import { BigcommerceApiError } from '../../utils/errors' import { BigcommerceApiError } from '../../utils/errors'
import type { SignupEndpoint } from '.' import type { SignupEndpoint } from '.'
const signup: SignupEndpoint['operations']['signup'] = async ({ const signup: SignupEndpoint['handlers']['signup'] = async ({
res, res,
body: { firstName, lastName, email, password }, body: { firstName, lastName, email, password },
config, config,

View File

@ -1,8 +1,8 @@
import cart from '@commerce/api/endpoints/cart' import cart from '@commerce/api/endpoints/cart'
import { CartAPI, operations } from '@framework/api/endpoints/cart' import { CartAPI, handlers } from '@framework/api/endpoints/cart'
import commerce from '@lib/api/commerce' import commerce from '@lib/api/commerce'
export default commerce.endpoint({ export default commerce.endpoint({
handler: cart as CartAPI['endpoint']['handler'], handler: cart as CartAPI['endpoint']['handler'],
operations, handlers,
}) })

View File

@ -1,8 +1,8 @@
import customer from '@commerce/api/endpoints/customer' import customer from '@commerce/api/endpoints/customer'
import { CustomerAPI, operations } from '@framework/api/endpoints/customer' import { CustomerAPI, handlers } from '@framework/api/endpoints/customer'
import commerce from '@lib/api/commerce' import commerce from '@lib/api/commerce'
export default commerce.endpoint({ export default commerce.endpoint({
handler: customer as CustomerAPI['endpoint']['handler'], handler: customer as CustomerAPI['endpoint']['handler'],
operations, handlers,
}) })

View File

@ -1,8 +1,8 @@
import login from '@commerce/api/endpoints/login' import login from '@commerce/api/endpoints/login'
import { LoginAPI, operations } from '@framework/api/endpoints/login' import { LoginAPI, handlers } from '@framework/api/endpoints/login'
import commerce from '@lib/api/commerce' import commerce from '@lib/api/commerce'
export default commerce.endpoint({ export default commerce.endpoint({
handler: login as LoginAPI['endpoint']['handler'], handler: login as LoginAPI['endpoint']['handler'],
operations, handlers,
}) })

View File

@ -1,8 +1,8 @@
import logout from '@commerce/api/endpoints/logout' import logout from '@commerce/api/endpoints/logout'
import { LogoutAPI, operations } from '@framework/api/endpoints/logout' import { LogoutAPI, handlers } from '@framework/api/endpoints/logout'
import commerce from '@lib/api/commerce' import commerce from '@lib/api/commerce'
export default commerce.endpoint({ export default commerce.endpoint({
handler: logout as LogoutAPI['endpoint']['handler'], handler: logout as LogoutAPI['endpoint']['handler'],
operations, handlers,
}) })

View File

@ -1,8 +1,8 @@
import signup from '@commerce/api/endpoints/signup' import signup from '@commerce/api/endpoints/signup'
import { SignupAPI, operations } from '@framework/api/endpoints/signup' import { SignupAPI, handlers } from '@framework/api/endpoints/signup'
import commerce from '@lib/api/commerce' import commerce from '@lib/api/commerce'
export default commerce.endpoint({ export default commerce.endpoint({
handler: signup as SignupAPI['endpoint']['handler'], handler: signup as SignupAPI['endpoint']['handler'],
operations, handlers,
}) })