@accounter/server 0.0.8-alpha-20251105183654-b3147b83bfda6ce62d09073ce81342ceadf5160c → 0.0.8-alpha-20251106080932-aeb05a6f60a5ad38f48a4149e31ae1c5482d7177
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.
- package/CHANGELOG.md +5 -25
- package/dist/server/src/__generated__/types.d.ts +10 -39
- package/dist/server/src/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/financial-entities/__generated__/clients.types.d.ts +4 -11
- package/dist/server/src/modules/financial-entities/__generated__/types.d.ts +7 -19
- package/dist/server/src/modules/financial-entities/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/financial-entities/providers/businesses.provider.js +1 -1
- package/dist/server/src/modules/financial-entities/providers/clients.provider.js +16 -18
- package/dist/server/src/modules/financial-entities/providers/clients.provider.js.map +1 -1
- package/dist/server/src/modules/financial-entities/resolvers/clients.resolvers.js +24 -26
- package/dist/server/src/modules/financial-entities/resolvers/clients.resolvers.js.map +1 -1
- package/dist/server/src/modules/financial-entities/typeDefs/clients.graphql.js +8 -24
- package/dist/server/src/modules/financial-entities/typeDefs/clients.graphql.js.map +1 -1
- package/dist/server/src/modules/green-invoice/__generated__/types.d.ts +0 -8
- package/dist/server/src/modules/green-invoice/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/green-invoice/helpers/contract-to-draft.helper.d.ts +1 -3
- package/dist/server/src/modules/green-invoice/helpers/contract-to-draft.helper.js +12 -5
- package/dist/server/src/modules/green-invoice/helpers/contract-to-draft.helper.js.map +1 -1
- package/dist/server/src/modules/green-invoice/helpers/green-invoice-clients.helper.d.ts +2 -1
- package/dist/server/src/modules/green-invoice/helpers/green-invoice-clients.helper.js +31 -17
- package/dist/server/src/modules/green-invoice/helpers/green-invoice-clients.helper.js.map +1 -1
- package/dist/server/src/modules/green-invoice/helpers/green-invoice.helper.d.ts +2 -2
- package/dist/server/src/modules/green-invoice/helpers/green-invoice.helper.js +18 -21
- package/dist/server/src/modules/green-invoice/helpers/green-invoice.helper.js.map +1 -1
- package/dist/server/src/modules/green-invoice/resolvers/green-invoice.resolvers.js +28 -89
- package/dist/server/src/modules/green-invoice/resolvers/green-invoice.resolvers.js.map +1 -1
- package/dist/server/src/modules/green-invoice/typeDefs/green-invoice.graphql.js +0 -4
- package/dist/server/src/modules/green-invoice/typeDefs/green-invoice.graphql.js.map +1 -1
- package/package.json +1 -1
- package/src/__generated__/types.ts +10 -42
- package/src/modules/financial-entities/__generated__/clients.types.ts +4 -10
- package/src/modules/financial-entities/__generated__/types.ts +7 -19
- package/src/modules/financial-entities/providers/businesses.provider.ts +1 -1
- package/src/modules/financial-entities/providers/clients.provider.ts +16 -19
- package/src/modules/financial-entities/resolvers/clients.resolvers.ts +27 -30
- package/src/modules/financial-entities/typeDefs/clients.graphql.ts +8 -24
- package/src/modules/green-invoice/__generated__/types.ts +0 -8
- package/src/modules/green-invoice/helpers/contract-to-draft.helper.ts +13 -7
- package/src/modules/green-invoice/helpers/green-invoice-clients.helper.ts +40 -19
- package/src/modules/green-invoice/helpers/green-invoice.helper.ts +23 -22
- package/src/modules/green-invoice/resolvers/green-invoice.resolvers.ts +34 -99
- package/src/modules/green-invoice/typeDefs/green-invoice.graphql.ts +0 -4
- package/dist/server/src/modules/financial-entities/helpers/clients.helper.d.ts +0 -11
- package/dist/server/src/modules/financial-entities/helpers/clients.helper.js +0 -26
- package/dist/server/src/modules/financial-entities/helpers/clients.helper.js.map +0 -1
- package/src/modules/financial-entities/helpers/clients.helper.ts +0 -28
|
@@ -14,7 +14,6 @@ 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';
|
|
18
17
|
import { BusinessesProvider } from '@modules/financial-entities/providers/businesses.provider.js';
|
|
19
18
|
import { ClientsProvider } from '@modules/financial-entities/providers/clients.provider.js';
|
|
20
19
|
import {
|
|
@@ -28,9 +27,10 @@ import {
|
|
|
28
27
|
} from '@modules/green-invoice/helpers/green-invoice.helper.js';
|
|
29
28
|
import { TransactionsProvider } from '@modules/transactions/providers/transactions.provider.js';
|
|
30
29
|
import { Currency, DocumentType } from '@shared/enums';
|
|
31
|
-
import { BillingCycle,
|
|
30
|
+
import { BillingCycle, NewDocumentInfo } from '@shared/gql-types';
|
|
32
31
|
import { dateToTimelessDateString } from '@shared/helpers';
|
|
33
32
|
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,13 +105,18 @@ 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
|
+
|
|
108
112
|
const paymentPromise = getPaymentsFromTransactions(injector, transactions);
|
|
109
113
|
|
|
110
114
|
const vatTypePromise = deduceVatTypeFromBusiness(injector, locality, charge.business_id);
|
|
111
115
|
|
|
112
|
-
const [businessMatch, openIssuedDocuments, payment, vatType] = await Promise.all([
|
|
116
|
+
const [businessMatch, openIssuedDocuments, client, payment, vatType] = await Promise.all([
|
|
113
117
|
businessMatchPromise,
|
|
114
118
|
openIssuedDocumentsPromise,
|
|
119
|
+
clientPromise,
|
|
115
120
|
paymentPromise,
|
|
116
121
|
vatTypePromise,
|
|
117
122
|
]);
|
|
@@ -131,10 +136,6 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
|
|
|
131
136
|
),
|
|
132
137
|
).then(res => res.filter(Boolean) as _DOLLAR_defs_Document[]);
|
|
133
138
|
|
|
134
|
-
const greenInvoiceClientId = validateClientIntegrations(
|
|
135
|
-
businessMatch?.integrations ?? {},
|
|
136
|
-
).greenInvoiceId;
|
|
137
|
-
|
|
138
139
|
const income = getIncomeFromDocuments(
|
|
139
140
|
openIssuedDocuments.map(doc => ({
|
|
140
141
|
document: documents.find(d => d.id === doc.id)!,
|
|
@@ -192,7 +193,7 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
|
|
|
192
193
|
vatType,
|
|
193
194
|
rounding: false,
|
|
194
195
|
signed: true,
|
|
195
|
-
client
|
|
196
|
+
client,
|
|
196
197
|
income,
|
|
197
198
|
payment,
|
|
198
199
|
// linkedPaymentId: ____,
|
|
@@ -283,13 +284,14 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
|
|
|
283
284
|
|
|
284
285
|
const paymentPromise = getPaymentsFromTransactions(injector, transactions ?? []);
|
|
285
286
|
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
const clientPromise = charge.business_id
|
|
288
|
+
? getClientFromGreenInvoiceClient(injector, charge.business_id)
|
|
289
|
+
: Promise.resolve(undefined);
|
|
289
290
|
|
|
290
|
-
const [greenInvoiceDocument, payment] = await Promise.all([
|
|
291
|
+
const [greenInvoiceDocument, payment, client] = await Promise.all([
|
|
291
292
|
greenInvoiceDocumentPromise,
|
|
292
293
|
paymentPromise,
|
|
294
|
+
clientPromise,
|
|
293
295
|
]);
|
|
294
296
|
|
|
295
297
|
if (!greenInvoiceDocument) {
|
|
@@ -339,7 +341,7 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
|
|
|
339
341
|
vatType,
|
|
340
342
|
rounding: false,
|
|
341
343
|
signed: true,
|
|
342
|
-
client
|
|
344
|
+
client,
|
|
343
345
|
income,
|
|
344
346
|
payment,
|
|
345
347
|
// linkedPaymentId: ____,
|
|
@@ -388,7 +390,15 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
|
|
|
388
390
|
const clientPromise = injector
|
|
389
391
|
.get(ClientsProvider)
|
|
390
392
|
.getClientByIdLoader.load(contract.client_id);
|
|
391
|
-
const
|
|
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
|
+
]);
|
|
392
402
|
|
|
393
403
|
if (!business) {
|
|
394
404
|
throw new GraphQLError(`Business ID="${contract.client_id}" not found`);
|
|
@@ -398,9 +408,7 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
|
|
|
398
408
|
throw new GraphQLError(`Client not found for business ID="${contract.client_id}"`);
|
|
399
409
|
}
|
|
400
410
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
if (!greenInvoiceId) {
|
|
411
|
+
if (!greenInvoiceClient) {
|
|
404
412
|
throw new GraphQLError(
|
|
405
413
|
`Green invoice match not found for business ID="${contract.client_id}"`,
|
|
406
414
|
);
|
|
@@ -412,7 +420,7 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
|
|
|
412
420
|
const year = today.getFullYear() + (today.getMonth() === 0 ? -1 : 0);
|
|
413
421
|
const month = format(subMonths(today, 1), 'MMMM');
|
|
414
422
|
|
|
415
|
-
const draft:
|
|
423
|
+
const draft: NewDocumentInfo = {
|
|
416
424
|
remarks: `${contract.purchase_orders[0] ? `PO: ${contract.purchase_orders[0]}${contract.remarks ? ', ' : ''}` : ''}${contract.remarks ?? ''}`,
|
|
417
425
|
description: `GraphQL Hive Enterprise License - ${month} ${year}`,
|
|
418
426
|
type: normalizeDocumentType(contract.document_type),
|
|
@@ -423,7 +431,10 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
|
|
|
423
431
|
vatType: 'EXEMPT',
|
|
424
432
|
rounding: false,
|
|
425
433
|
signed: true,
|
|
426
|
-
client:
|
|
434
|
+
client: {
|
|
435
|
+
...greenInvoiceClient,
|
|
436
|
+
emails: [...((client.emails?.filter(Boolean) as string[]) ?? [])],
|
|
437
|
+
},
|
|
427
438
|
income: [
|
|
428
439
|
{
|
|
429
440
|
description: `GraphQL Hive Enterprise License - ${month} ${year}`,
|
|
@@ -444,12 +455,12 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
|
|
|
444
455
|
throw new GraphQLError(`Client not found for ID="${clientId}"`);
|
|
445
456
|
}
|
|
446
457
|
|
|
447
|
-
const
|
|
448
|
-
if (!
|
|
449
|
-
throw new GraphQLError(`
|
|
458
|
+
const greenInvoiceClient = await getClientFromGreenInvoiceClient(injector, clientId);
|
|
459
|
+
if (!greenInvoiceClient) {
|
|
460
|
+
throw new GraphQLError(`Green invoice match not found for client ID="${clientId}"`);
|
|
450
461
|
}
|
|
451
462
|
|
|
452
|
-
return
|
|
463
|
+
return greenInvoiceClient;
|
|
453
464
|
} catch (error) {
|
|
454
465
|
const message = 'Failed to fetch Green Invoice client';
|
|
455
466
|
console.error(message, error);
|
|
@@ -648,80 +659,4 @@ export const greenInvoiceResolvers: GreenInvoiceModule.Resolvers = {
|
|
|
648
659
|
}
|
|
649
660
|
},
|
|
650
661
|
},
|
|
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
|
-
},
|
|
727
662
|
};
|
|
@@ -33,10 +33,6 @@ export default gql`
|
|
|
33
33
|
originalDocument: NewDocumentInfo
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
extend type ClientIntegrations {
|
|
37
|
-
greenInvoiceInfo: GreenInvoiceClient
|
|
38
|
-
}
|
|
39
|
-
|
|
40
36
|
" result type for generateMonthlyClientDocuments" # eslint-disable-next-line @graphql-eslint/strict-id-in-types -- no current solution for this
|
|
41
37
|
type GenerateMonthlyClientDocumentsResult {
|
|
42
38
|
success: Boolean!
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const ClientIntegrationsSchema: z.ZodObject<{
|
|
3
|
-
greenInvoiceId: z.ZodNullable<z.ZodOptional<z.ZodUUID>>;
|
|
4
|
-
hiveId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
5
|
-
linearId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
6
|
-
slackChannelKey: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
7
|
-
notionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
8
|
-
workflowyUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
9
|
-
}, z.core.$strict>;
|
|
10
|
-
export type ClientIntegrations = z.infer<typeof ClientIntegrationsSchema>;
|
|
11
|
-
export declare function validateClientIntegrations(input: unknown): ClientIntegrations;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { GraphQLError } from 'graphql';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
// Zod schema matching the GraphQL `ClientIntegrations` type
|
|
4
|
-
export const ClientIntegrationsSchema = z
|
|
5
|
-
.object({
|
|
6
|
-
greenInvoiceId: z.uuid().optional().nullable(),
|
|
7
|
-
hiveId: z.string().optional().nullable(),
|
|
8
|
-
linearId: z.string().optional().nullable(),
|
|
9
|
-
slackChannelKey: z.string().optional().nullable(),
|
|
10
|
-
notionId: z.string().optional().nullable(),
|
|
11
|
-
workflowyUrl: z.string().optional().nullable(),
|
|
12
|
-
})
|
|
13
|
-
.strict();
|
|
14
|
-
export function validateClientIntegrations(input) {
|
|
15
|
-
try {
|
|
16
|
-
const { data, success, error } = ClientIntegrationsSchema.safeParse(input);
|
|
17
|
-
if (!success) {
|
|
18
|
-
throw new Error(`Parsing error: ${error}`);
|
|
19
|
-
}
|
|
20
|
-
return data;
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
throw new GraphQLError(`Failed to validate client integrations: ${error}`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=clients.helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clients.helper.js","sourceRoot":"","sources":["../../../../../../src/modules/financial-entities/helpers/clients.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4DAA4D;AAC5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACtC,MAAM,CAAC;IACN,cAAc,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC9C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACxC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC1C,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACjD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC1C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC/C,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,MAAM,UAAU,0BAA0B,CAAC,KAAc;IACvD,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,wBAAwB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC3E,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,YAAY,CAAC,2CAA2C,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { GraphQLError } from 'graphql';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
// Zod schema matching the GraphQL `ClientIntegrations` type
|
|
5
|
-
export const ClientIntegrationsSchema = z
|
|
6
|
-
.object({
|
|
7
|
-
greenInvoiceId: z.uuid().optional().nullable(),
|
|
8
|
-
hiveId: z.string().optional().nullable(),
|
|
9
|
-
linearId: z.string().optional().nullable(),
|
|
10
|
-
slackChannelKey: z.string().optional().nullable(),
|
|
11
|
-
notionId: z.string().optional().nullable(),
|
|
12
|
-
workflowyUrl: z.string().optional().nullable(),
|
|
13
|
-
})
|
|
14
|
-
.strict();
|
|
15
|
-
|
|
16
|
-
export type ClientIntegrations = z.infer<typeof ClientIntegrationsSchema>;
|
|
17
|
-
|
|
18
|
-
export function validateClientIntegrations(input: unknown): ClientIntegrations {
|
|
19
|
-
try {
|
|
20
|
-
const { data, success, error } = ClientIntegrationsSchema.safeParse(input);
|
|
21
|
-
if (!success) {
|
|
22
|
-
throw new Error(`Parsing error: ${error}`);
|
|
23
|
-
}
|
|
24
|
-
return data;
|
|
25
|
-
} catch (error) {
|
|
26
|
-
throw new GraphQLError(`Failed to validate client integrations: ${error}`);
|
|
27
|
-
}
|
|
28
|
-
}
|