@financeable/aggregation 0.7.2 → 0.7.3

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.
@@ -4,6 +4,7 @@
4
4
 
5
5
  import * as z from "zod";
6
6
  import { safeParse } from "../../lib/schemas.js";
7
+ import { ClosedEnum } from "../../types/enums.js";
7
8
  import { Result as SafeParseResult } from "../../types/fp.js";
8
9
  import * as components from "../components/index.js";
9
10
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
@@ -18,6 +19,66 @@ export type CreateApplicationRequestBody = {
18
19
  | components.ConsumerSecuredApplicationPayload;
19
20
  };
20
21
 
22
+ export const CreateApplicationIncludedApplicationsResponseType = {
23
+ Customers: "customers",
24
+ } as const;
25
+ export type CreateApplicationIncludedApplicationsResponseType = ClosedEnum<
26
+ typeof CreateApplicationIncludedApplicationsResponseType
27
+ >;
28
+
29
+ export type Five = {
30
+ type: CreateApplicationIncludedApplicationsResponseType;
31
+ id: string;
32
+ };
33
+
34
+ export const CreateApplicationIncludedApplicationsType = {
35
+ LoanDetails: "loan-details",
36
+ } as const;
37
+ export type CreateApplicationIncludedApplicationsType = ClosedEnum<
38
+ typeof CreateApplicationIncludedApplicationsType
39
+ >;
40
+
41
+ export type Four = {
42
+ type: CreateApplicationIncludedApplicationsType;
43
+ id: string;
44
+ };
45
+
46
+ export const CreateApplicationIncludedType = {
47
+ Entities: "entities",
48
+ } as const;
49
+ export type CreateApplicationIncludedType = ClosedEnum<
50
+ typeof CreateApplicationIncludedType
51
+ >;
52
+
53
+ export type Three = {
54
+ type: CreateApplicationIncludedType;
55
+ id: string;
56
+ };
57
+
58
+ export const IncludedType = {
59
+ Assets: "assets",
60
+ } as const;
61
+ export type IncludedType = ClosedEnum<typeof IncludedType>;
62
+
63
+ export type Two = {
64
+ type: IncludedType;
65
+ id: string;
66
+ };
67
+
68
+ export const Type = {
69
+ Addresses: "addresses",
70
+ } as const;
71
+ export type Type = ClosedEnum<typeof Type>;
72
+
73
+ export type One = {
74
+ type: Type;
75
+ id: string;
76
+ };
77
+
78
+ export type Included = One | Two | Three | Four | Five;
79
+
80
+ export type Links = {};
81
+
21
82
  /**
22
83
  * The request has succeeded and a new resource has been created as a result.
23
84
  */
@@ -26,11 +87,8 @@ export type CreateApplicationResponseBody = {
26
87
  * Represents either a Consumer or Commercial Application resource
27
88
  */
28
89
  data: components.ApplicationResource;
29
- included?: Array<components.ApplicationResource> | undefined;
30
- /**
31
- * Standard link object
32
- */
33
- links?: components.LinkObject | undefined;
90
+ included?: Array<One | Two | Three | Four | Five> | undefined;
91
+ links?: Links | undefined;
34
92
  };
35
93
 
36
94
  /** @internal */
@@ -143,6 +201,452 @@ export function createApplicationRequestBodyFromJSON(
143
201
  );
144
202
  }
145
203
 
204
+ /** @internal */
205
+ export const CreateApplicationIncludedApplicationsResponseType$inboundSchema:
206
+ z.ZodNativeEnum<typeof CreateApplicationIncludedApplicationsResponseType> = z
207
+ .nativeEnum(CreateApplicationIncludedApplicationsResponseType);
208
+
209
+ /** @internal */
210
+ export const CreateApplicationIncludedApplicationsResponseType$outboundSchema:
211
+ z.ZodNativeEnum<typeof CreateApplicationIncludedApplicationsResponseType> =
212
+ CreateApplicationIncludedApplicationsResponseType$inboundSchema;
213
+
214
+ /**
215
+ * @internal
216
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
217
+ */
218
+ export namespace CreateApplicationIncludedApplicationsResponseType$ {
219
+ /** @deprecated use `CreateApplicationIncludedApplicationsResponseType$inboundSchema` instead. */
220
+ export const inboundSchema =
221
+ CreateApplicationIncludedApplicationsResponseType$inboundSchema;
222
+ /** @deprecated use `CreateApplicationIncludedApplicationsResponseType$outboundSchema` instead. */
223
+ export const outboundSchema =
224
+ CreateApplicationIncludedApplicationsResponseType$outboundSchema;
225
+ }
226
+
227
+ /** @internal */
228
+ export const Five$inboundSchema: z.ZodType<Five, z.ZodTypeDef, unknown> = z
229
+ .object({
230
+ type: CreateApplicationIncludedApplicationsResponseType$inboundSchema,
231
+ id: z.string(),
232
+ });
233
+
234
+ /** @internal */
235
+ export type Five$Outbound = {
236
+ type: string;
237
+ id: string;
238
+ };
239
+
240
+ /** @internal */
241
+ export const Five$outboundSchema: z.ZodType<Five$Outbound, z.ZodTypeDef, Five> =
242
+ z.object({
243
+ type: CreateApplicationIncludedApplicationsResponseType$outboundSchema,
244
+ id: z.string(),
245
+ });
246
+
247
+ /**
248
+ * @internal
249
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
250
+ */
251
+ export namespace Five$ {
252
+ /** @deprecated use `Five$inboundSchema` instead. */
253
+ export const inboundSchema = Five$inboundSchema;
254
+ /** @deprecated use `Five$outboundSchema` instead. */
255
+ export const outboundSchema = Five$outboundSchema;
256
+ /** @deprecated use `Five$Outbound` instead. */
257
+ export type Outbound = Five$Outbound;
258
+ }
259
+
260
+ export function fiveToJSON(five: Five): string {
261
+ return JSON.stringify(Five$outboundSchema.parse(five));
262
+ }
263
+
264
+ export function fiveFromJSON(
265
+ jsonString: string,
266
+ ): SafeParseResult<Five, SDKValidationError> {
267
+ return safeParse(
268
+ jsonString,
269
+ (x) => Five$inboundSchema.parse(JSON.parse(x)),
270
+ `Failed to parse 'Five' from JSON`,
271
+ );
272
+ }
273
+
274
+ /** @internal */
275
+ export const CreateApplicationIncludedApplicationsType$inboundSchema:
276
+ z.ZodNativeEnum<typeof CreateApplicationIncludedApplicationsType> = z
277
+ .nativeEnum(CreateApplicationIncludedApplicationsType);
278
+
279
+ /** @internal */
280
+ export const CreateApplicationIncludedApplicationsType$outboundSchema:
281
+ z.ZodNativeEnum<typeof CreateApplicationIncludedApplicationsType> =
282
+ CreateApplicationIncludedApplicationsType$inboundSchema;
283
+
284
+ /**
285
+ * @internal
286
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
287
+ */
288
+ export namespace CreateApplicationIncludedApplicationsType$ {
289
+ /** @deprecated use `CreateApplicationIncludedApplicationsType$inboundSchema` instead. */
290
+ export const inboundSchema =
291
+ CreateApplicationIncludedApplicationsType$inboundSchema;
292
+ /** @deprecated use `CreateApplicationIncludedApplicationsType$outboundSchema` instead. */
293
+ export const outboundSchema =
294
+ CreateApplicationIncludedApplicationsType$outboundSchema;
295
+ }
296
+
297
+ /** @internal */
298
+ export const Four$inboundSchema: z.ZodType<Four, z.ZodTypeDef, unknown> = z
299
+ .object({
300
+ type: CreateApplicationIncludedApplicationsType$inboundSchema,
301
+ id: z.string(),
302
+ });
303
+
304
+ /** @internal */
305
+ export type Four$Outbound = {
306
+ type: string;
307
+ id: string;
308
+ };
309
+
310
+ /** @internal */
311
+ export const Four$outboundSchema: z.ZodType<Four$Outbound, z.ZodTypeDef, Four> =
312
+ z.object({
313
+ type: CreateApplicationIncludedApplicationsType$outboundSchema,
314
+ id: z.string(),
315
+ });
316
+
317
+ /**
318
+ * @internal
319
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
320
+ */
321
+ export namespace Four$ {
322
+ /** @deprecated use `Four$inboundSchema` instead. */
323
+ export const inboundSchema = Four$inboundSchema;
324
+ /** @deprecated use `Four$outboundSchema` instead. */
325
+ export const outboundSchema = Four$outboundSchema;
326
+ /** @deprecated use `Four$Outbound` instead. */
327
+ export type Outbound = Four$Outbound;
328
+ }
329
+
330
+ export function fourToJSON(four: Four): string {
331
+ return JSON.stringify(Four$outboundSchema.parse(four));
332
+ }
333
+
334
+ export function fourFromJSON(
335
+ jsonString: string,
336
+ ): SafeParseResult<Four, SDKValidationError> {
337
+ return safeParse(
338
+ jsonString,
339
+ (x) => Four$inboundSchema.parse(JSON.parse(x)),
340
+ `Failed to parse 'Four' from JSON`,
341
+ );
342
+ }
343
+
344
+ /** @internal */
345
+ export const CreateApplicationIncludedType$inboundSchema: z.ZodNativeEnum<
346
+ typeof CreateApplicationIncludedType
347
+ > = z.nativeEnum(CreateApplicationIncludedType);
348
+
349
+ /** @internal */
350
+ export const CreateApplicationIncludedType$outboundSchema: z.ZodNativeEnum<
351
+ typeof CreateApplicationIncludedType
352
+ > = CreateApplicationIncludedType$inboundSchema;
353
+
354
+ /**
355
+ * @internal
356
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
357
+ */
358
+ export namespace CreateApplicationIncludedType$ {
359
+ /** @deprecated use `CreateApplicationIncludedType$inboundSchema` instead. */
360
+ export const inboundSchema = CreateApplicationIncludedType$inboundSchema;
361
+ /** @deprecated use `CreateApplicationIncludedType$outboundSchema` instead. */
362
+ export const outboundSchema = CreateApplicationIncludedType$outboundSchema;
363
+ }
364
+
365
+ /** @internal */
366
+ export const Three$inboundSchema: z.ZodType<Three, z.ZodTypeDef, unknown> = z
367
+ .object({
368
+ type: CreateApplicationIncludedType$inboundSchema,
369
+ id: z.string(),
370
+ });
371
+
372
+ /** @internal */
373
+ export type Three$Outbound = {
374
+ type: string;
375
+ id: string;
376
+ };
377
+
378
+ /** @internal */
379
+ export const Three$outboundSchema: z.ZodType<
380
+ Three$Outbound,
381
+ z.ZodTypeDef,
382
+ Three
383
+ > = z.object({
384
+ type: CreateApplicationIncludedType$outboundSchema,
385
+ id: z.string(),
386
+ });
387
+
388
+ /**
389
+ * @internal
390
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
391
+ */
392
+ export namespace Three$ {
393
+ /** @deprecated use `Three$inboundSchema` instead. */
394
+ export const inboundSchema = Three$inboundSchema;
395
+ /** @deprecated use `Three$outboundSchema` instead. */
396
+ export const outboundSchema = Three$outboundSchema;
397
+ /** @deprecated use `Three$Outbound` instead. */
398
+ export type Outbound = Three$Outbound;
399
+ }
400
+
401
+ export function threeToJSON(three: Three): string {
402
+ return JSON.stringify(Three$outboundSchema.parse(three));
403
+ }
404
+
405
+ export function threeFromJSON(
406
+ jsonString: string,
407
+ ): SafeParseResult<Three, SDKValidationError> {
408
+ return safeParse(
409
+ jsonString,
410
+ (x) => Three$inboundSchema.parse(JSON.parse(x)),
411
+ `Failed to parse 'Three' from JSON`,
412
+ );
413
+ }
414
+
415
+ /** @internal */
416
+ export const IncludedType$inboundSchema: z.ZodNativeEnum<typeof IncludedType> =
417
+ z.nativeEnum(IncludedType);
418
+
419
+ /** @internal */
420
+ export const IncludedType$outboundSchema: z.ZodNativeEnum<typeof IncludedType> =
421
+ IncludedType$inboundSchema;
422
+
423
+ /**
424
+ * @internal
425
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
426
+ */
427
+ export namespace IncludedType$ {
428
+ /** @deprecated use `IncludedType$inboundSchema` instead. */
429
+ export const inboundSchema = IncludedType$inboundSchema;
430
+ /** @deprecated use `IncludedType$outboundSchema` instead. */
431
+ export const outboundSchema = IncludedType$outboundSchema;
432
+ }
433
+
434
+ /** @internal */
435
+ export const Two$inboundSchema: z.ZodType<Two, z.ZodTypeDef, unknown> = z
436
+ .object({
437
+ type: IncludedType$inboundSchema,
438
+ id: z.string(),
439
+ });
440
+
441
+ /** @internal */
442
+ export type Two$Outbound = {
443
+ type: string;
444
+ id: string;
445
+ };
446
+
447
+ /** @internal */
448
+ export const Two$outboundSchema: z.ZodType<Two$Outbound, z.ZodTypeDef, Two> = z
449
+ .object({
450
+ type: IncludedType$outboundSchema,
451
+ id: z.string(),
452
+ });
453
+
454
+ /**
455
+ * @internal
456
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
457
+ */
458
+ export namespace Two$ {
459
+ /** @deprecated use `Two$inboundSchema` instead. */
460
+ export const inboundSchema = Two$inboundSchema;
461
+ /** @deprecated use `Two$outboundSchema` instead. */
462
+ export const outboundSchema = Two$outboundSchema;
463
+ /** @deprecated use `Two$Outbound` instead. */
464
+ export type Outbound = Two$Outbound;
465
+ }
466
+
467
+ export function twoToJSON(two: Two): string {
468
+ return JSON.stringify(Two$outboundSchema.parse(two));
469
+ }
470
+
471
+ export function twoFromJSON(
472
+ jsonString: string,
473
+ ): SafeParseResult<Two, SDKValidationError> {
474
+ return safeParse(
475
+ jsonString,
476
+ (x) => Two$inboundSchema.parse(JSON.parse(x)),
477
+ `Failed to parse 'Two' from JSON`,
478
+ );
479
+ }
480
+
481
+ /** @internal */
482
+ export const Type$inboundSchema: z.ZodNativeEnum<typeof Type> = z.nativeEnum(
483
+ Type,
484
+ );
485
+
486
+ /** @internal */
487
+ export const Type$outboundSchema: z.ZodNativeEnum<typeof Type> =
488
+ Type$inboundSchema;
489
+
490
+ /**
491
+ * @internal
492
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
493
+ */
494
+ export namespace Type$ {
495
+ /** @deprecated use `Type$inboundSchema` instead. */
496
+ export const inboundSchema = Type$inboundSchema;
497
+ /** @deprecated use `Type$outboundSchema` instead. */
498
+ export const outboundSchema = Type$outboundSchema;
499
+ }
500
+
501
+ /** @internal */
502
+ export const One$inboundSchema: z.ZodType<One, z.ZodTypeDef, unknown> = z
503
+ .object({
504
+ type: Type$inboundSchema,
505
+ id: z.string(),
506
+ });
507
+
508
+ /** @internal */
509
+ export type One$Outbound = {
510
+ type: string;
511
+ id: string;
512
+ };
513
+
514
+ /** @internal */
515
+ export const One$outboundSchema: z.ZodType<One$Outbound, z.ZodTypeDef, One> = z
516
+ .object({
517
+ type: Type$outboundSchema,
518
+ id: z.string(),
519
+ });
520
+
521
+ /**
522
+ * @internal
523
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
524
+ */
525
+ export namespace One$ {
526
+ /** @deprecated use `One$inboundSchema` instead. */
527
+ export const inboundSchema = One$inboundSchema;
528
+ /** @deprecated use `One$outboundSchema` instead. */
529
+ export const outboundSchema = One$outboundSchema;
530
+ /** @deprecated use `One$Outbound` instead. */
531
+ export type Outbound = One$Outbound;
532
+ }
533
+
534
+ export function oneToJSON(one: One): string {
535
+ return JSON.stringify(One$outboundSchema.parse(one));
536
+ }
537
+
538
+ export function oneFromJSON(
539
+ jsonString: string,
540
+ ): SafeParseResult<One, SDKValidationError> {
541
+ return safeParse(
542
+ jsonString,
543
+ (x) => One$inboundSchema.parse(JSON.parse(x)),
544
+ `Failed to parse 'One' from JSON`,
545
+ );
546
+ }
547
+
548
+ /** @internal */
549
+ export const Included$inboundSchema: z.ZodType<
550
+ Included,
551
+ z.ZodTypeDef,
552
+ unknown
553
+ > = z.union([
554
+ z.lazy(() => One$inboundSchema),
555
+ z.lazy(() => Two$inboundSchema),
556
+ z.lazy(() => Three$inboundSchema),
557
+ z.lazy(() => Four$inboundSchema),
558
+ z.lazy(() => Five$inboundSchema),
559
+ ]);
560
+
561
+ /** @internal */
562
+ export type Included$Outbound =
563
+ | One$Outbound
564
+ | Two$Outbound
565
+ | Three$Outbound
566
+ | Four$Outbound
567
+ | Five$Outbound;
568
+
569
+ /** @internal */
570
+ export const Included$outboundSchema: z.ZodType<
571
+ Included$Outbound,
572
+ z.ZodTypeDef,
573
+ Included
574
+ > = z.union([
575
+ z.lazy(() => One$outboundSchema),
576
+ z.lazy(() => Two$outboundSchema),
577
+ z.lazy(() => Three$outboundSchema),
578
+ z.lazy(() => Four$outboundSchema),
579
+ z.lazy(() => Five$outboundSchema),
580
+ ]);
581
+
582
+ /**
583
+ * @internal
584
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
585
+ */
586
+ export namespace Included$ {
587
+ /** @deprecated use `Included$inboundSchema` instead. */
588
+ export const inboundSchema = Included$inboundSchema;
589
+ /** @deprecated use `Included$outboundSchema` instead. */
590
+ export const outboundSchema = Included$outboundSchema;
591
+ /** @deprecated use `Included$Outbound` instead. */
592
+ export type Outbound = Included$Outbound;
593
+ }
594
+
595
+ export function includedToJSON(included: Included): string {
596
+ return JSON.stringify(Included$outboundSchema.parse(included));
597
+ }
598
+
599
+ export function includedFromJSON(
600
+ jsonString: string,
601
+ ): SafeParseResult<Included, SDKValidationError> {
602
+ return safeParse(
603
+ jsonString,
604
+ (x) => Included$inboundSchema.parse(JSON.parse(x)),
605
+ `Failed to parse 'Included' from JSON`,
606
+ );
607
+ }
608
+
609
+ /** @internal */
610
+ export const Links$inboundSchema: z.ZodType<Links, z.ZodTypeDef, unknown> = z
611
+ .object({});
612
+
613
+ /** @internal */
614
+ export type Links$Outbound = {};
615
+
616
+ /** @internal */
617
+ export const Links$outboundSchema: z.ZodType<
618
+ Links$Outbound,
619
+ z.ZodTypeDef,
620
+ Links
621
+ > = z.object({});
622
+
623
+ /**
624
+ * @internal
625
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
626
+ */
627
+ export namespace Links$ {
628
+ /** @deprecated use `Links$inboundSchema` instead. */
629
+ export const inboundSchema = Links$inboundSchema;
630
+ /** @deprecated use `Links$outboundSchema` instead. */
631
+ export const outboundSchema = Links$outboundSchema;
632
+ /** @deprecated use `Links$Outbound` instead. */
633
+ export type Outbound = Links$Outbound;
634
+ }
635
+
636
+ export function linksToJSON(links: Links): string {
637
+ return JSON.stringify(Links$outboundSchema.parse(links));
638
+ }
639
+
640
+ export function linksFromJSON(
641
+ jsonString: string,
642
+ ): SafeParseResult<Links, SDKValidationError> {
643
+ return safeParse(
644
+ jsonString,
645
+ (x) => Links$inboundSchema.parse(JSON.parse(x)),
646
+ `Failed to parse 'Links' from JSON`,
647
+ );
648
+ }
649
+
146
650
  /** @internal */
147
651
  export const CreateApplicationResponseBody$inboundSchema: z.ZodType<
148
652
  CreateApplicationResponseBody,
@@ -150,15 +654,31 @@ export const CreateApplicationResponseBody$inboundSchema: z.ZodType<
150
654
  unknown
151
655
  > = z.object({
152
656
  data: components.ApplicationResource$inboundSchema,
153
- included: z.array(components.ApplicationResource$inboundSchema).optional(),
154
- links: components.LinkObject$inboundSchema.optional(),
657
+ included: z.array(
658
+ z.union([
659
+ z.lazy(() => One$inboundSchema),
660
+ z.lazy(() => Two$inboundSchema),
661
+ z.lazy(() => Three$inboundSchema),
662
+ z.lazy(() => Four$inboundSchema),
663
+ z.lazy(() => Five$inboundSchema),
664
+ ]),
665
+ ).optional(),
666
+ links: z.lazy(() => Links$inboundSchema).optional(),
155
667
  });
156
668
 
157
669
  /** @internal */
158
670
  export type CreateApplicationResponseBody$Outbound = {
159
671
  data: components.ApplicationResource$Outbound;
160
- included?: Array<components.ApplicationResource$Outbound> | undefined;
161
- links?: components.LinkObject$Outbound | undefined;
672
+ included?:
673
+ | Array<
674
+ | One$Outbound
675
+ | Two$Outbound
676
+ | Three$Outbound
677
+ | Four$Outbound
678
+ | Five$Outbound
679
+ >
680
+ | undefined;
681
+ links?: Links$Outbound | undefined;
162
682
  };
163
683
 
164
684
  /** @internal */
@@ -168,8 +688,16 @@ export const CreateApplicationResponseBody$outboundSchema: z.ZodType<
168
688
  CreateApplicationResponseBody
169
689
  > = z.object({
170
690
  data: components.ApplicationResource$outboundSchema,
171
- included: z.array(components.ApplicationResource$outboundSchema).optional(),
172
- links: components.LinkObject$outboundSchema.optional(),
691
+ included: z.array(
692
+ z.union([
693
+ z.lazy(() => One$outboundSchema),
694
+ z.lazy(() => Two$outboundSchema),
695
+ z.lazy(() => Three$outboundSchema),
696
+ z.lazy(() => Four$outboundSchema),
697
+ z.lazy(() => Five$outboundSchema),
698
+ ]),
699
+ ).optional(),
700
+ links: z.lazy(() => Links$outboundSchema).optional(),
173
701
  });
174
702
 
175
703
  /**