postnl-client 0.1.0 → 0.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.
package/dist/index.d.cts CHANGED
@@ -3169,7 +3169,7 @@ declare const shipmentV4RequestSchema: z.ZodObject<{
3169
3169
  returnBarcode: z.ZodOptional<z.ZodString>;
3170
3170
  }, "strip", z.ZodTypeAny, {
3171
3171
  labelType?: string | undefined;
3172
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
3172
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
3173
3173
  returnAddress?: {
3174
3174
  countryIso: string;
3175
3175
  city?: string | undefined;
@@ -3191,7 +3191,7 @@ declare const shipmentV4RequestSchema: z.ZodObject<{
3191
3191
  returnBarcode?: string | undefined;
3192
3192
  }, {
3193
3193
  labelType?: string | undefined;
3194
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
3194
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
3195
3195
  returnAddress?: {
3196
3196
  countryIso: string;
3197
3197
  city?: string | undefined;
@@ -3561,7 +3561,7 @@ declare const shipmentV4RequestSchema: z.ZodObject<{
3561
3561
  } | undefined;
3562
3562
  returnOptions?: {
3563
3563
  labelType?: string | undefined;
3564
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
3564
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
3565
3565
  returnAddress?: {
3566
3566
  countryIso: string;
3567
3567
  city?: string | undefined;
@@ -3743,7 +3743,7 @@ declare const shipmentV4RequestSchema: z.ZodObject<{
3743
3743
  } | undefined;
3744
3744
  returnOptions?: {
3745
3745
  labelType?: string | undefined;
3746
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
3746
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
3747
3747
  returnAddress?: {
3748
3748
  countryIso: string;
3749
3749
  city?: string | undefined;
@@ -4402,7 +4402,7 @@ declare const labellingV4RequestSchema: z.ZodObject<{
4402
4402
  returnBarcode: z.ZodOptional<z.ZodString>;
4403
4403
  }, "strip", z.ZodTypeAny, {
4404
4404
  labelType?: string | undefined;
4405
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
4405
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
4406
4406
  returnAddress?: {
4407
4407
  countryIso: string;
4408
4408
  city?: string | undefined;
@@ -4424,7 +4424,7 @@ declare const labellingV4RequestSchema: z.ZodObject<{
4424
4424
  returnBarcode?: string | undefined;
4425
4425
  }, {
4426
4426
  labelType?: string | undefined;
4427
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
4427
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
4428
4428
  returnAddress?: {
4429
4429
  countryIso: string;
4430
4430
  city?: string | undefined;
@@ -4794,7 +4794,7 @@ declare const labellingV4RequestSchema: z.ZodObject<{
4794
4794
  } | undefined;
4795
4795
  returnOptions?: {
4796
4796
  labelType?: string | undefined;
4797
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
4797
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
4798
4798
  returnAddress?: {
4799
4799
  countryIso: string;
4800
4800
  city?: string | undefined;
@@ -4976,7 +4976,7 @@ declare const labellingV4RequestSchema: z.ZodObject<{
4976
4976
  } | undefined;
4977
4977
  returnOptions?: {
4978
4978
  labelType?: string | undefined;
4979
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
4979
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
4980
4980
  returnAddress?: {
4981
4981
  countryIso: string;
4982
4982
  city?: string | undefined;
@@ -5616,7 +5616,7 @@ declare const confirmV4RequestSchema: z.ZodObject<{
5616
5616
  returnBarcode: z.ZodOptional<z.ZodString>;
5617
5617
  }, "strip", z.ZodTypeAny, {
5618
5618
  labelType?: string | undefined;
5619
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
5619
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
5620
5620
  returnAddress?: {
5621
5621
  countryIso: string;
5622
5622
  city?: string | undefined;
@@ -5638,7 +5638,7 @@ declare const confirmV4RequestSchema: z.ZodObject<{
5638
5638
  returnBarcode?: string | undefined;
5639
5639
  }, {
5640
5640
  labelType?: string | undefined;
5641
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
5641
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
5642
5642
  returnAddress?: {
5643
5643
  countryIso: string;
5644
5644
  city?: string | undefined;
@@ -6001,7 +6001,7 @@ declare const confirmV4RequestSchema: z.ZodObject<{
6001
6001
  } | undefined;
6002
6002
  returnOptions?: {
6003
6003
  labelType?: string | undefined;
6004
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
6004
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
6005
6005
  returnAddress?: {
6006
6006
  countryIso: string;
6007
6007
  city?: string | undefined;
@@ -6176,7 +6176,7 @@ declare const confirmV4RequestSchema: z.ZodObject<{
6176
6176
  } | undefined;
6177
6177
  returnOptions?: {
6178
6178
  labelType?: string | undefined;
6179
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
6179
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
6180
6180
  returnAddress?: {
6181
6181
  countryIso: string;
6182
6182
  city?: string | undefined;
@@ -10535,7 +10535,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10535
10535
  Timeframe: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodObject<{
10536
10536
  Date: z.ZodEffects<z.ZodOptional<z.ZodString>, Date | undefined, string | undefined>;
10537
10537
  Timeframes: z.ZodEffects<z.ZodOptional<z.ZodObject<{
10538
- TimeframeTimeframe: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodObject<{
10538
+ TimeframeTimeFrame: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodObject<{
10539
10539
  From: z.ZodOptional<z.ZodString>;
10540
10540
  To: z.ZodOptional<z.ZodString>;
10541
10541
  Options: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], unknown>;
@@ -10597,7 +10597,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10597
10597
  };
10598
10598
  }[], unknown>;
10599
10599
  }, "strip", z.ZodTypeAny, {
10600
- TimeframeTimeframe: {
10600
+ TimeframeTimeFrame: {
10601
10601
  from?: string;
10602
10602
  to?: string;
10603
10603
  options?: string[];
@@ -10607,7 +10607,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10607
10607
  };
10608
10608
  }[];
10609
10609
  }, {
10610
- TimeframeTimeframe?: unknown;
10610
+ TimeframeTimeFrame?: unknown;
10611
10611
  }>>, {
10612
10612
  from?: string;
10613
10613
  to?: string;
@@ -10617,7 +10617,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10617
10617
  description?: string;
10618
10618
  };
10619
10619
  }[], {
10620
- TimeframeTimeframe?: unknown;
10620
+ TimeframeTimeFrame?: unknown;
10621
10621
  } | undefined>;
10622
10622
  }, "strip", z.ZodTypeAny, {
10623
10623
  Timeframes: {
@@ -10633,7 +10633,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10633
10633
  }, {
10634
10634
  Date?: string | undefined;
10635
10635
  Timeframes?: {
10636
- TimeframeTimeframe?: unknown;
10636
+ TimeframeTimeFrame?: unknown;
10637
10637
  } | undefined;
10638
10638
  }>, {
10639
10639
  timeframes: {
@@ -10649,7 +10649,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10649
10649
  }, {
10650
10650
  Date?: string | undefined;
10651
10651
  Timeframes?: {
10652
- TimeframeTimeframe?: unknown;
10652
+ TimeframeTimeFrame?: unknown;
10653
10653
  } | undefined;
10654
10654
  }>, "many">, {
10655
10655
  timeframes: {
@@ -12738,7 +12738,6 @@ declare class PostNLBadRequestError extends PostNLApiError {
12738
12738
  declare class PostNLServerError extends PostNLApiError {
12739
12739
  name: string;
12740
12740
  }
12741
- declare function parseError(status: number, body: unknown, headers?: Record<string, string>): PostNLApiError;
12742
12741
 
12743
12742
  declare const ProductCode: {
12744
12743
  readonly domesticParcel: "3085";
@@ -12749,4 +12748,4 @@ type ProductCodeValue = (typeof ProductCode)[keyof typeof ProductCode];
12749
12748
 
12750
12749
  declare const version = "0.1.0";
12751
12750
 
12752
- export { type AddressCheckInput, AddressResource, AddressType, AssociatedDocumentType, type BarcodeLegacyInput, BarcodeResource, BarcodeType, type BarcodeV4Request, type BarcodeV4Response, Bundle, type CheckoutAddressInput, CheckoutCutOffDay, type CheckoutCutOffTimeInput, CheckoutCutOffType, CheckoutOption, type CheckoutRequestInput, CheckoutResource, type CheckoutResponse, CheckoutWarningOption, type ConfirmV4Request, type ConfirmingRequest, type ConfirmingResponse, ConsolidationMode, CountryCode, Currency, type DecodedLabel, DeliveryConfirmation, type DeliveryDateCalculateInput, DeliveryDateResource, type DeliveryDateResponse, DeliverydateOption, Duration, GuaranteedBefore, IGNORED_LOCATION_OPTIONS, type LabelLegacyOptions, LabelType, LabellingCurrency, type LabellingRequest, type LabellingResponse, type LabellingV4Request, Language, type Location, type LocationAreaInput, LocationDeliveryOption, type LocationLookupInput, type LocationLookupResponse, type LocationNearestByGeocodeInput, type LocationNearestInput, LocationResource, type LocationsResponse, MergeType, MinimalAgeCheck, NetworkType, OriginCountryCode, OutputType, PageOrientation, Positioning, PostNLApiError, PostNLAuthError, PostNLBadRequestError, PostNLClient, type PostNLClientOptions, PostNLError, PostNLMethodNotAllowedError, PostNLRateLimitError, PostNLServerError, PostNLTimeoutError, PostNLValidationError, type PostalcodeCheckAddress, PrintMethod, ProductCode, type ProductCodeValue, ReceiverType, Resolution, type ReturnGenerateRequest, ReturnOutputType, ReturnPeriod, ReturnPeriodV4, ReturnResource, ReturnShipmentTypeV4, type SentDateInput, type SentDateResponse, Service, type ShipmentPostResponse, ShipmentTypeLegacy, ShipmentTypeV4, type ShipmentV4Request, ShippingResource, type ShippingStatusResponse, type SignatureImage, type SignatureResponse, StatusLanguage, SustainabilityCode, type TimeframeGetInput, TimeframeOption, TimeframeResource, type TimeframeResponse, type TrackingByReferenceOptions, type TrackingOptions, TrackingResource, type UpdatedShipment, type UpdatedShipmentsOptions, type UpdatedShipmentsResponse, decodeBase64, labelContentType, parseError, toDecodedLabel, version };
12751
+ export { type AddressCheckInput, AddressResource, AddressType, AssociatedDocumentType, type BarcodeLegacyInput, BarcodeResource, BarcodeType, type BarcodeV4Request, type BarcodeV4Response, Bundle, type CheckoutAddressInput, CheckoutCutOffDay, type CheckoutCutOffTimeInput, CheckoutCutOffType, CheckoutOption, type CheckoutRequestInput, CheckoutResource, type CheckoutResponse, CheckoutWarningOption, type ConfirmV4Request, type ConfirmingRequest, type ConfirmingResponse, ConsolidationMode, CountryCode, Currency, type DecodedLabel, DeliveryConfirmation, type DeliveryDateCalculateInput, DeliveryDateResource, type DeliveryDateResponse, DeliverydateOption, Duration, GuaranteedBefore, IGNORED_LOCATION_OPTIONS, type LabelLegacyOptions, LabelType, LabellingCurrency, type LabellingRequest, type LabellingResponse, type LabellingV4Request, Language, type Location, type LocationAreaInput, LocationDeliveryOption, type LocationLookupInput, type LocationLookupResponse, type LocationNearestByGeocodeInput, type LocationNearestInput, LocationResource, type LocationsResponse, MergeType, MinimalAgeCheck, NetworkType, OriginCountryCode, OutputType, PageOrientation, Positioning, PostNLApiError, PostNLAuthError, PostNLBadRequestError, PostNLClient, type PostNLClientOptions, PostNLError, PostNLMethodNotAllowedError, PostNLRateLimitError, PostNLServerError, PostNLTimeoutError, PostNLValidationError, type PostalcodeCheckAddress, PrintMethod, ProductCode, type ProductCodeValue, ReceiverType, Resolution, type ReturnGenerateRequest, ReturnOutputType, ReturnPeriod, ReturnPeriodV4, ReturnResource, ReturnShipmentTypeV4, type SentDateInput, type SentDateResponse, Service, type ShipmentPostResponse, ShipmentTypeLegacy, ShipmentTypeV4, type ShipmentV4Request, ShippingResource, type ShippingStatusResponse, type SignatureImage, type SignatureResponse, StatusLanguage, SustainabilityCode, type TimeframeGetInput, TimeframeOption, TimeframeResource, type TimeframeResponse, type TrackingByReferenceOptions, type TrackingOptions, TrackingResource, type UpdatedShipment, type UpdatedShipmentsOptions, type UpdatedShipmentsResponse, decodeBase64, labelContentType, toDecodedLabel, version };
package/dist/index.d.ts CHANGED
@@ -3169,7 +3169,7 @@ declare const shipmentV4RequestSchema: z.ZodObject<{
3169
3169
  returnBarcode: z.ZodOptional<z.ZodString>;
3170
3170
  }, "strip", z.ZodTypeAny, {
3171
3171
  labelType?: string | undefined;
3172
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
3172
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
3173
3173
  returnAddress?: {
3174
3174
  countryIso: string;
3175
3175
  city?: string | undefined;
@@ -3191,7 +3191,7 @@ declare const shipmentV4RequestSchema: z.ZodObject<{
3191
3191
  returnBarcode?: string | undefined;
3192
3192
  }, {
3193
3193
  labelType?: string | undefined;
3194
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
3194
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
3195
3195
  returnAddress?: {
3196
3196
  countryIso: string;
3197
3197
  city?: string | undefined;
@@ -3561,7 +3561,7 @@ declare const shipmentV4RequestSchema: z.ZodObject<{
3561
3561
  } | undefined;
3562
3562
  returnOptions?: {
3563
3563
  labelType?: string | undefined;
3564
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
3564
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
3565
3565
  returnAddress?: {
3566
3566
  countryIso: string;
3567
3567
  city?: string | undefined;
@@ -3743,7 +3743,7 @@ declare const shipmentV4RequestSchema: z.ZodObject<{
3743
3743
  } | undefined;
3744
3744
  returnOptions?: {
3745
3745
  labelType?: string | undefined;
3746
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
3746
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
3747
3747
  returnAddress?: {
3748
3748
  countryIso: string;
3749
3749
  city?: string | undefined;
@@ -4402,7 +4402,7 @@ declare const labellingV4RequestSchema: z.ZodObject<{
4402
4402
  returnBarcode: z.ZodOptional<z.ZodString>;
4403
4403
  }, "strip", z.ZodTypeAny, {
4404
4404
  labelType?: string | undefined;
4405
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
4405
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
4406
4406
  returnAddress?: {
4407
4407
  countryIso: string;
4408
4408
  city?: string | undefined;
@@ -4424,7 +4424,7 @@ declare const labellingV4RequestSchema: z.ZodObject<{
4424
4424
  returnBarcode?: string | undefined;
4425
4425
  }, {
4426
4426
  labelType?: string | undefined;
4427
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
4427
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
4428
4428
  returnAddress?: {
4429
4429
  countryIso: string;
4430
4430
  city?: string | undefined;
@@ -4794,7 +4794,7 @@ declare const labellingV4RequestSchema: z.ZodObject<{
4794
4794
  } | undefined;
4795
4795
  returnOptions?: {
4796
4796
  labelType?: string | undefined;
4797
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
4797
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
4798
4798
  returnAddress?: {
4799
4799
  countryIso: string;
4800
4800
  city?: string | undefined;
@@ -4976,7 +4976,7 @@ declare const labellingV4RequestSchema: z.ZodObject<{
4976
4976
  } | undefined;
4977
4977
  returnOptions?: {
4978
4978
  labelType?: string | undefined;
4979
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
4979
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
4980
4980
  returnAddress?: {
4981
4981
  countryIso: string;
4982
4982
  city?: string | undefined;
@@ -5616,7 +5616,7 @@ declare const confirmV4RequestSchema: z.ZodObject<{
5616
5616
  returnBarcode: z.ZodOptional<z.ZodString>;
5617
5617
  }, "strip", z.ZodTypeAny, {
5618
5618
  labelType?: string | undefined;
5619
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
5619
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
5620
5620
  returnAddress?: {
5621
5621
  countryIso: string;
5622
5622
  city?: string | undefined;
@@ -5638,7 +5638,7 @@ declare const confirmV4RequestSchema: z.ZodObject<{
5638
5638
  returnBarcode?: string | undefined;
5639
5639
  }, {
5640
5640
  labelType?: string | undefined;
5641
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
5641
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
5642
5642
  returnAddress?: {
5643
5643
  countryIso: string;
5644
5644
  city?: string | undefined;
@@ -6001,7 +6001,7 @@ declare const confirmV4RequestSchema: z.ZodObject<{
6001
6001
  } | undefined;
6002
6002
  returnOptions?: {
6003
6003
  labelType?: string | undefined;
6004
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
6004
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
6005
6005
  returnAddress?: {
6006
6006
  countryIso: string;
6007
6007
  city?: string | undefined;
@@ -6176,7 +6176,7 @@ declare const confirmV4RequestSchema: z.ZodObject<{
6176
6176
  } | undefined;
6177
6177
  returnOptions?: {
6178
6178
  labelType?: string | undefined;
6179
- returnPeriod?: 100 | 200 | 35 | 365 | undefined;
6179
+ returnPeriod?: 200 | 100 | 35 | 365 | undefined;
6180
6180
  returnAddress?: {
6181
6181
  countryIso: string;
6182
6182
  city?: string | undefined;
@@ -10535,7 +10535,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10535
10535
  Timeframe: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodObject<{
10536
10536
  Date: z.ZodEffects<z.ZodOptional<z.ZodString>, Date | undefined, string | undefined>;
10537
10537
  Timeframes: z.ZodEffects<z.ZodOptional<z.ZodObject<{
10538
- TimeframeTimeframe: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodObject<{
10538
+ TimeframeTimeFrame: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodObject<{
10539
10539
  From: z.ZodOptional<z.ZodString>;
10540
10540
  To: z.ZodOptional<z.ZodString>;
10541
10541
  Options: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], unknown>;
@@ -10597,7 +10597,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10597
10597
  };
10598
10598
  }[], unknown>;
10599
10599
  }, "strip", z.ZodTypeAny, {
10600
- TimeframeTimeframe: {
10600
+ TimeframeTimeFrame: {
10601
10601
  from?: string;
10602
10602
  to?: string;
10603
10603
  options?: string[];
@@ -10607,7 +10607,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10607
10607
  };
10608
10608
  }[];
10609
10609
  }, {
10610
- TimeframeTimeframe?: unknown;
10610
+ TimeframeTimeFrame?: unknown;
10611
10611
  }>>, {
10612
10612
  from?: string;
10613
10613
  to?: string;
@@ -10617,7 +10617,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10617
10617
  description?: string;
10618
10618
  };
10619
10619
  }[], {
10620
- TimeframeTimeframe?: unknown;
10620
+ TimeframeTimeFrame?: unknown;
10621
10621
  } | undefined>;
10622
10622
  }, "strip", z.ZodTypeAny, {
10623
10623
  Timeframes: {
@@ -10633,7 +10633,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10633
10633
  }, {
10634
10634
  Date?: string | undefined;
10635
10635
  Timeframes?: {
10636
- TimeframeTimeframe?: unknown;
10636
+ TimeframeTimeFrame?: unknown;
10637
10637
  } | undefined;
10638
10638
  }>, {
10639
10639
  timeframes: {
@@ -10649,7 +10649,7 @@ declare const timeframeResponseSchema: z.ZodEffects<z.ZodObject<{
10649
10649
  }, {
10650
10650
  Date?: string | undefined;
10651
10651
  Timeframes?: {
10652
- TimeframeTimeframe?: unknown;
10652
+ TimeframeTimeFrame?: unknown;
10653
10653
  } | undefined;
10654
10654
  }>, "many">, {
10655
10655
  timeframes: {
@@ -12738,7 +12738,6 @@ declare class PostNLBadRequestError extends PostNLApiError {
12738
12738
  declare class PostNLServerError extends PostNLApiError {
12739
12739
  name: string;
12740
12740
  }
12741
- declare function parseError(status: number, body: unknown, headers?: Record<string, string>): PostNLApiError;
12742
12741
 
12743
12742
  declare const ProductCode: {
12744
12743
  readonly domesticParcel: "3085";
@@ -12749,4 +12748,4 @@ type ProductCodeValue = (typeof ProductCode)[keyof typeof ProductCode];
12749
12748
 
12750
12749
  declare const version = "0.1.0";
12751
12750
 
12752
- export { type AddressCheckInput, AddressResource, AddressType, AssociatedDocumentType, type BarcodeLegacyInput, BarcodeResource, BarcodeType, type BarcodeV4Request, type BarcodeV4Response, Bundle, type CheckoutAddressInput, CheckoutCutOffDay, type CheckoutCutOffTimeInput, CheckoutCutOffType, CheckoutOption, type CheckoutRequestInput, CheckoutResource, type CheckoutResponse, CheckoutWarningOption, type ConfirmV4Request, type ConfirmingRequest, type ConfirmingResponse, ConsolidationMode, CountryCode, Currency, type DecodedLabel, DeliveryConfirmation, type DeliveryDateCalculateInput, DeliveryDateResource, type DeliveryDateResponse, DeliverydateOption, Duration, GuaranteedBefore, IGNORED_LOCATION_OPTIONS, type LabelLegacyOptions, LabelType, LabellingCurrency, type LabellingRequest, type LabellingResponse, type LabellingV4Request, Language, type Location, type LocationAreaInput, LocationDeliveryOption, type LocationLookupInput, type LocationLookupResponse, type LocationNearestByGeocodeInput, type LocationNearestInput, LocationResource, type LocationsResponse, MergeType, MinimalAgeCheck, NetworkType, OriginCountryCode, OutputType, PageOrientation, Positioning, PostNLApiError, PostNLAuthError, PostNLBadRequestError, PostNLClient, type PostNLClientOptions, PostNLError, PostNLMethodNotAllowedError, PostNLRateLimitError, PostNLServerError, PostNLTimeoutError, PostNLValidationError, type PostalcodeCheckAddress, PrintMethod, ProductCode, type ProductCodeValue, ReceiverType, Resolution, type ReturnGenerateRequest, ReturnOutputType, ReturnPeriod, ReturnPeriodV4, ReturnResource, ReturnShipmentTypeV4, type SentDateInput, type SentDateResponse, Service, type ShipmentPostResponse, ShipmentTypeLegacy, ShipmentTypeV4, type ShipmentV4Request, ShippingResource, type ShippingStatusResponse, type SignatureImage, type SignatureResponse, StatusLanguage, SustainabilityCode, type TimeframeGetInput, TimeframeOption, TimeframeResource, type TimeframeResponse, type TrackingByReferenceOptions, type TrackingOptions, TrackingResource, type UpdatedShipment, type UpdatedShipmentsOptions, type UpdatedShipmentsResponse, decodeBase64, labelContentType, parseError, toDecodedLabel, version };
12751
+ export { type AddressCheckInput, AddressResource, AddressType, AssociatedDocumentType, type BarcodeLegacyInput, BarcodeResource, BarcodeType, type BarcodeV4Request, type BarcodeV4Response, Bundle, type CheckoutAddressInput, CheckoutCutOffDay, type CheckoutCutOffTimeInput, CheckoutCutOffType, CheckoutOption, type CheckoutRequestInput, CheckoutResource, type CheckoutResponse, CheckoutWarningOption, type ConfirmV4Request, type ConfirmingRequest, type ConfirmingResponse, ConsolidationMode, CountryCode, Currency, type DecodedLabel, DeliveryConfirmation, type DeliveryDateCalculateInput, DeliveryDateResource, type DeliveryDateResponse, DeliverydateOption, Duration, GuaranteedBefore, IGNORED_LOCATION_OPTIONS, type LabelLegacyOptions, LabelType, LabellingCurrency, type LabellingRequest, type LabellingResponse, type LabellingV4Request, Language, type Location, type LocationAreaInput, LocationDeliveryOption, type LocationLookupInput, type LocationLookupResponse, type LocationNearestByGeocodeInput, type LocationNearestInput, LocationResource, type LocationsResponse, MergeType, MinimalAgeCheck, NetworkType, OriginCountryCode, OutputType, PageOrientation, Positioning, PostNLApiError, PostNLAuthError, PostNLBadRequestError, PostNLClient, type PostNLClientOptions, PostNLError, PostNLMethodNotAllowedError, PostNLRateLimitError, PostNLServerError, PostNLTimeoutError, PostNLValidationError, type PostalcodeCheckAddress, PrintMethod, ProductCode, type ProductCodeValue, ReceiverType, Resolution, type ReturnGenerateRequest, ReturnOutputType, ReturnPeriod, ReturnPeriodV4, ReturnResource, ReturnShipmentTypeV4, type SentDateInput, type SentDateResponse, Service, type ShipmentPostResponse, ShipmentTypeLegacy, ShipmentTypeV4, type ShipmentV4Request, ShippingResource, type ShippingStatusResponse, type SignatureImage, type SignatureResponse, StatusLanguage, SustainabilityCode, type TimeframeGetInput, TimeframeOption, TimeframeResource, type TimeframeResponse, type TrackingByReferenceOptions, type TrackingOptions, TrackingResource, type UpdatedShipment, type UpdatedShipmentsOptions, type UpdatedShipmentsResponse, decodeBase64, labelContentType, toDecodedLabel, version };
package/dist/index.js CHANGED
@@ -87,8 +87,12 @@ function extract(body) {
87
87
  detail: fault
88
88
  };
89
89
  const inv = b.Error;
90
- if (inv?.ErrorDescription)
91
- return { message: inv.ErrorDescription, code: inv.ErrorCode, detail: b };
90
+ if (inv && (inv.ErrorMessage || inv.ErrorDescription || inv.ErrorCode))
91
+ return {
92
+ message: inv.ErrorMessage ?? inv.ErrorDescription ?? "error",
93
+ code: inv.ErrorCode,
94
+ detail: b
95
+ };
92
96
  const list = b.errors ?? b.Errors;
93
97
  if (Array.isArray(list) && list.length) {
94
98
  const f = list[0];
@@ -116,6 +120,15 @@ function parseError(status, body, headers) {
116
120
  if (status === 400) return new PostNLBadRequestError(status, message, code, detail, body);
117
121
  return new PostNLApiError(status, message, code, detail, body);
118
122
  }
123
+ function inlineApiError(body) {
124
+ const b = body;
125
+ const err = b && typeof b === "object" ? b.Error : void 0;
126
+ if (err && typeof err === "object" && err.ErrorCode != null) {
127
+ const { message, code, detail } = extract(body);
128
+ return new PostNLApiError(200, message, code, detail, body);
129
+ }
130
+ return void 0;
131
+ }
119
132
 
120
133
  // src/core/http.ts
121
134
  var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
@@ -284,6 +297,8 @@ var BaseResource = class {
284
297
  query: args.query,
285
298
  body: ep.method === "GET" ? void 0 : body
286
299
  });
300
+ const inline = inlineApiError(raw);
301
+ if (inline) throw inline;
287
302
  const out = args.responseSchema.safeParse(raw);
288
303
  if (!out.success) throw new PostNLValidationError("invalid response", out.error.issues);
289
304
  return out.data;
@@ -1568,7 +1583,7 @@ var timeframeTimeframeSchema = z.object({
1568
1583
  );
1569
1584
  var timeframeSchema2 = z.object({
1570
1585
  Date: pnlDateField,
1571
- Timeframes: z.object({ TimeframeTimeframe: pnlArray(timeframeTimeframeSchema) }).optional().transform((t) => t?.TimeframeTimeframe ?? [])
1586
+ Timeframes: z.object({ TimeframeTimeFrame: pnlArray(timeframeTimeframeSchema) }).optional().transform((t) => t?.TimeframeTimeFrame ?? [])
1572
1587
  }).transform((t) => ({
1573
1588
  ...stripUndefined({ date: t.Date }),
1574
1589
  timeframes: t.Timeframes
@@ -1946,6 +1961,6 @@ var ProductCode = {
1946
1961
  // src/index.ts
1947
1962
  var version = "0.1.0";
1948
1963
 
1949
- export { AddressResource, AddressType, AssociatedDocumentType, BarcodeResource, BarcodeType, Bundle, CheckoutCutOffDay, CheckoutCutOffType, CheckoutOption, CheckoutResource, CheckoutWarningOption, ConsolidationMode, CountryCode, Currency, DeliveryConfirmation, DeliveryDateResource, DeliverydateOption, Duration, GuaranteedBefore, IGNORED_LOCATION_OPTIONS, LabelType, LabellingCurrency, Language, LocationDeliveryOption, LocationResource, MergeType, MinimalAgeCheck, NetworkType, OriginCountryCode, OutputType, PageOrientation, Positioning, PostNLApiError, PostNLAuthError, PostNLBadRequestError, PostNLClient, PostNLError, PostNLMethodNotAllowedError, PostNLRateLimitError, PostNLServerError, PostNLTimeoutError, PostNLValidationError, PrintMethod, ProductCode, ReceiverType, Resolution, ReturnOutputType, ReturnPeriod, ReturnPeriodV4, ReturnResource, ReturnShipmentTypeV4, Service, ShipmentTypeLegacy, ShipmentTypeV4, ShippingResource, StatusLanguage, SustainabilityCode, TimeframeOption, TimeframeResource, TrackingResource, decodeBase64, labelContentType, parseError, toDecodedLabel, version };
1964
+ export { AddressResource, AddressType, AssociatedDocumentType, BarcodeResource, BarcodeType, Bundle, CheckoutCutOffDay, CheckoutCutOffType, CheckoutOption, CheckoutResource, CheckoutWarningOption, ConsolidationMode, CountryCode, Currency, DeliveryConfirmation, DeliveryDateResource, DeliverydateOption, Duration, GuaranteedBefore, IGNORED_LOCATION_OPTIONS, LabelType, LabellingCurrency, Language, LocationDeliveryOption, LocationResource, MergeType, MinimalAgeCheck, NetworkType, OriginCountryCode, OutputType, PageOrientation, Positioning, PostNLApiError, PostNLAuthError, PostNLBadRequestError, PostNLClient, PostNLError, PostNLMethodNotAllowedError, PostNLRateLimitError, PostNLServerError, PostNLTimeoutError, PostNLValidationError, PrintMethod, ProductCode, ReceiverType, Resolution, ReturnOutputType, ReturnPeriod, ReturnPeriodV4, ReturnResource, ReturnShipmentTypeV4, Service, ShipmentTypeLegacy, ShipmentTypeV4, ShippingResource, StatusLanguage, SustainabilityCode, TimeframeOption, TimeframeResource, TrackingResource, decodeBase64, labelContentType, toDecodedLabel, version };
1950
1965
  //# sourceMappingURL=index.js.map
1951
1966
  //# sourceMappingURL=index.js.map