From bbcf436aac60855b594f20bf4484a5680b93fac4 Mon Sep 17 00:00:00 2001 From: Gabriel Barros Date: Thu, 19 Oct 2023 15:09:51 -0300 Subject: [PATCH] Typings adjustments --- node/clients/index.ts | 2 +- node/middlewares/validateCreate.ts | 3 +- node/middlewares/validateUpdate.ts | 3 +- node/resolvers/addAffiliate.ts | 3 +- node/resolvers/fieldResolvers.ts | 2 +- node/resolvers/getAffiliateByEmail.ts | 3 +- node/resolvers/getAffiliateStoreName.ts | 3 +- node/resolvers/isAffiliateValid.ts | 3 +- node/resolvers/updateAffiliate.ts | 3 +- node/typings/affiliates.ts | 41 +++++++++++++++++++++++++ node/yarn.lock | 2 +- 11 files changed, 53 insertions(+), 15 deletions(-) diff --git a/node/clients/index.ts b/node/clients/index.ts index 1a05565..33418a5 100644 --- a/node/clients/index.ts +++ b/node/clients/index.ts @@ -1,7 +1,7 @@ import { IOClients } from '@vtex/api' import { masterDataFor } from '@vtex/clients' -import type { Affiliates, UserAffiliation } from 'vtex.affiliates' +import type { Affiliates, UserAffiliation } from '../typings/affiliates' import AuthenticationClient from './authenticationClient' import CheckoutExtended from './checkout' import IdentityClient from './IdentityClient' diff --git a/node/middlewares/validateCreate.ts b/node/middlewares/validateCreate.ts index 58dd335..6d566bb 100644 --- a/node/middlewares/validateCreate.ts +++ b/node/middlewares/validateCreate.ts @@ -1,7 +1,6 @@ import { json } from 'co-body' -import type { Affiliates } from 'vtex.affiliates' -import type { AffiliateInput } from '../typings/affiliates' +import type { Affiliates, AffiliateInput } from '../typings/affiliates' import { findDocumentsByField, isSlugValid } from '../utils/shared' export async function validateCreate( diff --git a/node/middlewares/validateUpdate.ts b/node/middlewares/validateUpdate.ts index 5913f95..17861ba 100644 --- a/node/middlewares/validateUpdate.ts +++ b/node/middlewares/validateUpdate.ts @@ -1,7 +1,6 @@ import { json } from 'co-body' -import type { Affiliates } from 'vtex.affiliates' -import type { AffiliateInput } from '../typings/affiliates' +import type { Affiliates, AffiliateInput } from '../typings/affiliates' import { findDocumentsByField, isSlugValid } from '../utils/shared' export async function validateUpdate( diff --git a/node/resolvers/addAffiliate.ts b/node/resolvers/addAffiliate.ts index d9d13d2..3b5fd07 100644 --- a/node/resolvers/addAffiliate.ts +++ b/node/resolvers/addAffiliate.ts @@ -1,6 +1,7 @@ -import type { Affiliates, MutationAddAffiliateArgs } from 'vtex.affiliates' +import type { MutationAddAffiliateArgs } from 'vtex.affiliates' import CustomGraphQLError from '@vtex/api/lib/errors/customGraphQLError' +import type { Affiliates } from '../typings/affiliates' import { findDocumentsByField, isSlugValid } from '../utils/shared' import type { Error } from './pushErrors' import { pushErrors } from './pushErrors' diff --git a/node/resolvers/fieldResolvers.ts b/node/resolvers/fieldResolvers.ts index 81babdc..c2c0519 100644 --- a/node/resolvers/fieldResolvers.ts +++ b/node/resolvers/fieldResolvers.ts @@ -1,4 +1,4 @@ -import type { Affiliates } from 'vtex.affiliates' +import type { Affiliates } from '../typings/affiliates' export const fieldResolvers = { Affiliate: { diff --git a/node/resolvers/getAffiliateByEmail.ts b/node/resolvers/getAffiliateByEmail.ts index 75b9c4d..4378eb0 100644 --- a/node/resolvers/getAffiliateByEmail.ts +++ b/node/resolvers/getAffiliateByEmail.ts @@ -1,5 +1,4 @@ -import type { Affiliates } from 'vtex.affiliates' - +import type { Affiliates } from '../typings/affiliates' import { findDocumentsByField } from '../utils/shared' type Props = { diff --git a/node/resolvers/getAffiliateStoreName.ts b/node/resolvers/getAffiliateStoreName.ts index e9c1187..b53c0d2 100644 --- a/node/resolvers/getAffiliateStoreName.ts +++ b/node/resolvers/getAffiliateStoreName.ts @@ -1,5 +1,4 @@ -import type { Affiliates } from 'vtex.affiliates' - +import type { Affiliates } from '../typings/affiliates' import { findDocumentsByField, isSlugValid } from '../utils/shared' type Props = { diff --git a/node/resolvers/isAffiliateValid.ts b/node/resolvers/isAffiliateValid.ts index 939e703..4b5938f 100644 --- a/node/resolvers/isAffiliateValid.ts +++ b/node/resolvers/isAffiliateValid.ts @@ -1,5 +1,4 @@ -import type { Affiliates } from 'vtex.affiliates' - +import type { Affiliates } from '../typings/affiliates' import { findDocumentsByField, isSlugValid } from '../utils/shared' type Props = { diff --git a/node/resolvers/updateAffiliate.ts b/node/resolvers/updateAffiliate.ts index b96dd93..7feef61 100644 --- a/node/resolvers/updateAffiliate.ts +++ b/node/resolvers/updateAffiliate.ts @@ -1,6 +1,7 @@ -import type { Affiliates, MutationUpdateAffiliateArgs } from 'vtex.affiliates' +import type { MutationUpdateAffiliateArgs } from 'vtex.affiliates' import CustomGraphQLError from '@vtex/api/lib/errors/customGraphQLError' +import type { Affiliates } from '../typings/affiliates' import { findDocumentsByField, isSlugValid } from '../utils/shared' import type { Error } from './pushErrors' import { pushErrors } from './pushErrors' diff --git a/node/typings/affiliates.ts b/node/typings/affiliates.ts index 08c5623..3719456 100644 --- a/node/typings/affiliates.ts +++ b/node/typings/affiliates.ts @@ -1,3 +1,5 @@ +export type Maybe = T | null + type Address = { city?: string complement?: string @@ -37,3 +39,42 @@ export type AffiliateLead = { export type GetOrderFormInput = { orderFormId: string } + +export interface Affiliates { + slug: string + name: string + storeName?: string + email: string + phone?: string + refId?: string + address?: { + city?: string + complement?: string + country?: string + neighborhood?: string + number?: string + postalCode?: string + reference?: string + state?: string + street?: string + [k: string]: unknown + } + document?: string + documentType?: string + isApproved: boolean + marketing?: { + instagram?: string + whatsapp?: string + facebook?: string + gtmId?: string + [k: string]: unknown + } + [k: string]: unknown +} + +export interface UserAffiliation { + email: string + affiliateId?: string + affiliateStartDate?: string + [k: string]: unknown +} diff --git a/node/yarn.lock b/node/yarn.lock index 5cf909b..2cfb8f2 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -5709,7 +5709,7 @@ static-extend@^0.1.1: define-property "^0.2.5" object-copy "^0.1.0" -"stats-lite@github:vtex/node-stats-lite#dist": +stats-lite@vtex/node-stats-lite#dist: version "2.2.0" resolved "https://codeload.github.com/vtex/node-stats-lite/tar.gz/1b0d39cc41ef7aaecfd541191f877887a2044797" dependencies: