@devizovaburza/mdm-sdk 1.1.0 → 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);
@@ -1145,7 +1153,7 @@ const ownerSelectSchema = individualSelectSchema.extend({
1145
1153
  shareEstablishedAt: z.string().nullable(),
1146
1154
  address: addressSelectSchema.nullable()
1147
1155
  });
1148
- createInsertSchema(party);
1156
+ const partyInsertSchema = createInsertSchema(party);
1149
1157
  createUpdateSchema(party);
1150
1158
  const partySchema$2 = z.object({
1151
1159
  partyType: z.enum(PARTY_TYPE),
@@ -1309,7 +1317,8 @@ const traderInsertSchema = z.object({
1309
1317
  companyName: z.string().optional(),
1310
1318
  ico: z.string().optional(),
1311
1319
  dic: z.string().optional(),
1312
- legacyId: z.string().optional()
1320
+ legacyId: z.string().optional(),
1321
+ parentTraderId: z.uuid().optional()
1313
1322
  });
1314
1323
  const traderUpdateSchema = z.object({
1315
1324
  id: z.uuid(),
@@ -1321,7 +1330,8 @@ const traderUpdateSchema = z.object({
1321
1330
  companyName: z.string().optional(),
1322
1331
  ico: z.string().optional(),
1323
1332
  dic: z.string().optional(),
1324
- legacyId: z.string().optional()
1333
+ legacyId: z.string().optional(),
1334
+ parentTraderId: z.uuid().optional()
1325
1335
  });
1326
1336
  z.object({
1327
1337
  id: z.uuid(),
@@ -1336,27 +1346,42 @@ z.object({
1336
1346
  companyName: z.string().nullable(),
1337
1347
  ico: z.string().nullable(),
1338
1348
  dic: z.string().nullable(),
1339
- legacyId: z.string().nullable()
1349
+ legacyId: z.string().nullable(),
1350
+ parentTraderId: z.uuid().nullable()
1351
+ });
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()
1340
1367
  });
1368
+ paginationSchema.extend({
1369
+ id: z.uuid()
1370
+ });
1371
+ z.object({ partyId: z.uuid() });
1341
1372
 
1342
1373
  z.object({
1343
- recipient: recipientInsertSchema,
1344
- partyId: z.string().uuid()
1374
+ trader: traderInsertSchema
1345
1375
  });
1346
1376
 
1347
1377
  z.object({
1348
- recipient: recipientUpdateSchema
1378
+ trader: traderUpdateSchema
1349
1379
  });
1350
1380
 
1351
1381
  z.object({
1352
1382
  id: z.uuid()
1353
1383
  });
1354
1384
 
1355
- const ALLOWED_RECIPIENTS_FILTERS = {
1356
- NAME: "filterRecipientName",
1357
- BANK_CODE: "filterRecipientBankCode",
1358
- CURRENCY: "filterRecipientCurrency"
1359
- };
1360
1385
  z.object({
1361
1386
  page: z.number().positive(),
1362
1387
  limit: z.number().positive(),
@@ -1364,10 +1389,8 @@ z.object({
1364
1389
  column: z.string(),
1365
1390
  direction: z.enum(["asc", "desc"])
1366
1391
  }),
1367
- [ALLOWED_RECIPIENTS_FILTERS.NAME]: z.union([z.string(), z.string().array()]).optional(),
1368
- [ALLOWED_RECIPIENTS_FILTERS.BANK_CODE]: z.union([z.enum(BANK_CODES), z.enum(BANK_CODES).array()]).optional(),
1369
- [ALLOWED_RECIPIENTS_FILTERS.CURRENCY]: z.union([z.enum(CURRENCY_CODES), z.enum(CURRENCY_CODES).array()]).optional(),
1370
- search: z.string().optional()
1392
+ search: z.string().optional(),
1393
+ ids: z.array(z.uuid()).optional()
1371
1394
  });
1372
1395
 
1373
1396
  z.object({
@@ -1375,17 +1398,31 @@ z.object({
1375
1398
  });
1376
1399
 
1377
1400
  z.object({
1378
- trader: traderInsertSchema
1401
+ traderId: z.uuid(),
1402
+ clientId: z.uuid()
1403
+ });
1404
+ z.object({
1405
+ id: z.uuid()
1379
1406
  });
1380
1407
 
1381
1408
  z.object({
1382
- trader: traderUpdateSchema
1409
+ recipient: recipientInsertSchema,
1410
+ partyId: z.string().uuid()
1411
+ });
1412
+
1413
+ z.object({
1414
+ recipient: recipientUpdateSchema
1383
1415
  });
1384
1416
 
1385
1417
  z.object({
1386
1418
  id: z.uuid()
1387
1419
  });
1388
1420
 
1421
+ const ALLOWED_RECIPIENTS_FILTERS = {
1422
+ NAME: "filterRecipientName",
1423
+ BANK_CODE: "filterRecipientBankCode",
1424
+ CURRENCY: "filterRecipientCurrency"
1425
+ };
1389
1426
  z.object({
1390
1427
  page: z.number().positive(),
1391
1428
  limit: z.number().positive(),
@@ -1393,20 +1430,10 @@ z.object({
1393
1430
  column: z.string(),
1394
1431
  direction: z.enum(["asc", "desc"])
1395
1432
  }),
1396
- search: z.string().optional(),
1397
- ids: z.array(z.uuid()).optional()
1398
- });
1399
-
1400
- z.object({
1401
- id: z.uuid()
1402
- });
1403
-
1404
- z.object({
1405
- traderId: z.uuid(),
1406
- clientId: z.uuid()
1407
- });
1408
- z.object({
1409
- 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()
1410
1437
  });
1411
1438
 
1412
1439
  z.object({
@@ -1443,6 +1470,10 @@ z.object({
1443
1470
  id: z.uuid()
1444
1471
  });
1445
1472
 
1473
+ z.object({
1474
+ id: z.uuid()
1475
+ });
1476
+
1446
1477
  z.object({
1447
1478
  contact: contactInsertSchema,
1448
1479
  partyId: z.string().uuid()
@@ -1488,15 +1519,15 @@ z.object({
1488
1519
  });
1489
1520
 
1490
1521
  z.object({
1491
- id: z.uuid()
1522
+ individual: individualInsertSchema$1
1492
1523
  });
1493
1524
 
1494
1525
  z.object({
1495
- organization: organizationInsertSchema
1526
+ individual: individualInsertSchema$1
1496
1527
  });
1497
1528
 
1498
1529
  z.object({
1499
- organization: organizationInsertSchema
1530
+ id: z.uuid()
1500
1531
  });
1501
1532
 
1502
1533
  z.object({
@@ -1508,11 +1539,11 @@ z.object({
1508
1539
  });
1509
1540
 
1510
1541
  z.object({
1511
- individual: individualInsertSchema$1
1542
+ id: z.uuid()
1512
1543
  });
1513
1544
 
1514
1545
  z.object({
1515
- individual: individualInsertSchema$1
1546
+ id: z.uuid()
1516
1547
  });
1517
1548
 
1518
1549
  z.object({
@@ -1522,19 +1553,34 @@ z.object({
1522
1553
  z.object({
1523
1554
  id: z.uuid()
1524
1555
  });
1556
+ z.object({
1557
+ disponents: disponentsSelectSchema
1558
+ });
1525
1559
 
1526
1560
  z.object({
1527
- aml: amlInsertSchema
1561
+ party: partyInsertSchema
1528
1562
  });
1529
1563
 
1530
1564
  z.object({
1531
- aml: amlInsertSchema
1565
+ party: partyInsertSchema
1566
+ });
1567
+
1568
+ z.object({
1569
+ id: z.uuid()
1532
1570
  });
1533
1571
 
1534
1572
  z.object({
1535
1573
  id: z.uuid()
1536
1574
  });
1537
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
+
1538
1584
  const routeError = z$1.object({
1539
1585
  message: z$1.string(),
1540
1586
  data: z$1.null(),
@@ -2985,26 +3031,6 @@ new OpenAPIHono().openapi(
2985
3031
  }
2986
3032
  );
2987
3033
 
2988
- const paginationSchema = z.object({
2989
- offset: z.number().default(1),
2990
- limit: z.number().default(10)
2991
- });
2992
- const paginationAndSearchSchema = z.object({
2993
- page: z.coerce.number().positive().default(1),
2994
- limit: z.coerce.number().positive().default(20),
2995
- column: z.string(),
2996
- direction: z.enum(["asc", "desc"]),
2997
- search: z.string().optional(),
2998
- ids: z.string().array().optional()
2999
- });
3000
- paginationSchema.extend({
3001
- partyId: z.uuid()
3002
- });
3003
- paginationSchema.extend({
3004
- id: z.uuid()
3005
- });
3006
- z.object({ partyId: z.uuid() });
3007
-
3008
3034
  const partiesOutputDataSchema = z$1.array(partyOutputSchema);
3009
3035
  const getPartiesRoute = createRoute({
3010
3036
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devizovaburza/mdm-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "prepare": "bun run build",