@devizovaburza/mdm-sdk 2.5.1 → 2.5.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.
@@ -540,6 +540,35 @@ declare const partnerApi: OpenAPIHono<AppEnv, hono_types.MergeSchemaPath<{
540
540
  };
541
541
  };
542
542
  }, "/v1/documents/:documentId"> & hono_types.MergeSchemaPath<{
543
+ "/": {
544
+ $post: {
545
+ input: {};
546
+ output: {
547
+ message: string;
548
+ documentId: string;
549
+ uploadUrl: string;
550
+ storageUrl: string;
551
+ expiresIn: number;
552
+ };
553
+ outputFormat: "json";
554
+ status: 200;
555
+ } | {
556
+ input: {};
557
+ output: {
558
+ message: string;
559
+ };
560
+ outputFormat: "json";
561
+ status: 400;
562
+ } | {
563
+ input: {};
564
+ output: {
565
+ message: string;
566
+ };
567
+ outputFormat: "json";
568
+ status: 500;
569
+ };
570
+ };
571
+ }, "/v1/documents/upload-url"> & hono_types.MergeSchemaPath<{
543
572
  "/": {
544
573
  $post: {
545
574
  input: {};
@@ -540,6 +540,35 @@ declare const partnerApi: OpenAPIHono<AppEnv, hono_types.MergeSchemaPath<{
540
540
  };
541
541
  };
542
542
  }, "/v1/documents/:documentId"> & hono_types.MergeSchemaPath<{
543
+ "/": {
544
+ $post: {
545
+ input: {};
546
+ output: {
547
+ message: string;
548
+ documentId: string;
549
+ uploadUrl: string;
550
+ storageUrl: string;
551
+ expiresIn: number;
552
+ };
553
+ outputFormat: "json";
554
+ status: 200;
555
+ } | {
556
+ input: {};
557
+ output: {
558
+ message: string;
559
+ };
560
+ outputFormat: "json";
561
+ status: 400;
562
+ } | {
563
+ input: {};
564
+ output: {
565
+ message: string;
566
+ };
567
+ outputFormat: "json";
568
+ status: 500;
569
+ };
570
+ };
571
+ }, "/v1/documents/upload-url"> & hono_types.MergeSchemaPath<{
543
572
  "/": {
544
573
  $post: {
545
574
  input: {};
package/dist/v1/index.mjs CHANGED
@@ -385,6 +385,16 @@ const requireRoutableAccount = (data, ctx, basePath = []) => {
385
385
  });
386
386
  }
387
387
  };
388
+ const zipCodeRegex = /^\d{3}\s?\d{2}$/;
389
+ const refineCzZipCode = (data, ctx) => {
390
+ if (data.countryCode === "CZ" && data.zipCode && !zipCodeRegex.test(data.zipCode)) {
391
+ ctx.addIssue({
392
+ code: "custom",
393
+ path: ["zipCode"],
394
+ message: "PS\u010C je v nespr\xE1vn\xE9m form\xE1tu"
395
+ });
396
+ }
397
+ };
388
398
 
389
399
  z.object({
390
400
  message: z.string(),
@@ -519,8 +529,7 @@ const disponentSchema = z.object({
519
529
  partyType: z.literal("INDIVIDUAL"),
520
530
  data: individualInsertSchema
521
531
  });
522
- const zipCodeRegex = /^\d{3}\s?\d{2}$/;
523
- const createAddressInputSchema = z.object({
532
+ const createAddressInputBaseSchema = z.object({
524
533
  addressType: z.enum(ADDRESS_TYPE),
525
534
  internalId: z.string().optional(),
526
535
  street: z.string().min(1, "Adresa je povinn\xE1"),
@@ -528,20 +537,21 @@ const createAddressInputSchema = z.object({
528
537
  descriptiveNumber: z.string().max(20, "\u010C\xEDslo popisn\xE9 je mimo povolen\xFD rozsah").optional(),
529
538
  municipality: z.string().min(1, "M\u011Bsto je povinn\xE9").max(255),
530
539
  municipalityPart: z.string().optional(),
531
- zipCode: z.string().min(1, "PS\u010C je povinn\xE9").max(20).regex(zipCodeRegex, "PS\u010C je v nespr\xE1vn\xE9m form\xE1tu"),
540
+ // CZ-only format applied via superRefine below so foreign zips are accepted.
541
+ zipCode: z.string().min(1, "PS\u010C je povinn\xE9").max(20),
532
542
  district: z.string().max(255),
533
543
  region: z.string().max(255),
534
544
  countryCode: z.enum(COUNTRY_CODES, "St\xE1t je povinn\xFD"),
535
545
  ruianCode: z.string().optional()
536
546
  });
537
- const ownerAddressInputSchema = createAddressInputSchema.extend({
547
+ const createAddressInputSchema = createAddressInputBaseSchema.superRefine(refineCzZipCode);
548
+ const ownerAddressInputBaseSchema = createAddressInputBaseSchema.extend({
538
549
  addressType: z.enum(ADDRESS_TYPE).default("PERMANENT_ADDRESS"),
539
550
  district: z.string().max(255).nullish(),
540
551
  region: z.string().max(255).nullish()
541
552
  });
542
- const legalRepresentativeAddressInputSchema = ownerAddressInputSchema.extend({
543
- street: z.string().optional()
544
- });
553
+ const ownerAddressInputSchema = ownerAddressInputBaseSchema.superRefine(refineCzZipCode);
554
+ const legalRepresentativeAddressInputSchema = ownerAddressInputBaseSchema.extend({ street: z.string().optional() }).superRefine(refineCzZipCode);
545
555
  const ownerIndividualInputSchema = individualInsertSchema.extend({
546
556
  email: z.email("E-mail je povinn\xFD").optional()
547
557
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devizovaburza/mdm-sdk",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
4
4
  "author": "Devizová burza a.s.",
5
5
  "license": "ISC",
6
6
  "type": "module",