Skip to content

Commit

Permalink
refactor: split graphql definitions into two schemas (#1750)
Browse files Browse the repository at this point in the history
* refactor: split graphql definitions into two schemas

* fix: rename endpoints

* fix: config
  • Loading branch information
keellyp committed Sep 20, 2024
1 parent d43e5dc commit 2a26504
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
API_URL=http://localhost:3000
APP_ENV=development
CODEGEN_API=http://api.lago.dev/graphql
CODEGEN_API_CUSTOMER_PORTAL=http://api.lago.dev/customer_portal/graphql
CODEGEN_API_GRAPHQL=http://api.lago.dev/api/graphql
CYPRESS_APP_URL=https://app.lago.dev
GOCARDLESS_CLIENT_ID=__YOUR_GOCARDLESS_CLIENT_ID__
GOCARDLESS_CLIENT_SECRET=__YOUR_GOCARDLESS_SECRET__
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ jobs:

- name: Run codegen
env:
CODEGEN_API: http://localhost:3000/graphql
CODEGEN_API_CUSTOMER_PORTAL: http://localhost:3000/customer_portal/graphql
CODEGEN_API_GRAPHQL: http://localhost:3000/api/graphql
run: |
yarn codegen
- name: Run Typescript
Expand Down
3 changes: 2 additions & 1 deletion codegen.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
overwrite: true
schema:
- ${CODEGEN_API}
- ${CODEGEN_API_CUSTOMER_PORTAL}
- ${CODEGEN_API_GRAPHQL}
- './src/core/apolloClient/graphqlResolvers.tsx'
documents: ['src/**/*.tsx', 'src/**/*.ts']
generates:
Expand Down
62 changes: 60 additions & 2 deletions src/generated/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,19 @@ export type CreateDataExportsInvoicesInput = {
resourceType: ExportTypeEnum;
};

/** Autogenerated input type of CreateHubspotIntegration */
export type CreateHubspotIntegrationInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
code: Scalars['String']['input'];
connectionId: Scalars['String']['input'];
defaultTargetedObject: TargetedObjectsEnum;
name: Scalars['String']['input'];
privateAppToken: Scalars['String']['input'];
syncInvoices?: InputMaybe<Scalars['Boolean']['input']>;
syncSubscriptions?: InputMaybe<Scalars['Boolean']['input']>;
};

/** Autogenerated input type of CreateIntegrationCollectionMapping */
export type CreateIntegrationCollectionMappingInput = {
/** A unique identifier for the client performing the mutation. */
Expand Down Expand Up @@ -2472,6 +2485,18 @@ export type GroupedChargeUsage = {
units: Scalars['Float']['output'];
};

export type HubspotIntegration = {
__typename?: 'HubspotIntegration';
code: Scalars['String']['output'];
connectionId: Scalars['ID']['output'];
defaultTargetedObject: TargetedObjectsEnum;
id: Scalars['ID']['output'];
name: Scalars['String']['output'];
privateAppToken: Scalars['String']['output'];
syncInvoices?: Maybe<Scalars['Boolean']['output']>;
syncSubscriptions?: Maybe<Scalars['Boolean']['output']>;
};

export type Integration = AnrokIntegration | NetsuiteIntegration | OktaIntegration | XeroIntegration;

/** IntegrationCollection type */
Expand Down Expand Up @@ -2922,6 +2947,8 @@ export type Mutation = {
createCustomerWallet?: Maybe<Wallet>;
/** Creates a new Customer Wallet Transaction */
createCustomerWalletTransaction?: Maybe<WalletTransactionCollection>;
/** Create Hubspot integration */
createHubspotIntegration?: Maybe<HubspotIntegration>;
/** Create integration collection mapping */
createIntegrationCollectionMapping?: Maybe<CollectionMapping>;
/** Create integration mapping */
Expand Down Expand Up @@ -3064,6 +3091,8 @@ export type Mutation = {
updateCustomerWallet?: Maybe<Wallet>;
/** Update Gocardless payment provider */
updateGocardlessPaymentProvider?: Maybe<GocardlessProvider>;
/** Update Hubspot integration */
updateHubspotIntegration?: Maybe<HubspotIntegration>;
/** Update integration mapping */
updateIntegrationCollectionMapping?: Maybe<CollectionMapping>;
/** Update integration mapping */
Expand Down Expand Up @@ -3169,6 +3198,11 @@ export type MutationCreateCustomerWalletTransactionArgs = {
};


export type MutationCreateHubspotIntegrationArgs = {
input: CreateHubspotIntegrationInput;
};


export type MutationCreateIntegrationCollectionMappingArgs = {
input: CreateIntegrationCollectionMappingInput;
};
Expand Down Expand Up @@ -3529,6 +3563,11 @@ export type MutationUpdateGocardlessPaymentProviderArgs = {
};


export type MutationUpdateHubspotIntegrationArgs = {
input: UpdateHubspotIntegrationInput;
};


export type MutationUpdateIntegrationCollectionMappingArgs = {
input: UpdateIntegrationCollectionMappingInput;
};
Expand Down Expand Up @@ -4672,6 +4711,11 @@ export type SyncIntegrationInvoicePayload = {
invoiceId?: Maybe<Scalars['ID']['output']>;
};

export enum TargetedObjectsEnum {
Companies = 'Companies',
Contacts = 'Contacts'
}

export type Tax = {
__typename?: 'Tax';
/** Number of add ons using this tax */
Expand Down Expand Up @@ -5173,6 +5217,20 @@ export type UpdateGocardlessPaymentProviderInput = {
successRedirectUrl?: InputMaybe<Scalars['String']['input']>;
};

/** Autogenerated input type of UpdateHubspotIntegration */
export type UpdateHubspotIntegrationInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
code?: InputMaybe<Scalars['String']['input']>;
connectionId?: InputMaybe<Scalars['String']['input']>;
defaultTargetedObject?: InputMaybe<TargetedObjectsEnum>;
id?: InputMaybe<Scalars['ID']['input']>;
name?: InputMaybe<Scalars['String']['input']>;
privateAppToken?: InputMaybe<Scalars['String']['input']>;
syncInvoices?: InputMaybe<Scalars['Boolean']['input']>;
syncSubscriptions?: InputMaybe<Scalars['Boolean']['input']>;
};

/** Autogenerated input type of UpdateIntegrationCollectionMapping */
export type UpdateIntegrationCollectionMappingInput = {
/** A unique identifier for the client performing the mutation. */
Expand Down Expand Up @@ -17287,8 +17345,8 @@ export function useGetSubscriptionForSubscriptionUsageLifetimeGraphLazyQuery(bas
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<GetSubscriptionForSubscriptionUsageLifetimeGraphQuery, GetSubscriptionForSubscriptionUsageLifetimeGraphQueryVariables>(GetSubscriptionForSubscriptionUsageLifetimeGraphDocument, options);
}
export function useGetSubscriptionForSubscriptionUsageLifetimeGraphSuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions<GetSubscriptionForSubscriptionUsageLifetimeGraphQuery, GetSubscriptionForSubscriptionUsageLifetimeGraphQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
export function useGetSubscriptionForSubscriptionUsageLifetimeGraphSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<GetSubscriptionForSubscriptionUsageLifetimeGraphQuery, GetSubscriptionForSubscriptionUsageLifetimeGraphQueryVariables>) {
const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions}
return Apollo.useSuspenseQuery<GetSubscriptionForSubscriptionUsageLifetimeGraphQuery, GetSubscriptionForSubscriptionUsageLifetimeGraphQueryVariables>(GetSubscriptionForSubscriptionUsageLifetimeGraphDocument, options);
}
export type GetSubscriptionForSubscriptionUsageLifetimeGraphQueryHookResult = ReturnType<typeof useGetSubscriptionForSubscriptionUsageLifetimeGraphQuery>;
Expand Down

0 comments on commit 2a26504

Please sign in to comment.