@devizovaburza/mdm-sdk 1.0.1 → 1.1.1

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.
@@ -14,17 +14,13 @@ declare const partnerApi: OpenAPIHono<{
14
14
  input: {};
15
15
  output: {
16
16
  message: string;
17
- response: hono_utils_types.JSONValue;
17
+ response: {
18
+ instanceId: string;
19
+ status: hono_utils_types.JSONValue;
20
+ };
18
21
  };
19
22
  outputFormat: "json";
20
23
  status: 200;
21
- } | {
22
- input: {};
23
- output: {
24
- message: string;
25
- };
26
- outputFormat: "json";
27
- status: 404;
28
24
  } | {
29
25
  input: {};
30
26
  output: {
@@ -772,6 +768,7 @@ declare const partnerApi: OpenAPIHono<{
772
768
  ico?: string | undefined;
773
769
  dic?: string | undefined;
774
770
  commission?: number | undefined;
771
+ parentTraderId?: string | undefined;
775
772
  };
776
773
  };
777
774
  output: {
@@ -789,6 +786,7 @@ declare const partnerApi: OpenAPIHono<{
789
786
  ico: string | null;
790
787
  dic: string | null;
791
788
  commission: number;
789
+ parentTraderId: string | null;
792
790
  legacyId: string | null;
793
791
  };
794
792
  };
@@ -815,6 +813,7 @@ declare const partnerApi: OpenAPIHono<{
815
813
  ico?: string | undefined;
816
814
  dic?: string | undefined;
817
815
  commission?: number | undefined;
816
+ parentTraderId?: string | undefined;
818
817
  };
819
818
  };
820
819
  output: {
@@ -843,6 +842,7 @@ declare const partnerApi: OpenAPIHono<{
843
842
  ico?: string | undefined;
844
843
  dic?: string | undefined;
845
844
  commission?: number | undefined;
845
+ parentTraderId?: string | undefined;
846
846
  };
847
847
  };
848
848
  output: {
@@ -875,6 +875,7 @@ declare const partnerApi: OpenAPIHono<{
875
875
  ico: string | null;
876
876
  dic: string | null;
877
877
  commission: number;
878
+ parentTraderId: string | null;
878
879
  legacyId: string | null;
879
880
  numberOfClients: number;
880
881
  };
@@ -925,6 +926,7 @@ declare const partnerApi: OpenAPIHono<{
925
926
  ico?: string | undefined;
926
927
  dic?: string | undefined;
927
928
  internalId?: string | undefined;
929
+ parentTraderId?: string | undefined;
928
930
  };
929
931
  };
930
932
  };
@@ -943,6 +945,7 @@ declare const partnerApi: OpenAPIHono<{
943
945
  ico: string | null;
944
946
  dic: string | null;
945
947
  commission: number;
948
+ parentTraderId: string | null;
946
949
  legacyId: string | null;
947
950
  };
948
951
  };
@@ -966,6 +969,7 @@ declare const partnerApi: OpenAPIHono<{
966
969
  ico?: string | undefined;
967
970
  dic?: string | undefined;
968
971
  internalId?: string | undefined;
972
+ parentTraderId?: string | undefined;
969
973
  };
970
974
  };
971
975
  };
@@ -992,6 +996,7 @@ declare const partnerApi: OpenAPIHono<{
992
996
  ico?: string | undefined;
993
997
  dic?: string | undefined;
994
998
  internalId?: string | undefined;
999
+ parentTraderId?: string | undefined;
995
1000
  };
996
1001
  };
997
1002
  };
@@ -1033,6 +1038,7 @@ declare const partnerApi: OpenAPIHono<{
1033
1038
  ico: string | null;
1034
1039
  dic: string | null;
1035
1040
  commission: number;
1041
+ parentTraderId: string | null;
1036
1042
  legacyId: string | null;
1037
1043
  numberOfClients: number;
1038
1044
  }[];
@@ -1096,6 +1102,7 @@ declare const partnerApi: OpenAPIHono<{
1096
1102
  ico: string | null;
1097
1103
  dic: string | null;
1098
1104
  commission: number;
1105
+ parentTraderId: string | null;
1099
1106
  legacyId: string | null;
1100
1107
  }[];
1101
1108
  };
@@ -14,17 +14,13 @@ declare const partnerApi: OpenAPIHono<{
14
14
  input: {};
15
15
  output: {
16
16
  message: string;
17
- response: hono_utils_types.JSONValue;
17
+ response: {
18
+ instanceId: string;
19
+ status: hono_utils_types.JSONValue;
20
+ };
18
21
  };
19
22
  outputFormat: "json";
20
23
  status: 200;
21
- } | {
22
- input: {};
23
- output: {
24
- message: string;
25
- };
26
- outputFormat: "json";
27
- status: 404;
28
24
  } | {
29
25
  input: {};
30
26
  output: {
@@ -772,6 +768,7 @@ declare const partnerApi: OpenAPIHono<{
772
768
  ico?: string | undefined;
773
769
  dic?: string | undefined;
774
770
  commission?: number | undefined;
771
+ parentTraderId?: string | undefined;
775
772
  };
776
773
  };
777
774
  output: {
@@ -789,6 +786,7 @@ declare const partnerApi: OpenAPIHono<{
789
786
  ico: string | null;
790
787
  dic: string | null;
791
788
  commission: number;
789
+ parentTraderId: string | null;
792
790
  legacyId: string | null;
793
791
  };
794
792
  };
@@ -815,6 +813,7 @@ declare const partnerApi: OpenAPIHono<{
815
813
  ico?: string | undefined;
816
814
  dic?: string | undefined;
817
815
  commission?: number | undefined;
816
+ parentTraderId?: string | undefined;
818
817
  };
819
818
  };
820
819
  output: {
@@ -843,6 +842,7 @@ declare const partnerApi: OpenAPIHono<{
843
842
  ico?: string | undefined;
844
843
  dic?: string | undefined;
845
844
  commission?: number | undefined;
845
+ parentTraderId?: string | undefined;
846
846
  };
847
847
  };
848
848
  output: {
@@ -875,6 +875,7 @@ declare const partnerApi: OpenAPIHono<{
875
875
  ico: string | null;
876
876
  dic: string | null;
877
877
  commission: number;
878
+ parentTraderId: string | null;
878
879
  legacyId: string | null;
879
880
  numberOfClients: number;
880
881
  };
@@ -925,6 +926,7 @@ declare const partnerApi: OpenAPIHono<{
925
926
  ico?: string | undefined;
926
927
  dic?: string | undefined;
927
928
  internalId?: string | undefined;
929
+ parentTraderId?: string | undefined;
928
930
  };
929
931
  };
930
932
  };
@@ -943,6 +945,7 @@ declare const partnerApi: OpenAPIHono<{
943
945
  ico: string | null;
944
946
  dic: string | null;
945
947
  commission: number;
948
+ parentTraderId: string | null;
946
949
  legacyId: string | null;
947
950
  };
948
951
  };
@@ -966,6 +969,7 @@ declare const partnerApi: OpenAPIHono<{
966
969
  ico?: string | undefined;
967
970
  dic?: string | undefined;
968
971
  internalId?: string | undefined;
972
+ parentTraderId?: string | undefined;
969
973
  };
970
974
  };
971
975
  };
@@ -992,6 +996,7 @@ declare const partnerApi: OpenAPIHono<{
992
996
  ico?: string | undefined;
993
997
  dic?: string | undefined;
994
998
  internalId?: string | undefined;
999
+ parentTraderId?: string | undefined;
995
1000
  };
996
1001
  };
997
1002
  };
@@ -1033,6 +1038,7 @@ declare const partnerApi: OpenAPIHono<{
1033
1038
  ico: string | null;
1034
1039
  dic: string | null;
1035
1040
  commission: number;
1041
+ parentTraderId: string | null;
1036
1042
  legacyId: string | null;
1037
1043
  numberOfClients: number;
1038
1044
  }[];
@@ -1096,6 +1102,7 @@ declare const partnerApi: OpenAPIHono<{
1096
1102
  ico: string | null;
1097
1103
  dic: string | null;
1098
1104
  commission: number;
1105
+ parentTraderId: string | null;
1099
1106
  legacyId: string | null;
1100
1107
  }[];
1101
1108
  };
package/dist/v1/index.mjs CHANGED
@@ -3,8 +3,9 @@ import { z as z$1, createRoute, OpenAPIHono } from '@hono/zod-openapi';
3
3
  import { COUNTRY_CODES_2, LANGUAGE_CODES, CZ_TRADE_LICENSE_CODES, CZ_NACE_CODES, CURRENCY_CODES, BANK_CODES } from '@develit-io/general-codes';
4
4
  import { z } from 'zod';
5
5
  import { base, bankAccount as bankAccount$1, bankAccountMetadataSchema } from '@develit-io/backend-sdk';
6
- import { sqliteTable, text, integer, real, uniqueIndex } from 'drizzle-orm/sqlite-core';
6
+ import { sqliteTable, text, integer, real, foreignKey, uniqueIndex } from 'drizzle-orm/sqlite-core';
7
7
  import { createInsertSchema, createUpdateSchema, createSelectSchema } from 'drizzle-zod';
8
+ import 'drizzle-orm';
8
9
  import { jwt, signature, idempotency } from '@develit-io/backend-sdk/middlewares';
9
10
 
10
11
  const createMdmClient = (baseUrl, options) => {
@@ -548,18 +549,25 @@ const recipient = sqliteTable("recipient", {
548
549
  partyId: text("party_id").notNull().references(() => party.id)
549
550
  });
550
551
 
551
- const trader = sqliteTable("trader", {
552
- ...base,
553
- internalId: text("internal_id"),
554
- type: text("trader", { length: 50, enum: TRADER_TYPE }).$type().notNull(),
555
- firstName: text("first_name", { length: 255 }),
556
- lastName: text("last_name", { length: 255 }),
557
- companyName: text("company_name", { length: 255 }),
558
- ico: text("ico", { length: 255 }),
559
- dic: text("dic", { length: 255 }),
560
- commission: real("commission").notNull(),
561
- legacyId: text("legacy_id")
562
- });
552
+ const trader = sqliteTable(
553
+ "trader",
554
+ {
555
+ ...base,
556
+ internalId: text("internal_id"),
557
+ type: text("trader", { length: 50, enum: TRADER_TYPE }).$type().notNull(),
558
+ firstName: text("first_name", { length: 255 }),
559
+ lastName: text("last_name", { length: 255 }),
560
+ companyName: text("company_name", { length: 255 }),
561
+ ico: text("ico", { length: 255 }),
562
+ dic: text("dic", { length: 255 }),
563
+ commission: real("commission").notNull(),
564
+ legacyId: text("legacy_id"),
565
+ parentTraderId: text("parent_trader_id")
566
+ },
567
+ (table) => [
568
+ foreignKey({ columns: [table.parentTraderId], foreignColumns: [table.id] })
569
+ ]
570
+ );
563
571
 
564
572
  sqliteTable("trader_client", {
565
573
  ...base,
@@ -1063,7 +1071,7 @@ const disponentSelectSchema = z.discriminatedUnion("partyType", [
1063
1071
  data: organizationSelectSchema
1064
1072
  })
1065
1073
  ]);
1066
- z.array(disponentSelectSchema).optional();
1074
+ const disponentsSelectSchema = z.array(disponentSelectSchema).optional();
1067
1075
  z.array(disponentUpdateSchema).optional();
1068
1076
 
1069
1077
  const recipientBaseInsertSchema = createInsertSchema(recipient);
@@ -1137,14 +1145,15 @@ const ownerSyncSchema$1 = individualInsertSchema$1.omit({ partyId: true }).exten
1137
1145
  });
1138
1146
  const legalRepresentativeSelectSchema = individualSelectSchema.extend({
1139
1147
  dateOfEstablishment: z.string().nullable(),
1140
- address: addressSelectSchema.nullable()
1148
+ address: addressSelectSchema.nullable(),
1149
+ identityDocuments: z.array(idDocumentSelectSchema).nullable()
1141
1150
  });
1142
1151
  const ownerSelectSchema = individualSelectSchema.extend({
1143
1152
  sharePercentage: z.number().nullable(),
1144
1153
  shareEstablishedAt: z.string().nullable(),
1145
1154
  address: addressSelectSchema.nullable()
1146
1155
  });
1147
- createInsertSchema(party);
1156
+ const partyInsertSchema = createInsertSchema(party);
1148
1157
  createUpdateSchema(party);
1149
1158
  const partySchema$2 = z.object({
1150
1159
  partyType: z.enum(PARTY_TYPE),
@@ -1308,7 +1317,8 @@ const traderInsertSchema = z.object({
1308
1317
  companyName: z.string().optional(),
1309
1318
  ico: z.string().optional(),
1310
1319
  dic: z.string().optional(),
1311
- legacyId: z.string().optional()
1320
+ legacyId: z.string().optional(),
1321
+ parentTraderId: z.uuid().optional()
1312
1322
  });
1313
1323
  const traderUpdateSchema = z.object({
1314
1324
  id: z.uuid(),
@@ -1320,7 +1330,8 @@ const traderUpdateSchema = z.object({
1320
1330
  companyName: z.string().optional(),
1321
1331
  ico: z.string().optional(),
1322
1332
  dic: z.string().optional(),
1323
- legacyId: z.string().optional()
1333
+ legacyId: z.string().optional(),
1334
+ parentTraderId: z.uuid().optional()
1324
1335
  });
1325
1336
  z.object({
1326
1337
  id: z.uuid(),
@@ -1335,27 +1346,42 @@ z.object({
1335
1346
  companyName: z.string().nullable(),
1336
1347
  ico: z.string().nullable(),
1337
1348
  dic: z.string().nullable(),
1338
- legacyId: z.string().nullable()
1349
+ legacyId: z.string().nullable(),
1350
+ parentTraderId: z.uuid().nullable()
1339
1351
  });
1340
1352
 
1353
+ const paginationSchema = z.object({
1354
+ offset: z.number().default(1),
1355
+ limit: z.number().default(10)
1356
+ });
1357
+ const paginationAndSearchSchema = z.object({
1358
+ page: z.coerce.number().positive().default(1),
1359
+ limit: z.coerce.number().positive().default(20),
1360
+ column: z.string(),
1361
+ direction: z.enum(["asc", "desc"]),
1362
+ search: z.string().optional(),
1363
+ ids: z.string().array().optional()
1364
+ });
1365
+ paginationSchema.extend({
1366
+ partyId: z.uuid()
1367
+ });
1368
+ paginationSchema.extend({
1369
+ id: z.uuid()
1370
+ });
1371
+ z.object({ partyId: z.uuid() });
1372
+
1341
1373
  z.object({
1342
- recipient: recipientInsertSchema,
1343
- partyId: z.string().uuid()
1374
+ trader: traderInsertSchema
1344
1375
  });
1345
1376
 
1346
1377
  z.object({
1347
- recipient: recipientUpdateSchema
1378
+ trader: traderUpdateSchema
1348
1379
  });
1349
1380
 
1350
1381
  z.object({
1351
1382
  id: z.uuid()
1352
1383
  });
1353
1384
 
1354
- const ALLOWED_RECIPIENTS_FILTERS = {
1355
- NAME: "filterRecipientName",
1356
- BANK_CODE: "filterRecipientBankCode",
1357
- CURRENCY: "filterRecipientCurrency"
1358
- };
1359
1385
  z.object({
1360
1386
  page: z.number().positive(),
1361
1387
  limit: z.number().positive(),
@@ -1363,10 +1389,8 @@ z.object({
1363
1389
  column: z.string(),
1364
1390
  direction: z.enum(["asc", "desc"])
1365
1391
  }),
1366
- [ALLOWED_RECIPIENTS_FILTERS.NAME]: z.union([z.string(), z.string().array()]).optional(),
1367
- [ALLOWED_RECIPIENTS_FILTERS.BANK_CODE]: z.union([z.enum(BANK_CODES), z.enum(BANK_CODES).array()]).optional(),
1368
- [ALLOWED_RECIPIENTS_FILTERS.CURRENCY]: z.union([z.enum(CURRENCY_CODES), z.enum(CURRENCY_CODES).array()]).optional(),
1369
- search: z.string().optional()
1392
+ search: z.string().optional(),
1393
+ ids: z.array(z.uuid()).optional()
1370
1394
  });
1371
1395
 
1372
1396
  z.object({
@@ -1374,17 +1398,31 @@ z.object({
1374
1398
  });
1375
1399
 
1376
1400
  z.object({
1377
- trader: traderInsertSchema
1401
+ traderId: z.uuid(),
1402
+ clientId: z.uuid()
1403
+ });
1404
+ z.object({
1405
+ id: z.uuid()
1378
1406
  });
1379
1407
 
1380
1408
  z.object({
1381
- trader: traderUpdateSchema
1409
+ recipient: recipientInsertSchema,
1410
+ partyId: z.string().uuid()
1411
+ });
1412
+
1413
+ z.object({
1414
+ recipient: recipientUpdateSchema
1382
1415
  });
1383
1416
 
1384
1417
  z.object({
1385
1418
  id: z.uuid()
1386
1419
  });
1387
1420
 
1421
+ const ALLOWED_RECIPIENTS_FILTERS = {
1422
+ NAME: "filterRecipientName",
1423
+ BANK_CODE: "filterRecipientBankCode",
1424
+ CURRENCY: "filterRecipientCurrency"
1425
+ };
1388
1426
  z.object({
1389
1427
  page: z.number().positive(),
1390
1428
  limit: z.number().positive(),
@@ -1392,20 +1430,10 @@ z.object({
1392
1430
  column: z.string(),
1393
1431
  direction: z.enum(["asc", "desc"])
1394
1432
  }),
1395
- search: z.string().optional(),
1396
- ids: z.array(z.uuid()).optional()
1397
- });
1398
-
1399
- z.object({
1400
- id: z.uuid()
1401
- });
1402
-
1403
- z.object({
1404
- traderId: z.uuid(),
1405
- clientId: z.uuid()
1406
- });
1407
- z.object({
1408
- id: z.uuid()
1433
+ [ALLOWED_RECIPIENTS_FILTERS.NAME]: z.union([z.string(), z.string().array()]).optional(),
1434
+ [ALLOWED_RECIPIENTS_FILTERS.BANK_CODE]: z.union([z.enum(BANK_CODES), z.enum(BANK_CODES).array()]).optional(),
1435
+ [ALLOWED_RECIPIENTS_FILTERS.CURRENCY]: z.union([z.enum(CURRENCY_CODES), z.enum(CURRENCY_CODES).array()]).optional(),
1436
+ search: z.string().optional()
1409
1437
  });
1410
1438
 
1411
1439
  z.object({
@@ -1442,6 +1470,10 @@ z.object({
1442
1470
  id: z.uuid()
1443
1471
  });
1444
1472
 
1473
+ z.object({
1474
+ id: z.uuid()
1475
+ });
1476
+
1445
1477
  z.object({
1446
1478
  contact: contactInsertSchema,
1447
1479
  partyId: z.string().uuid()
@@ -1487,15 +1519,15 @@ z.object({
1487
1519
  });
1488
1520
 
1489
1521
  z.object({
1490
- id: z.uuid()
1522
+ individual: individualInsertSchema$1
1491
1523
  });
1492
1524
 
1493
1525
  z.object({
1494
- organization: organizationInsertSchema
1526
+ individual: individualInsertSchema$1
1495
1527
  });
1496
1528
 
1497
1529
  z.object({
1498
- organization: organizationInsertSchema
1530
+ id: z.uuid()
1499
1531
  });
1500
1532
 
1501
1533
  z.object({
@@ -1507,11 +1539,11 @@ z.object({
1507
1539
  });
1508
1540
 
1509
1541
  z.object({
1510
- individual: individualInsertSchema$1
1542
+ id: z.uuid()
1511
1543
  });
1512
1544
 
1513
1545
  z.object({
1514
- individual: individualInsertSchema$1
1546
+ id: z.uuid()
1515
1547
  });
1516
1548
 
1517
1549
  z.object({
@@ -1521,19 +1553,34 @@ z.object({
1521
1553
  z.object({
1522
1554
  id: z.uuid()
1523
1555
  });
1556
+ z.object({
1557
+ disponents: disponentsSelectSchema
1558
+ });
1524
1559
 
1525
1560
  z.object({
1526
- aml: amlInsertSchema
1561
+ party: partyInsertSchema
1527
1562
  });
1528
1563
 
1529
1564
  z.object({
1530
- aml: amlInsertSchema
1565
+ party: partyInsertSchema
1566
+ });
1567
+
1568
+ z.object({
1569
+ id: z.uuid()
1531
1570
  });
1532
1571
 
1533
1572
  z.object({
1534
1573
  id: z.uuid()
1535
1574
  });
1536
1575
 
1576
+ z.object({
1577
+ fromPartyId: z.uuid(),
1578
+ toPartyId: z.uuid(),
1579
+ relationshipType: z.enum(PARTY_RELATIONSHIP_TYPE),
1580
+ fromDate: z.date().optional(),
1581
+ sharePercentage: z.number().max(100).optional()
1582
+ });
1583
+
1537
1584
  const routeError = z$1.object({
1538
1585
  message: z$1.string(),
1539
1586
  data: z$1.null(),
@@ -2984,26 +3031,6 @@ new OpenAPIHono().openapi(
2984
3031
  }
2985
3032
  );
2986
3033
 
2987
- const paginationSchema = z.object({
2988
- offset: z.number().default(1),
2989
- limit: z.number().default(10)
2990
- });
2991
- const paginationAndSearchSchema = z.object({
2992
- page: z.coerce.number().positive().default(1),
2993
- limit: z.coerce.number().positive().default(20),
2994
- column: z.string(),
2995
- direction: z.enum(["asc", "desc"]),
2996
- search: z.string().optional(),
2997
- ids: z.string().array().optional()
2998
- });
2999
- paginationSchema.extend({
3000
- partyId: z.uuid()
3001
- });
3002
- paginationSchema.extend({
3003
- id: z.uuid()
3004
- });
3005
- z.object({ partyId: z.uuid() });
3006
-
3007
3034
  const partiesOutputDataSchema = z$1.array(partyOutputSchema);
3008
3035
  const getPartiesRoute = createRoute({
3009
3036
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devizovaburza/mdm-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "prepare": "bun run build",