@myparcel-dev/sdk 4.1.1 → 5.0.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/README.md +2 -2
- package/lib/createMyParcelSdk.d.ts +8 -4
- package/lib/createPrivateSdk.d.ts +5 -4
- package/lib/createPublicSdk.d.ts +5 -4
- package/lib/endpoints/private/account-messages/DeleteAccountMessage.d.ts +3 -2
- package/lib/endpoints/private/account-messages/GetAccountMessages.d.ts +3 -2
- package/lib/endpoints/private/accounts/Account.types.d.ts +5 -4
- package/lib/endpoints/private/accounts/GetAccount.d.ts +3 -2
- package/lib/endpoints/private/accounts/GetAccounts.d.ts +3 -2
- package/lib/endpoints/private/accounts/PutAccount.d.ts +4 -3
- package/lib/endpoints/private/api-key/GetApiKeys.d.ts +3 -2
- package/lib/endpoints/private/api-key/PostApiKeys.d.ts +4 -3
- package/lib/endpoints/private/carrier-options/CarrierOption.types.d.ts +3 -2
- package/lib/endpoints/private/carrier-options/DeleteCarrierOptions.d.ts +3 -2
- package/lib/endpoints/private/carrier-options/GetCarrierOptions.d.ts +3 -2
- package/lib/endpoints/private/carrier-options/PostCarrierOptions.d.ts +4 -3
- package/lib/endpoints/private/carrier-options/PutCarrierOptions.d.ts +4 -3
- package/lib/endpoints/private/locations/GetLocations.d.ts +3 -2
- package/lib/endpoints/private/shipments/GetShipment.d.ts +3 -2
- package/lib/endpoints/private/shipments/GetShipments.d.ts +4 -3
- package/lib/endpoints/private/shipments/PostShipments.d.ts +4 -3
- package/lib/endpoints/private/shipments/Shipment.types.d.ts +4 -4
- package/lib/endpoints/private/shops/GetShop.d.ts +3 -2
- package/lib/endpoints/private/shops/PostShop.d.ts +4 -3
- package/lib/endpoints/private/shops/PostShopDuplicate.d.ts +4 -3
- package/lib/endpoints/private/shops/PutShop.d.ts +4 -3
- package/lib/endpoints/private/shops/Shop.types.d.ts +2 -1
- package/lib/endpoints/private/shops/index.d.ts +1 -1
- package/lib/endpoints/private/subscription-capabilities/GetSubscriptionCapabilities.d.ts +4 -3
- package/lib/endpoints/private/subscription-capabilities/SubscriptionCapability.types.d.ts +3 -2
- package/lib/endpoints/private/subscriptions/DeleteSubscription.d.ts +3 -2
- package/lib/endpoints/private/subscriptions/GetSubscriptions.d.ts +3 -2
- package/lib/endpoints/private/subscriptions/PatchSubscriptions.d.ts +4 -3
- package/lib/endpoints/private/subscriptions/PostSubscriptions.d.ts +4 -3
- package/lib/endpoints/private/system-country-codes/GetSystemCountryCodes.d.ts +3 -2
- package/lib/endpoints/private/system-country-codes/SystemCountryCodes.types.d.ts +2 -1
- package/lib/endpoints/private/system-messages/GetSystemMessages.d.ts +3 -2
- package/lib/endpoints/private/track-traces/GetTrackAndTraceByShipment.d.ts +3 -2
- package/lib/endpoints/private/track-traces/TrackTraces.types.d.ts +5 -4
- package/lib/endpoints/private/webhook-subscriptions/DeleteWebhookSubscriptions.d.ts +3 -2
- package/lib/endpoints/private/webhook-subscriptions/GetWebhookSubscriptions.d.ts +3 -2
- package/lib/endpoints/private/webhook-subscriptions/PostWebhookSubscriptions.d.ts +4 -3
- package/lib/endpoints/public/carriers/Carrier.types.d.ts +2 -1
- package/lib/endpoints/public/carriers/GetCarrier.d.ts +4 -3
- package/lib/endpoints/public/carriers/GetCarriers.d.ts +3 -2
- package/lib/endpoints/public/delivery-options/DeliveryOption.types.d.ts +4 -4
- package/lib/endpoints/public/delivery-options/GetDeliveryOptions.d.ts +6 -5
- package/lib/endpoints/public/pickup-locations/GetPickupLocations.d.ts +4 -3
- package/lib/endpoints/public/pickup-locations/PickupLocation.types.d.ts +3 -2
- package/lib/index.cjs +1 -1
- package/lib/index.js +154 -118
- package/lib/model/client/AbstractClient.d.ts +15 -4
- package/lib/model/client/AbstractClient.types.d.ts +9 -3
- package/lib/model/client/FetchClient.d.ts +2 -1
- package/lib/model/client/helper/addParameters.d.ts +4 -3
- package/lib/model/client/middleware/Interceptors.d.ts +8 -0
- package/lib/model/client/middleware/Interceptors.unit.spec.d.ts +1 -0
- package/lib/model/client/middleware/middleware.types.d.ts +1 -0
- package/lib/model/endpoint/AbstractEndpoint.d.ts +3 -2
- package/lib/model/endpoint/AbstractEndpoint.types.d.ts +4 -3
- package/lib/model/endpoint/AbstractPrivateEndpoint.d.ts +3 -2
- package/lib/model/endpoint/AbstractPublicEndpoint.d.ts +2 -1
- package/lib/model/exception/ApiException.d.ts +2 -1
- package/package.json +15 -16
- package/lib/endpoints/private/shipments/PatchShipment.d.ts +0 -21
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Interceptors } from './middleware/Interceptors';
|
|
2
|
+
import { RequestHeaders, ResponseWrapper } from '../../types/request.types';
|
|
3
|
+
import { AbstractEndpoint } from '../endpoint/AbstractEndpoint';
|
|
4
|
+
import { AbstractClient } from './AbstractClient';
|
|
5
|
+
|
|
4
6
|
interface ClientPlugin {
|
|
5
7
|
getClient?: () => void;
|
|
6
8
|
init?: (client: AbstractClient) => void;
|
|
@@ -14,6 +16,10 @@ export interface ClientConfig {
|
|
|
14
16
|
parameters?: Record<string, string>;
|
|
15
17
|
plugins?: PluginConstructor[];
|
|
16
18
|
options?: ClientOptions;
|
|
19
|
+
interceptors?: {
|
|
20
|
+
request: Interceptors<RequestInit>;
|
|
21
|
+
response: Interceptors<Response>;
|
|
22
|
+
};
|
|
17
23
|
}
|
|
18
24
|
export interface ClientOptions {
|
|
19
25
|
timeout?: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClientConfig, ClientRequest } from './AbstractClient.types';
|
|
2
2
|
import { AbstractClient } from './AbstractClient';
|
|
3
|
+
|
|
3
4
|
export declare class FetchClient extends AbstractClient {
|
|
4
5
|
constructor(config?: ClientConfig);
|
|
5
6
|
protected request: ClientRequest;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { AbstractEndpoint } from '../../endpoint/AbstractEndpoint';
|
|
2
|
+
import { EndpointParameters } from '../AbstractClient.types';
|
|
3
|
+
|
|
4
|
+
export declare const addParameters: <E extends AbstractEndpoint>(path: string, parameters?: EndpointParameters<E>) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Middleware<T> = (value: T) => T | Promise<T>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { HttpMethod } from '../../types/request.types';
|
|
2
|
+
import { EndpointDefinition } from './AbstractEndpoint.types';
|
|
3
|
+
|
|
3
4
|
interface EndpointOptions {
|
|
4
5
|
headers?: AbstractEndpoint['definition']['headers'];
|
|
5
6
|
parameters?: AbstractEndpoint['definition']['parameters'];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { OneOrMore } from '@myparcel-dev/ts-utils';
|
|
2
|
+
import { RequestHeaders } from '../../types/request.types';
|
|
3
|
+
import { NoInfer } from '../../types/global.types';
|
|
4
|
+
|
|
4
5
|
type Pagination = {
|
|
5
6
|
page?: number;
|
|
6
7
|
size?: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { RequestHeaders } from '../../types/request.types';
|
|
2
|
+
import { EndpointDefinition } from './AbstractEndpoint.types';
|
|
3
3
|
import { AbstractEndpoint } from './AbstractEndpoint';
|
|
4
|
+
|
|
4
5
|
type PrivateEndpointDefinition = {
|
|
5
6
|
headers: RequestHeaders & {
|
|
6
7
|
Authorization: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EndpointDefinition } from './AbstractEndpoint.types';
|
|
2
2
|
import { AbstractEndpoint } from './AbstractEndpoint';
|
|
3
|
+
|
|
3
4
|
export declare abstract class AbstractPublicEndpoint<D = EndpointDefinition> extends AbstractEndpoint<D> {
|
|
4
5
|
abstract readonly name: AbstractPublicEndpoint['definition']['name'];
|
|
5
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myparcel-dev/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "JavaScript SDK to connect to the MyParcel API via Node.js or browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"myparcel",
|
|
@@ -42,22 +42,22 @@
|
|
|
42
42
|
"sh -c \"publint\""
|
|
43
43
|
]
|
|
44
44
|
},
|
|
45
|
-
"prettier": "@myparcel/prettier-config",
|
|
45
|
+
"prettier": "@myparcel-dev/prettier-config",
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@myparcel-dev/constants": "^2.
|
|
48
|
-
"@myparcel-dev/ts-utils": "^1.
|
|
47
|
+
"@myparcel-dev/constants": "^2.7.0",
|
|
48
|
+
"@myparcel-dev/ts-utils": "^1.15.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@myparcel-
|
|
52
|
-
"@myparcel-
|
|
53
|
-
"@myparcel-
|
|
54
|
-
"@myparcel-
|
|
55
|
-
"@myparcel-
|
|
56
|
-
"@myparcel/semantic-release-config": "^
|
|
51
|
+
"@myparcel-dev/eslint-config-esnext": "^1.4.0",
|
|
52
|
+
"@myparcel-dev/eslint-config-import": "^1.3.0",
|
|
53
|
+
"@myparcel-dev/eslint-config-node": "^1.4.0",
|
|
54
|
+
"@myparcel-dev/eslint-config-prettier": "^1.4.0",
|
|
55
|
+
"@myparcel-dev/eslint-config-prettier-typescript": "^1.4.0",
|
|
56
|
+
"@myparcel-dev/semantic-release-config": "^6.0.0",
|
|
57
57
|
"@tsconfig/recommended": "^1.0.2",
|
|
58
58
|
"@types/node": "^20.0.0",
|
|
59
|
-
"@vitest/coverage-v8": "^
|
|
60
|
-
"@vitest/ui": "^
|
|
59
|
+
"@vitest/coverage-v8": "^2.0.0",
|
|
60
|
+
"@vitest/ui": "^2.0.0",
|
|
61
61
|
"eslint": "^8.34.0",
|
|
62
62
|
"eslint-plugin-sort-exports": "^0.9.0",
|
|
63
63
|
"husky": "^9.0.0",
|
|
@@ -67,12 +67,11 @@
|
|
|
67
67
|
"typescript": "^5.2.0",
|
|
68
68
|
"vite": "^5.0.0",
|
|
69
69
|
"vite-plugin-dts": "^3.6.0",
|
|
70
|
-
"vitest": "^
|
|
71
|
-
"vitest-fetch-mock": "^0.2.1"
|
|
70
|
+
"vitest": "^2.0.0"
|
|
72
71
|
},
|
|
73
|
-
"packageManager": "yarn@4.0.1",
|
|
74
72
|
"volta": {
|
|
75
|
-
"node": "20.10.0"
|
|
73
|
+
"node": "20.10.0",
|
|
74
|
+
"yarn": "4.3.1"
|
|
76
75
|
},
|
|
77
76
|
"publishConfig": {
|
|
78
77
|
"access": "public"
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type HttpMethod, type RequestHeaders } from '../../../types/request.types';
|
|
2
|
-
import { AbstractPrivateEndpoint } from '../../../model/endpoint/AbstractPrivateEndpoint';
|
|
3
|
-
import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
|
|
4
|
-
import { type ShipmentPatchData } from './Shipment.types';
|
|
5
|
-
type PatchShipmentsDefinition = CreateDefinition<{
|
|
6
|
-
name: typeof PatchShipments.name;
|
|
7
|
-
body: ShipmentPatchData[];
|
|
8
|
-
}>;
|
|
9
|
-
/**
|
|
10
|
-
* Patch an existing shipment.
|
|
11
|
-
*
|
|
12
|
-
* @see https://developer.myparcel.nl/api-reference/06.shipments.html
|
|
13
|
-
*/
|
|
14
|
-
export declare class PatchShipments extends AbstractPrivateEndpoint<PatchShipmentsDefinition> {
|
|
15
|
-
readonly method: HttpMethod;
|
|
16
|
-
readonly name = "patchShipments";
|
|
17
|
-
readonly path = "shipments";
|
|
18
|
-
readonly property = "shipments";
|
|
19
|
-
getHeaders(): RequestHeaders;
|
|
20
|
-
}
|
|
21
|
-
export {};
|