@accounter/server 0.0.8-alpha-20251105180132-1c81096625a160ce926416f8206cb74fcf4f769f → 0.0.8-alpha-20251105183654-b3147b83bfda6ce62d09073ce81342ceadf5160c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +25 -15
  2. package/dist/green-invoice-graphql/src/mesh-artifacts/index.js +2 -2
  3. package/dist/green-invoice-graphql/src/mesh-artifacts/index.js.map +1 -1
  4. package/dist/server/src/__generated__/types.d.ts +39 -10
  5. package/dist/server/src/__generated__/types.js.map +1 -1
  6. package/dist/server/src/modules/financial-entities/__generated__/clients.types.d.ts +11 -4
  7. package/dist/server/src/modules/financial-entities/__generated__/types.d.ts +19 -7
  8. package/dist/server/src/modules/financial-entities/__generated__/types.js.map +1 -1
  9. package/dist/server/src/modules/financial-entities/helpers/clients.helper.d.ts +11 -0
  10. package/dist/server/src/modules/financial-entities/helpers/clients.helper.js +26 -0
  11. package/dist/server/src/modules/financial-entities/helpers/clients.helper.js.map +1 -0
  12. package/dist/server/src/modules/financial-entities/providers/businesses.provider.js +1 -1
  13. package/dist/server/src/modules/financial-entities/providers/clients.provider.js +18 -16
  14. package/dist/server/src/modules/financial-entities/providers/clients.provider.js.map +1 -1
  15. package/dist/server/src/modules/financial-entities/resolvers/clients.resolvers.js +26 -24
  16. package/dist/server/src/modules/financial-entities/resolvers/clients.resolvers.js.map +1 -1
  17. package/dist/server/src/modules/financial-entities/typeDefs/clients.graphql.js +24 -8
  18. package/dist/server/src/modules/financial-entities/typeDefs/clients.graphql.js.map +1 -1
  19. package/dist/server/src/modules/green-invoice/__generated__/types.d.ts +8 -0
  20. package/dist/server/src/modules/green-invoice/__generated__/types.js.map +1 -1
  21. package/dist/server/src/modules/green-invoice/helpers/contract-to-draft.helper.d.ts +3 -1
  22. package/dist/server/src/modules/green-invoice/helpers/contract-to-draft.helper.js +5 -12
  23. package/dist/server/src/modules/green-invoice/helpers/contract-to-draft.helper.js.map +1 -1
  24. package/dist/server/src/modules/green-invoice/helpers/green-invoice-clients.helper.d.ts +1 -2
  25. package/dist/server/src/modules/green-invoice/helpers/green-invoice-clients.helper.js +17 -31
  26. package/dist/server/src/modules/green-invoice/helpers/green-invoice-clients.helper.js.map +1 -1
  27. package/dist/server/src/modules/green-invoice/helpers/green-invoice.helper.d.ts +2 -2
  28. package/dist/server/src/modules/green-invoice/helpers/green-invoice.helper.js +16 -14
  29. package/dist/server/src/modules/green-invoice/helpers/green-invoice.helper.js.map +1 -1
  30. package/dist/server/src/modules/green-invoice/resolvers/green-invoice.resolvers.js +89 -28
  31. package/dist/server/src/modules/green-invoice/resolvers/green-invoice.resolvers.js.map +1 -1
  32. package/dist/server/src/modules/green-invoice/typeDefs/green-invoice.graphql.js +4 -0
  33. package/dist/server/src/modules/green-invoice/typeDefs/green-invoice.graphql.js.map +1 -1
  34. package/package.json +6 -6
  35. package/src/__generated__/types.ts +42 -10
  36. package/src/modules/financial-entities/__generated__/clients.types.ts +10 -4
  37. package/src/modules/financial-entities/__generated__/types.ts +19 -7
  38. package/src/modules/financial-entities/helpers/clients.helper.ts +28 -0
  39. package/src/modules/financial-entities/providers/businesses.provider.ts +1 -1
  40. package/src/modules/financial-entities/providers/clients.provider.ts +19 -16
  41. package/src/modules/financial-entities/resolvers/clients.resolvers.ts +30 -27
  42. package/src/modules/financial-entities/typeDefs/clients.graphql.ts +24 -8
  43. package/src/modules/green-invoice/__generated__/types.ts +8 -0
  44. package/src/modules/green-invoice/helpers/contract-to-draft.helper.ts +7 -13
  45. package/src/modules/green-invoice/helpers/green-invoice-clients.helper.ts +19 -40
  46. package/src/modules/green-invoice/helpers/green-invoice.helper.ts +17 -18
  47. package/src/modules/green-invoice/resolvers/green-invoice.resolvers.ts +99 -34
  48. package/src/modules/green-invoice/typeDefs/green-invoice.graphql.ts +4 -0
@@ -5,51 +5,16 @@ import {
5
5
  } from '@accounter/green-invoice-graphql';
6
6
  import { GreenInvoiceClientProvider } from '@modules/app-providers/green-invoice-client.js';
7
7
  import { CountryCode } from '@modules/countries/types.js';
8
+ import { validateClientIntegrations } from '@modules/financial-entities/helpers/clients.helper.js';
8
9
  import { BusinessesProvider } from '@modules/financial-entities/providers/businesses.provider.js';
9
10
  import { ClientsProvider } from '@modules/financial-entities/providers/clients.provider.js';
10
11
  import {
11
12
  IGetBusinessesByIdsResult,
12
13
  IGetClientsByIdsResult,
13
14
  } from '@modules/financial-entities/types.js';
14
- import { ClientUpdateInput, GreenInvoiceClient, UpdateBusinessInput } from '@shared/gql-types';
15
+ import { ClientUpdateInput, UpdateBusinessInput } from '@shared/gql-types';
15
16
  import { countryCodeToGreenInvoiceCountry } from './green-invoice.helper.js';
16
17
 
17
- export async function getClientFromGreenInvoiceClient(
18
- injector: Injector,
19
- businessId: string,
20
- useGreenInvoiceId = false,
21
- ): Promise<GreenInvoiceClient | undefined> {
22
- const client = await injector.get(ClientsProvider).getClientByIdLoader.load(businessId);
23
- if (!client?.green_invoice_id) {
24
- return useGreenInvoiceId ? undefined : { id: businessId };
25
- }
26
-
27
- const greenInvoiceClient = await injector
28
- .get(GreenInvoiceClientProvider)
29
- .clientLoader.load(client.green_invoice_id);
30
-
31
- if (!greenInvoiceClient) {
32
- return useGreenInvoiceId ? undefined : { id: businessId };
33
- }
34
-
35
- return {
36
- id: useGreenInvoiceId && greenInvoiceClient.id ? greenInvoiceClient.id : businessId,
37
- country: greenInvoiceClient.country,
38
- emails: [
39
- ...((greenInvoiceClient.emails?.filter(Boolean) as string[]) ?? []),
40
- 'ap@the-guild.dev',
41
- ],
42
- name: greenInvoiceClient.name,
43
- phone: greenInvoiceClient.phone,
44
- taxId: greenInvoiceClient.taxId,
45
- address: greenInvoiceClient.address,
46
- city: greenInvoiceClient.city,
47
- zip: greenInvoiceClient.zip,
48
- fax: greenInvoiceClient.fax,
49
- mobile: greenInvoiceClient.mobile,
50
- };
51
- }
52
-
53
18
  function convertLocalClientToGreenInvoiceCreateClientInput(
54
19
  localClient: IGetClientsByIdsResult,
55
20
  localBusiness: IGetBusinessesByIdsResult,
@@ -134,10 +99,15 @@ export async function addGreenInvoiceClient(clientId: string, injector: Injector
134
99
  throw new Error('Failed to create Green Invoice client');
135
100
  }
136
101
 
102
+ const integrations = validateClientIntegrations(localClient.integrations);
103
+
137
104
  // add green invoice id to local client
138
105
  await injector.get(ClientsProvider).updateClient({
139
106
  businessId: clientId,
140
- greenInvoiceId: greenInvoiceClient.id,
107
+ integrations: {
108
+ ...integrations,
109
+ greenInvoiceId: greenInvoiceClient.id,
110
+ },
141
111
  });
142
112
  } catch (error) {
143
113
  const message = 'Error adding Green Invoice client';
@@ -216,7 +186,16 @@ export async function updateGreenInvoiceClient(
216
186
  localBusinessPromise,
217
187
  localClientPromise,
218
188
  ]);
219
- if (!localBusiness?.name || !localClient?.green_invoice_id) {
189
+
190
+ let greenInvoiceId: string | undefined = undefined;
191
+ try {
192
+ greenInvoiceId =
193
+ validateClientIntegrations(localClient?.integrations ?? {}).greenInvoiceId ?? undefined;
194
+ } catch {
195
+ // swallow errors
196
+ return;
197
+ }
198
+ if (!localBusiness?.name || !greenInvoiceId) {
220
199
  // We cannot update a client in Green Invoice without its ID.
221
200
  console.warn(
222
201
  `Cannot update Green Invoice client: missing local business name or client ID for business${clientId}`,
@@ -233,7 +212,7 @@ export async function updateGreenInvoiceClient(
233
212
  }
234
213
 
235
214
  const greenInvoiceClient = await injector.get(GreenInvoiceClientProvider).updateClient({
236
- id: localClient.green_invoice_id,
215
+ id: greenInvoiceId,
237
216
  input: fieldsToUpdate,
238
217
  });
239
218
 
@@ -25,14 +25,15 @@ import { CountryCode } from '@modules/countries/types.js';
25
25
  import { DocumentsProvider } from '@modules/documents/providers/documents.provider.js';
26
26
  import { IssuedDocumentsProvider } from '@modules/documents/providers/issued-documents.provider.js';
27
27
  import type { document_status, IInsertDocumentsParams } from '@modules/documents/types';
28
+ import { validateClientIntegrations } from '@modules/financial-entities/helpers/clients.helper.js';
28
29
  import { ClientsProvider } from '@modules/financial-entities/providers/clients.provider.js';
29
30
  import {
30
31
  Currency,
31
32
  DocumentType,
32
33
  GreenInvoiceCountry,
33
34
  GreenInvoicePaymentType,
34
- NewDocumentInfo,
35
35
  NewDocumentInput,
36
+ ResolversTypes,
36
37
  type GreenInvoiceDiscountType,
37
38
  type GreenInvoiceDocumentLang,
38
39
  type GreenInvoiceLinkType,
@@ -1247,18 +1248,24 @@ export async function convertDocumentInputIntoGreenInvoiceInput(
1247
1248
  if (!clientInfo) {
1248
1249
  throw new GraphQLError(`Client with ID ${initialInput.client.id} not found`);
1249
1250
  }
1250
- if (!clientInfo.green_invoice_id) {
1251
+ let greenInvoiceId: string | null = null;
1252
+ try {
1253
+ greenInvoiceId =
1254
+ validateClientIntegrations(clientInfo.integrations ?? {}).greenInvoiceId ?? null;
1255
+ } catch (error) {
1256
+ console.error('Failed to validate client integrations', error);
1257
+ throw new GraphQLError(`Client with ID ${initialInput.client.id} has invalid integrations`);
1258
+ }
1259
+ if (!greenInvoiceId) {
1251
1260
  throw new GraphQLError(`Client with ID ${initialInput.client.id} not found in Green Invoice`);
1252
1261
  }
1253
1262
  const greenInvoiceClient = await injector
1254
1263
  .get(GreenInvoiceClientProvider)
1255
- .clientLoader.load(clientInfo.green_invoice_id);
1264
+ .clientLoader.load(greenInvoiceId);
1256
1265
  if (!greenInvoiceClient) {
1257
- throw new GraphQLError(
1258
- `Green Invoice client with ID ${clientInfo.green_invoice_id} not found`,
1259
- );
1266
+ throw new GraphQLError(`Green Invoice client with ID ${greenInvoiceId} not found`);
1260
1267
  }
1261
- const emails: (string | null)[] = ['ap@the-guild.dev'];
1268
+ const emails: (string | null)[] = ['ap@the-guild.dev']; // TODO: remove hardcoded email
1262
1269
  const inputEmails = initialInput.client?.emails?.filter(Boolean) ?? [];
1263
1270
  if (inputEmails.length) {
1264
1271
  emails.push(...inputEmails);
@@ -1266,7 +1273,7 @@ export async function convertDocumentInputIntoGreenInvoiceInput(
1266
1273
  emails.push(...(greenInvoiceClient.emails ?? []));
1267
1274
  }
1268
1275
  client = {
1269
- id: clientInfo.green_invoice_id,
1276
+ id: greenInvoiceClient.id,
1270
1277
  country: greenInvoiceClient.country,
1271
1278
  name: greenInvoiceClient.name,
1272
1279
  phone: greenInvoiceClient.phone,
@@ -1323,18 +1330,10 @@ export async function convertDocumentInputIntoGreenInvoiceInput(
1323
1330
 
1324
1331
  export function convertGreenInvoiceDocumentToLocalDocumentInfo(
1325
1332
  greenInvoiceDocument: _DOLLAR_defs_Document,
1326
- ): NewDocumentInfo {
1333
+ ): ResolversTypes['NewDocumentInfo'] {
1327
1334
  return {
1328
1335
  ...greenInvoiceDocument,
1329
- client: greenInvoiceDocument.client?.id
1330
- ? {
1331
- ...greenInvoiceDocument.client,
1332
- id: greenInvoiceDocument.client.id,
1333
- emails: greenInvoiceDocument.client.emails
1334
- ? (greenInvoiceDocument.client.emails.filter(Boolean) as string[])
1335
- : [],
1336
- }
1337
- : undefined,
1336
+ client: greenInvoiceDocument.client?.id,
1338
1337
  currency: greenInvoiceDocument.currency as Currency,
1339
1338
  income: greenInvoiceDocument.income?.filter(Boolean).map(income => ({
1340
1339
  ...income!,
@@ -14,6 +14,7 @@ import type {
14
14
  IInsertDocumentsResult,
15
15
  IUpdateIssuedDocumentParams,
16
16
  } from '@modules/documents/types.js';
17
+ import { validateClientIntegrations } from '@modules/financial-entities/helpers/clients.helper.js';
17
18
  import { BusinessesProvider } from '@modules/financial-entities/providers/businesses.provider.js';
18
19
  import { ClientsProvider } from '@modules/financial-entities/providers/clients.provider.js';
19
20
  import {
@@ -27,10 +28,9 @@ import {
27
28
  } from '@modules/green-invoice/helpers/green-invoice.helper.js';
28
29
  import { TransactionsProvider } from '@modules/transactions/providers/transactions.provider.js';
29
30
  import { Currency, DocumentType } from '@shared/enums';
30
- import { BillingCycle, NewDocumentInfo } from '@shared/gql-types';
31
+ import { BillingCycle, ResolversTypes } from '@shared/gql-types';
31
32
  import { dateToTimelessDateString } from '@shared/helpers';
32
33
  import { convertContractToDraft } from '../helpers/contract-to-draft.helper.js';
33
- import { getClientFromGreenInvoiceClient } from '../helpers/green-invoice-clients.helper.js';
34
34
  import {
35
35
  deduceVatTypeFromBusiness,
36
36
  executeDocumentIssue,
@@ -105,18 +105,13 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
105
105
  }) as IGetIssuedDocumentsByIdsResult[],
106
106
  );
107
107
 
108
- const clientPromise = charge.business_id
109
- ? getClientFromGreenInvoiceClient(injector, charge.business_id)
110
- : Promise.resolve(undefined);
111
-
112
108
  const paymentPromise = getPaymentsFromTransactions(injector, transactions);
113
109
 
114
110
  const vatTypePromise = deduceVatTypeFromBusiness(injector, locality, charge.business_id);
115
111
 
116
- const [businessMatch, openIssuedDocuments, client, payment, vatType] = await Promise.all([
112
+ const [businessMatch, openIssuedDocuments, payment, vatType] = await Promise.all([
117
113
  businessMatchPromise,
118
114
  openIssuedDocumentsPromise,
119
- clientPromise,
120
115
  paymentPromise,
121
116
  vatTypePromise,
122
117
  ]);
@@ -136,6 +131,10 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
136
131
  ),
137
132
  ).then(res => res.filter(Boolean) as _DOLLAR_defs_Document[]);
138
133
 
134
+ const greenInvoiceClientId = validateClientIntegrations(
135
+ businessMatch?.integrations ?? {},
136
+ ).greenInvoiceId;
137
+
139
138
  const income = getIncomeFromDocuments(
140
139
  openIssuedDocuments.map(doc => ({
141
140
  document: documents.find(d => d.id === doc.id)!,
@@ -193,7 +192,7 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
193
192
  vatType,
194
193
  rounding: false,
195
194
  signed: true,
196
- client,
195
+ client: greenInvoiceClientId,
197
196
  income,
198
197
  payment,
199
198
  // linkedPaymentId: ____,
@@ -284,14 +283,13 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
284
283
 
285
284
  const paymentPromise = getPaymentsFromTransactions(injector, transactions ?? []);
286
285
 
287
- const clientPromise = charge.business_id
288
- ? getClientFromGreenInvoiceClient(injector, charge.business_id)
289
- : Promise.resolve(undefined);
286
+ const greenInvoiceClientId = validateClientIntegrations(
287
+ businessMatch?.integrations ?? {},
288
+ ).greenInvoiceId;
290
289
 
291
- const [greenInvoiceDocument, payment, client] = await Promise.all([
290
+ const [greenInvoiceDocument, payment] = await Promise.all([
292
291
  greenInvoiceDocumentPromise,
293
292
  paymentPromise,
294
- clientPromise,
295
293
  ]);
296
294
 
297
295
  if (!greenInvoiceDocument) {
@@ -341,7 +339,7 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
341
339
  vatType,
342
340
  rounding: false,
343
341
  signed: true,
344
- client,
342
+ client: greenInvoiceClientId,
345
343
  income,
346
344
  payment,
347
345
  // linkedPaymentId: ____,
@@ -390,15 +388,7 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
390
388
  const clientPromise = injector
391
389
  .get(ClientsProvider)
392
390
  .getClientByIdLoader.load(contract.client_id);
393
- const greenInvoiceClientPromise = getClientFromGreenInvoiceClient(
394
- injector,
395
- contract.client_id,
396
- );
397
- const [business, client, greenInvoiceClient] = await Promise.all([
398
- businessPromise,
399
- clientPromise,
400
- greenInvoiceClientPromise,
401
- ]);
391
+ const [business, client] = await Promise.all([businessPromise, clientPromise]);
402
392
 
403
393
  if (!business) {
404
394
  throw new GraphQLError(`Business ID="${contract.client_id}" not found`);
@@ -408,7 +398,9 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
408
398
  throw new GraphQLError(`Client not found for business ID="${contract.client_id}"`);
409
399
  }
410
400
 
411
- if (!greenInvoiceClient) {
401
+ const greenInvoiceId = validateClientIntegrations(client.integrations)?.greenInvoiceId;
402
+
403
+ if (!greenInvoiceId) {
412
404
  throw new GraphQLError(
413
405
  `Green invoice match not found for business ID="${contract.client_id}"`,
414
406
  );
@@ -420,7 +412,7 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
420
412
  const year = today.getFullYear() + (today.getMonth() === 0 ? -1 : 0);
421
413
  const month = format(subMonths(today, 1), 'MMMM');
422
414
 
423
- const draft: NewDocumentInfo = {
415
+ const draft: ResolversTypes['NewDocumentInfo'] = {
424
416
  remarks: `${contract.purchase_orders[0] ? `PO: ${contract.purchase_orders[0]}${contract.remarks ? ', ' : ''}` : ''}${contract.remarks ?? ''}`,
425
417
  description: `GraphQL Hive Enterprise License - ${month} ${year}`,
426
418
  type: normalizeDocumentType(contract.document_type),
@@ -431,10 +423,7 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
431
423
  vatType: 'EXEMPT',
432
424
  rounding: false,
433
425
  signed: true,
434
- client: {
435
- ...greenInvoiceClient,
436
- emails: [...((client.emails?.filter(Boolean) as string[]) ?? [])],
437
- },
426
+ client: greenInvoiceId,
438
427
  income: [
439
428
  {
440
429
  description: `GraphQL Hive Enterprise License - ${month} ${year}`,
@@ -455,12 +444,12 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
455
444
  throw new GraphQLError(`Client not found for ID="${clientId}"`);
456
445
  }
457
446
 
458
- const greenInvoiceClient = await getClientFromGreenInvoiceClient(injector, clientId);
459
- if (!greenInvoiceClient) {
460
- throw new GraphQLError(`Green invoice match not found for client ID="${clientId}"`);
447
+ const greenInvoiceId = validateClientIntegrations(client.integrations)?.greenInvoiceId;
448
+ if (!greenInvoiceId) {
449
+ throw new GraphQLError(`Client ID="${clientId}" is missing Green Invoice integration`);
461
450
  }
462
451
 
463
- return greenInvoiceClient;
452
+ return greenInvoiceId;
464
453
  } catch (error) {
465
454
  const message = 'Failed to fetch Green Invoice client';
466
455
  console.error(message, error);
@@ -659,4 +648,80 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
659
648
  }
660
649
  },
661
650
  },
651
+ ClientIntegrations: {
652
+ greenInvoiceInfo: business =>
653
+ validateClientIntegrations(business.integrations).greenInvoiceId ?? null,
654
+ },
655
+ GreenInvoiceClient: {
656
+ id: clientId => clientId,
657
+ country: async (clientId, _, { injector }) => {
658
+ return injector
659
+ .get(GreenInvoiceClientProvider)
660
+ .clientLoader.load(clientId)
661
+ .then(client => {
662
+ if (client?.country) {
663
+ // TODO: use Country for server responses
664
+ // greenInvoiceCountryToCountryCode(client.country)
665
+ return client.country;
666
+ }
667
+ return null;
668
+ });
669
+ },
670
+ emails: async (clientId, _, { injector }) => {
671
+ const emails = await injector
672
+ .get(GreenInvoiceClientProvider)
673
+ .clientLoader.load(clientId)
674
+ .then(client => client?.emails);
675
+
676
+ return [...((emails?.filter(Boolean) as string[]) ?? []), 'ap@the-guild.dev']; // TODO: remove hardcoded email
677
+ },
678
+ name: async (clientId, _, { injector }) => {
679
+ return injector
680
+ .get(GreenInvoiceClientProvider)
681
+ .clientLoader.load(clientId)
682
+ .then(client => client?.name ?? null);
683
+ },
684
+ phone: async (clientId, _, { injector }) => {
685
+ return injector
686
+ .get(GreenInvoiceClientProvider)
687
+ .clientLoader.load(clientId)
688
+ .then(client => client?.phone ?? null);
689
+ },
690
+ taxId: async (clientId, _, { injector }) => {
691
+ return injector
692
+ .get(GreenInvoiceClientProvider)
693
+ .clientLoader.load(clientId)
694
+ .then(client => client?.taxId ?? null);
695
+ },
696
+ address: async (clientId, _, { injector }) => {
697
+ return injector
698
+ .get(GreenInvoiceClientProvider)
699
+ .clientLoader.load(clientId)
700
+ .then(client => client?.address ?? null);
701
+ },
702
+ city: async (clientId, _, { injector }) => {
703
+ return injector
704
+ .get(GreenInvoiceClientProvider)
705
+ .clientLoader.load(clientId)
706
+ .then(client => client?.city ?? null);
707
+ },
708
+ zip: async (clientId, _, { injector }) => {
709
+ return injector
710
+ .get(GreenInvoiceClientProvider)
711
+ .clientLoader.load(clientId)
712
+ .then(client => client?.zip ?? null);
713
+ },
714
+ fax: async (clientId, _, { injector }) => {
715
+ return injector
716
+ .get(GreenInvoiceClientProvider)
717
+ .clientLoader.load(clientId)
718
+ .then(client => client?.fax ?? null);
719
+ },
720
+ mobile: async (clientId, _, { injector }) => {
721
+ return injector
722
+ .get(GreenInvoiceClientProvider)
723
+ .clientLoader.load(clientId)
724
+ .then(client => client?.mobile ?? null);
725
+ },
726
+ },
662
727
  };
@@ -33,6 +33,10 @@ export default gql`
33
33
  originalDocument: NewDocumentInfo
34
34
  }
35
35
 
36
+ extend type ClientIntegrations {
37
+ greenInvoiceInfo: GreenInvoiceClient
38
+ }
39
+
36
40
  " result type for generateMonthlyClientDocuments" # eslint-disable-next-line @graphql-eslint/strict-id-in-types -- no current solution for this
37
41
  type GenerateMonthlyClientDocumentsResult {
38
42
  success: Boolean!