@nzyme/apis 0.9.0

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.
Files changed (52) hide show
  1. package/dist/esm/dhl/DhlPickUpPoint.d.ts +29 -0
  2. package/dist/esm/dhl/DhlPickUpPoint.js +2 -0
  3. package/dist/esm/dhl/DhlPickUpPoint.js.map +1 -0
  4. package/dist/esm/dhl/DhlPickUpPointGet.d.ts +18 -0
  5. package/dist/esm/dhl/DhlPickUpPointGet.js +11 -0
  6. package/dist/esm/dhl/DhlPickUpPointGet.js.map +1 -0
  7. package/dist/esm/dhl/DhlPickUpPointList.d.ts +34 -0
  8. package/dist/esm/dhl/DhlPickUpPointList.js +18 -0
  9. package/dist/esm/dhl/DhlPickUpPointList.js.map +1 -0
  10. package/dist/esm/dhl/DhlTrackingGet.d.ts +42 -0
  11. package/dist/esm/dhl/DhlTrackingGet.js +13 -0
  12. package/dist/esm/dhl/DhlTrackingGet.js.map +1 -0
  13. package/dist/esm/dhl/constants.d.ts +8 -0
  14. package/dist/esm/dhl/constants.js +9 -0
  15. package/dist/esm/dhl/constants.js.map +1 -0
  16. package/dist/esm/dhl.d.ts +5 -0
  17. package/dist/esm/dhl.js +6 -0
  18. package/dist/esm/dhl.js.map +1 -0
  19. package/dist/esm/heremaps/GeocodeEndpoint.d.ts +109 -0
  20. package/dist/esm/heremaps/GeocodeEndpoint.js +36 -0
  21. package/dist/esm/heremaps/GeocodeEndpoint.js.map +1 -0
  22. package/dist/esm/heremaps.d.ts +1 -0
  23. package/dist/esm/heremaps.js +2 -0
  24. package/dist/esm/heremaps.js.map +1 -0
  25. package/dist/esm/index.d.ts +2 -0
  26. package/dist/esm/index.js +2 -0
  27. package/dist/esm/index.js.map +1 -0
  28. package/dist/esm/inpost/InpostPointGet.d.ts +7 -0
  29. package/dist/esm/inpost/InpostPointGet.js +21 -0
  30. package/dist/esm/inpost/InpostPointGet.js.map +1 -0
  31. package/dist/esm/inpost/InpostPointList.d.ts +42 -0
  32. package/dist/esm/inpost/InpostPointList.js +21 -0
  33. package/dist/esm/inpost/InpostPointList.js.map +1 -0
  34. package/dist/esm/inpost/InpostTrackingGet.d.ts +7 -0
  35. package/dist/esm/inpost/InpostTrackingGet.js +12 -0
  36. package/dist/esm/inpost/InpostTrackingGet.js.map +1 -0
  37. package/dist/esm/inpost/constants.d.ts +4 -0
  38. package/dist/esm/inpost/constants.js +5 -0
  39. package/dist/esm/inpost/constants.js.map +1 -0
  40. package/dist/esm/inpost/models/InpostPointData.d.ts +41 -0
  41. package/dist/esm/inpost/models/InpostPointData.js +2 -0
  42. package/dist/esm/inpost/models/InpostPointData.js.map +1 -0
  43. package/dist/esm/inpost/models/InpostStatus.d.ts +1 -0
  44. package/dist/esm/inpost/models/InpostStatus.js +2 -0
  45. package/dist/esm/inpost/models/InpostStatus.js.map +1 -0
  46. package/dist/esm/inpost/models/InpostTrackingData.d.ts +38 -0
  47. package/dist/esm/inpost/models/InpostTrackingData.js +2 -0
  48. package/dist/esm/inpost/models/InpostTrackingData.js.map +1 -0
  49. package/dist/esm/inpost.d.ts +6 -0
  50. package/dist/esm/inpost.js +7 -0
  51. package/dist/esm/inpost.js.map +1 -0
  52. package/package.json +70 -0
@@ -0,0 +1,29 @@
1
+ export interface DhlPickUpPoint {
2
+ id: string;
3
+ harmonisedId: string;
4
+ psfKey: string;
5
+ shopType: string;
6
+ name: string;
7
+ keyword: string;
8
+ address: {
9
+ countryCode: string;
10
+ zipCode: string;
11
+ city: string;
12
+ street: string;
13
+ number: string;
14
+ isBusiness: boolean;
15
+ postalCode: string;
16
+ };
17
+ geoLocation: {
18
+ latitude: number;
19
+ longitude: number;
20
+ };
21
+ distance: number;
22
+ openingTimes: {
23
+ timeFrom: string;
24
+ timeTo: string;
25
+ weekDay: number;
26
+ }[];
27
+ closurePeriods: [];
28
+ serviceTypes: string[];
29
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DhlPickUpPoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DhlPickUpPoint.js","sourceRoot":"","sources":["../../../src/dhl/DhlPickUpPoint.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import type { DhlPickUpPoint } from './DhlPickUpPoint.js';
2
+ /**
3
+ * Parameters for getting a DHL pickup point.
4
+ */
5
+ export interface DhlPickupPointGetParams {
6
+ /**
7
+ * The country to get the pickup point for.
8
+ */
9
+ country: string;
10
+ /**
11
+ * The ID of the pickup point to get.
12
+ */
13
+ id: string;
14
+ }
15
+ /**
16
+ * Get a DHL pickup point.
17
+ */
18
+ export declare const DhlPickupPointGet: import("@nzyme/fetch-utils").Endpoint<DhlPickupPointGetParams, DhlPickUpPoint | null>;
@@ -0,0 +1,11 @@
1
+ import { defineEndpoint, jsonNullableResponse } from '@nzyme/fetch-utils';
2
+ /**
3
+ * Get a DHL pickup point.
4
+ */
5
+ export const DhlPickupPointGet = defineEndpoint({
6
+ request: (params) => ({
7
+ url: `https://api-gw.dhlparcel.nl/parcel-shop-locations/${params.country}/${params.id}`,
8
+ }),
9
+ response: (jsonNullableResponse),
10
+ });
11
+ //# sourceMappingURL=DhlPickUpPointGet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DhlPickUpPointGet.js","sourceRoot":"","sources":["../../../src/dhl/DhlPickUpPointGet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAkB1E;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;IAC5C,OAAO,EAAE,CAAC,MAA+B,EAAE,EAAE,CAAC,CAAC;QAC3C,GAAG,EAAE,qDAAqD,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,EAAE,EAAE;KAC1F,CAAC;IACF,QAAQ,EAAE,CAAA,oBAAoC,CAAA;CACjD,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { DhlPickUpPoint } from './DhlPickUpPoint.js';
2
+ /**
3
+ * Parameters for listing DHL pickup points.
4
+ */
5
+ export interface DhlPickupPointListParams {
6
+ /**
7
+ * The country to list pickup points for.
8
+ */
9
+ country: string;
10
+ /**
11
+ * The city to filter pickup points by.
12
+ */
13
+ city?: string;
14
+ /**
15
+ * The street to filter pickup points by.
16
+ */
17
+ street?: string;
18
+ /**
19
+ * The postal code to filter pickup points by.
20
+ */
21
+ postalCode?: string;
22
+ /**
23
+ * The maximum number of pickup points to return.
24
+ */
25
+ limit?: number;
26
+ /**
27
+ * Fuzzy search for the city, street or postal code.
28
+ */
29
+ fuzzy?: string;
30
+ }
31
+ /**
32
+ * List DHL pickup points.
33
+ */
34
+ export declare const DhlPickupPointList: import("@nzyme/fetch-utils").Endpoint<DhlPickupPointListParams, DhlPickUpPoint[] | null>;
@@ -0,0 +1,18 @@
1
+ import { defineEndpoint, jsonNullableResponse } from '@nzyme/fetch-utils';
2
+ /**
3
+ * List DHL pickup points.
4
+ */
5
+ export const DhlPickupPointList = defineEndpoint({
6
+ request: (params) => ({
7
+ url: `https://api-gw.dhlparcel.nl/parcel-shop-locations/${params.country}`,
8
+ query: {
9
+ city: params.city,
10
+ street: params.street,
11
+ postalCode: params.postalCode,
12
+ limit: params.limit,
13
+ fuzzy: params.fuzzy,
14
+ },
15
+ }),
16
+ response: (jsonNullableResponse),
17
+ });
18
+ //# sourceMappingURL=DhlPickUpPointList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DhlPickUpPointList.js","sourceRoot":"","sources":["../../../src/dhl/DhlPickUpPointList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAkC1E;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC;IAC7C,OAAO,EAAE,CAAC,MAAgC,EAAE,EAAE,CAAC,CAAC;QAC5C,GAAG,EAAE,qDAAqD,MAAM,CAAC,OAAO,EAAE;QAC1E,KAAK,EAAE;YACH,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,KAAK,EAAE,MAAM,CAAC,KAAK;SACtB;KACJ,CAAC;IACF,QAAQ,EAAE,CAAA,oBAAsC,CAAA;CACnD,CAAC,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { DateTimeISO } from '@nzyme/types';
2
+ export type DhlTrackingStatus = 'delivered' | 'failure' | 'pre-transit' | 'transit' | 'unknown';
3
+ export type DhlTrackingLocation = {
4
+ address?: {
5
+ addressLocality?: string;
6
+ addressLocalityServicing?: string;
7
+ addressRegion?: string;
8
+ countryCode?: string;
9
+ postalCode?: string;
10
+ streetAddress?: string;
11
+ };
12
+ servicePoint?: {
13
+ url: string;
14
+ label: string;
15
+ };
16
+ };
17
+ export type DhlTrackingEvent = {
18
+ timestamp: DateTimeISO;
19
+ location: DhlTrackingLocation;
20
+ statusCode: DhlTrackingStatus;
21
+ status: string;
22
+ description: string;
23
+ remark?: string;
24
+ nextSteps?: string;
25
+ };
26
+ export type DhlTrackingInfo = {
27
+ shipments: {
28
+ id: string;
29
+ service: string;
30
+ origin: DhlTrackingLocation;
31
+ destination: DhlTrackingLocation;
32
+ status: DhlTrackingEvent;
33
+ details: unknown;
34
+ events: DhlTrackingEvent[];
35
+ }[];
36
+ };
37
+ export type DhlTrackingGetParams = {
38
+ trackingNumber: string;
39
+ apiKey: string;
40
+ apiUrl: string;
41
+ };
42
+ export declare const DhlTrackingGet: import("@nzyme/fetch-utils").Endpoint<DhlTrackingGetParams, DhlTrackingInfo>;
@@ -0,0 +1,13 @@
1
+ import { defineEndpoint, jsonResponse } from '@nzyme/fetch-utils';
2
+ // https://developer.dhl.com/api-reference/shipment-tracking#reference-docs-section
3
+ export const DhlTrackingGet = defineEndpoint({
4
+ request: (params) => ({
5
+ url: `${params.apiUrl}/track/shipments`,
6
+ query: params,
7
+ headers: {
8
+ 'DHL-API-Key': params.apiKey,
9
+ },
10
+ }),
11
+ response: (jsonResponse),
12
+ });
13
+ //# sourceMappingURL=DhlTrackingGet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DhlTrackingGet.js","sourceRoot":"","sources":["../../../src/dhl/DhlTrackingGet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAgDlE,mFAAmF;AACnF,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;IACzC,OAAO,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,CAAC;QACxC,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,kBAAkB;QACvC,KAAK,EAAE,MAAM;QACb,OAAO,EAAE;YACL,aAAa,EAAE,MAAM,CAAC,MAAM;SAC/B;KACJ,CAAC;IACF,QAAQ,EAAE,CAAA,YAA6B,CAAA;CAC1C,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * DHL API URL for EU.
3
+ */
4
+ export declare const DHL_API_URL_EU = "https://api-eu.dhl.com";
5
+ /**
6
+ * DHL API URL for test environment.
7
+ */
8
+ export declare const DHL_API_URL_TEST = "https://api-test.dhl.com";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * DHL API URL for EU.
3
+ */
4
+ export const DHL_API_URL_EU = 'https://api-eu.dhl.com';
5
+ /**
6
+ * DHL API URL for test environment.
7
+ */
8
+ export const DHL_API_URL_TEST = 'https://api-test.dhl.com';
9
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/dhl/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './dhl/constants.js';
2
+ export * from './dhl/DhlPickUpPoint.js';
3
+ export * from './dhl/DhlPickUpPointGet.js';
4
+ export * from './dhl/DhlPickUpPointList.js';
5
+ export * from './dhl/DhlTrackingGet.js';
@@ -0,0 +1,6 @@
1
+ export * from './dhl/constants.js';
2
+ export * from './dhl/DhlPickUpPoint.js';
3
+ export * from './dhl/DhlPickUpPointGet.js';
4
+ export * from './dhl/DhlPickUpPointList.js';
5
+ export * from './dhl/DhlTrackingGet.js';
6
+ //# sourceMappingURL=dhl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dhl.js","sourceRoot":"","sources":["../../src/dhl.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Geocoding position
3
+ */
4
+ export interface GeocodingPosition {
5
+ /**
6
+ * Latitude
7
+ */
8
+ lat: number;
9
+ /**
10
+ * Longitude
11
+ */
12
+ lng: number;
13
+ }
14
+ /**
15
+ * Geocoding address
16
+ */
17
+ export interface GeocodingAddress {
18
+ /**
19
+ * Label
20
+ */
21
+ label: string;
22
+ /**
23
+ * Country code
24
+ */
25
+ countryCode: string;
26
+ /**
27
+ * Country name
28
+ */
29
+ countryName: string;
30
+ /**
31
+ * States
32
+ */
33
+ state?: string;
34
+ /**
35
+ * County
36
+ */
37
+ county?: string;
38
+ /**
39
+ * City
40
+ */
41
+ city?: string;
42
+ /**
43
+ * District
44
+ */
45
+ district?: string;
46
+ /**
47
+ * Subdistrict
48
+ */
49
+ subdistrict?: string;
50
+ /**
51
+ * Postal code
52
+ */
53
+ postalCode?: string;
54
+ }
55
+ /**
56
+ * Geocoding item
57
+ */
58
+ export interface GeocodingItem {
59
+ /**
60
+ * Position
61
+ */
62
+ position: GeocodingPosition;
63
+ /**
64
+ * Address
65
+ */
66
+ address: GeocodingAddress;
67
+ }
68
+ /**
69
+ * Geocoding result
70
+ */
71
+ export interface GeocodingResult {
72
+ /**
73
+ * Items
74
+ */
75
+ items: GeocodingItem[];
76
+ }
77
+ /**
78
+ * Geocoding input
79
+ */
80
+ export interface GeocodingInput {
81
+ /**
82
+ * API key
83
+ */
84
+ apiKey: string;
85
+ /**
86
+ * Limit
87
+ */
88
+ limit?: number;
89
+ /**
90
+ * Country
91
+ */
92
+ country?: string;
93
+ /**
94
+ * City
95
+ */
96
+ city?: string;
97
+ /**
98
+ * Postal code
99
+ */
100
+ postalCode?: string;
101
+ /**
102
+ * Street
103
+ */
104
+ street?: string;
105
+ }
106
+ /**
107
+ * Geocode endpoint
108
+ */
109
+ export declare const GeocodeEndpoint: import("@nzyme/fetch-utils").Endpoint<GeocodingInput, GeocodingResult>;
@@ -0,0 +1,36 @@
1
+ import { defineEndpoint, jsonResponse } from '@nzyme/fetch-utils';
2
+ /**
3
+ * Geocode endpoint
4
+ */
5
+ export const GeocodeEndpoint = defineEndpoint({
6
+ request: (input) => ({
7
+ url: 'https://geocode.search.hereapi.com/v1/geocode',
8
+ query: {
9
+ qq: getQualifiedQuery({
10
+ country: input.country,
11
+ city: input.city,
12
+ postalCode: input.postalCode,
13
+ }),
14
+ q: input.street,
15
+ limit: input.limit ?? '1',
16
+ apiKey: input.apiKey,
17
+ },
18
+ }),
19
+ response: (jsonResponse),
20
+ });
21
+ function getQualifiedQuery(query) {
22
+ let qq = '';
23
+ for (const [key, value] of Object.entries(query)) {
24
+ if (!value) {
25
+ continue;
26
+ }
27
+ if (qq) {
28
+ qq += ';';
29
+ }
30
+ // ";" is a special char in qualified query, so replace it
31
+ const encoded = value.replace(/;/g, ',');
32
+ qq += `${key}=${encoded}`;
33
+ }
34
+ return qq;
35
+ }
36
+ //# sourceMappingURL=GeocodeEndpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeocodeEndpoint.js","sourceRoot":"","sources":["../../../src/heremaps/GeocodeEndpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAqHlE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;IAC1C,OAAO,EAAE,CAAC,KAAqB,EAAE,EAAE,CAAC,CAAC;QACjC,GAAG,EAAE,+CAA+C;QACpD,KAAK,EAAE;YACH,EAAE,EAAE,iBAAiB,CAAC;gBAClB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,UAAU,EAAE,KAAK,CAAC,UAAU;aAC/B,CAAC;YACF,CAAC,EAAE,KAAK,CAAC,MAAM;YACf,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,GAAG;YACzB,MAAM,EAAE,KAAK,CAAC,MAAM;SACvB;KACJ,CAAC;IACF,QAAQ,EAAE,CAAA,YAA6B,CAAA;CAC1C,CAAC,CAAC;AAEH,SAAS,iBAAiB,CAAC,KAAyC;IAChE,IAAI,EAAE,GAAG,EAAE,CAAC;IAEZ,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/C,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,SAAS;QACb,CAAC;QAED,IAAI,EAAE,EAAE,CAAC;YACL,EAAE,IAAI,GAAG,CAAC;QACd,CAAC;QAED,0DAA0D;QAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAEzC,EAAE,IAAI,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,EAAE,CAAC;AACd,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './heremaps/GeocodeEndpoint.js';
@@ -0,0 +1,2 @@
1
+ export * from './heremaps/GeocodeEndpoint.js';
2
+ //# sourceMappingURL=heremaps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heremaps.js","sourceRoot":"","sources":["../../src/heremaps.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type * from './inpost.js';
2
+ export type * from './dhl.js';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { InpostPointData } from './models/InpostPointData.js';
2
+ /**
3
+ * Get a single Inpost point by name.
4
+ */
5
+ export declare const InpostPointGet: import("@nzyme/fetch-utils").Endpoint<{
6
+ pointName: string;
7
+ }, InpostPointData | null>;
@@ -0,0 +1,21 @@
1
+ import { defineEndpoint } from '@nzyme/fetch-utils';
2
+ import { INPOST_API_URL } from './constants.js';
3
+ /**
4
+ * Get a single Inpost point by name.
5
+ */
6
+ export const InpostPointGet = defineEndpoint({
7
+ request: (params) => ({
8
+ url: `${INPOST_API_URL}/v1/points/${params.pointName.toLowerCase()}`,
9
+ }),
10
+ response: async (response) => {
11
+ if (response.status === 404) {
12
+ return null;
13
+ }
14
+ const json = (await response.json());
15
+ if (json.status.toString() === '404') {
16
+ return null;
17
+ }
18
+ return json;
19
+ },
20
+ });
21
+ //# sourceMappingURL=InpostPointGet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InpostPointGet.js","sourceRoot":"","sources":["../../../src/inpost/InpostPointGet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;IACzC,OAAO,EAAE,CAAC,MAA6B,EAAE,EAAE,CAAC,CAAC;QACzC,GAAG,EAAE,GAAG,cAAc,cAAc,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE;KACvE,CAAC;IACF,QAAQ,EAAE,KAAK,EAAC,QAAQ,EAAC,EAAE;QACvB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAoB,CAAC;QACxD,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,KAAK,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAC,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { InpostPointData } from './models/InpostPointData.js';
2
+ type InpostPointFunction = 'parcel_collect' | 'parcel_send';
3
+ /**
4
+ * Parameters for the Inpost point list endpoint.
5
+ */
6
+ export type InpostPointListParams = {
7
+ /**
8
+ * Sort order.
9
+ */
10
+ sortOrder?: 'asc' | 'desc';
11
+ /**
12
+ * Sort by.
13
+ */
14
+ sortBy?: 'distance_to_relative_point' | 'name' | 'status';
15
+ /**
16
+ * Fields to include in the response.
17
+ */
18
+ fields?: (keyof InpostPointData)[];
19
+ /**
20
+ * Limit the number of points returned.
21
+ */
22
+ limit?: number;
23
+ /**
24
+ * Functions to filter by.
25
+ */
26
+ functions?: InpostPointFunction[];
27
+ /**
28
+ * Relative point to filter by.
29
+ */
30
+ relativePoint?: string;
31
+ /**
32
+ * Relative post code to filter by.
33
+ */
34
+ relativePostCode?: string;
35
+ };
36
+ /**
37
+ * Get a list of Inpost points.
38
+ */
39
+ export declare const InpostPointList: import("@nzyme/fetch-utils").Endpoint<InpostPointListParams, {
40
+ items: InpostPointData[];
41
+ } | null>;
42
+ export {};
@@ -0,0 +1,21 @@
1
+ import { defineEndpoint, jsonNullableResponse } from '@nzyme/fetch-utils';
2
+ import { INPOST_API_URL } from './constants.js';
3
+ /**
4
+ * Get a list of Inpost points.
5
+ */
6
+ export const InpostPointList = defineEndpoint({
7
+ request: (params) => ({
8
+ url: `${INPOST_API_URL}/v1/points`,
9
+ query: {
10
+ sort_order: params.sortOrder,
11
+ sort_by: params.sortBy,
12
+ fields: params.fields?.join(','),
13
+ limit: params.limit,
14
+ functions: params.functions?.join(','),
15
+ relative_point: params.relativePoint,
16
+ relative_post_code: params.relativePostCode,
17
+ },
18
+ }),
19
+ response: (jsonNullableResponse),
20
+ });
21
+ //# sourceMappingURL=InpostPointList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InpostPointList.js","sourceRoot":"","sources":["../../../src/inpost/InpostPointList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAuChD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;IAC1C,OAAO,EAAE,CAAC,MAA6B,EAAE,EAAE,CAAC,CAAC;QACzC,GAAG,EAAE,GAAG,cAAc,YAAY;QAClC,KAAK,EAAE;YACH,UAAU,EAAE,MAAM,CAAC,SAAS;YAC5B,OAAO,EAAE,MAAM,CAAC,MAAM;YACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC;YAChC,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC;YACtC,cAAc,EAAE,MAAM,CAAC,aAAa;YACpC,kBAAkB,EAAE,MAAM,CAAC,gBAAgB;SAC9C;KACJ,CAAC;IACF,QAAQ,EAAE,CAAA,oBAAkD,CAAA;CAC/D,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { InpostTrackingData } from './models/InpostTrackingData.js';
2
+ /**
3
+ * Get Inpost tracking data by tracking number.
4
+ */
5
+ export declare const InpostTrackingGet: import("@nzyme/fetch-utils").Endpoint<{
6
+ trackingNumber: string;
7
+ }, InpostTrackingData | null>;
@@ -0,0 +1,12 @@
1
+ import { defineEndpoint, jsonNullableResponse } from '@nzyme/fetch-utils';
2
+ import { INPOST_API_URL } from './constants.js';
3
+ /**
4
+ * Get Inpost tracking data by tracking number.
5
+ */
6
+ export const InpostTrackingGet = defineEndpoint({
7
+ request: (params) => ({
8
+ url: `${INPOST_API_URL}/v1/tracking/${params.trackingNumber}`,
9
+ }),
10
+ response: (jsonNullableResponse),
11
+ });
12
+ //# sourceMappingURL=InpostTrackingGet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InpostTrackingGet.js","sourceRoot":"","sources":["../../../src/inpost/InpostTrackingGet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;IAC5C,OAAO,EAAE,CAAC,MAAkC,EAAE,EAAE,CAAC,CAAC;QAC9C,GAAG,EAAE,GAAG,cAAc,gBAAgB,MAAM,CAAC,cAAc,EAAE;KAChE,CAAC;IACF,QAAQ,EAAE,CAAA,oBAAwC,CAAA;CACrD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Inpost API URL
3
+ */
4
+ export declare const INPOST_API_URL = "https://api-shipx-pl.easypack24.net";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Inpost API URL
3
+ */
4
+ export const INPOST_API_URL = 'https://api-shipx-pl.easypack24.net';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/inpost/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,qCAAqC,CAAC"}
@@ -0,0 +1,41 @@
1
+ export interface InpostPointData {
2
+ name: string;
3
+ address_details: {
4
+ city: string;
5
+ street: string;
6
+ building_number: string | number;
7
+ flat_number: string | number;
8
+ };
9
+ distance: number | null;
10
+ href: string;
11
+ type: string[];
12
+ status: string;
13
+ location: {
14
+ longitude: number;
15
+ latitude: number;
16
+ };
17
+ location_type: string | null;
18
+ location_date: string | null;
19
+ location_description: string | null;
20
+ location_description_1: string | null;
21
+ location_description_2: string | null;
22
+ opening_hours: string | null;
23
+ address: {
24
+ line1: string | null;
25
+ line2: string | null;
26
+ };
27
+ phone_number: string | null;
28
+ payment_point_descr: string | null;
29
+ functions: string[];
30
+ partner_id: number;
31
+ is_next: boolean;
32
+ payment_available: boolean;
33
+ payment_type: unknown;
34
+ virtual: string | null;
35
+ recommended_low_interest_box_machines_list: string[];
36
+ apm_doubled: unknown;
37
+ location_247: boolean;
38
+ operating_hours_extended: unknown;
39
+ agency: string | null;
40
+ image_url: string | null;
41
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=InpostPointData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InpostPointData.js","sourceRoot":"","sources":["../../../../src/inpost/models/InpostPointData.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export type InpostStatus = 'created' | 'offers_prepared' | 'offer_selected' | 'confirmed' | 'dispatched_by_sender' | 'collected_from_sender' | 'taken_by_courier' | 'adopted_at_source_branch' | 'sent_from_source_branch' | 'ready_to_pickup_from_pok' | 'ready_to_pickup_from_pok_registered' | 'oversized' | 'adopted_at_sorting_center' | 'sent_from_sorting_center' | 'adopted_at_target_branch' | 'out_for_delivery' | 'ready_to_pickup' | 'pickup_reminder_sent' | 'delivered' | 'pickup_time_expired' | 'avizo' | 'claimed' | 'returned_to_sender' | 'canceled' | 'other' | 'dispatched_by_sender_to_pok' | 'out_for_delivery_to_address' | 'pickup_reminder_sent_address' | 'rejected_by_receiver' | 'undelivered_wrong_address' | 'undelivered_incomplete_address' | 'undelivered_unknown_receiver' | 'undelivered_cod_cash_receiver' | 'taken_by_courier_from_pok' | 'undelivered' | 'return_pickup_confirmation_to_sender' | 'ready_to_pickup_from_branch' | 'delay_in_delivery' | 'redirect_to_box' | 'canceled_redirect_to_box' | 'readdressed' | 'undelivered_no_mailbox' | 'undelivered_not_live_address' | 'undelivered_lack_of_access_letterbox' | 'missing' | 'stack_in_customer_service_point' | 'stack_parcel_pickup_time_expired' | 'unstack_from_customer_service_point' | 'courier_avizo_in_customer_service_point' | 'taken_by_courier_from_customer_service_point' | 'stack_in_box_machine' | 'unstack_from_box_machine' | 'stack_parcel_in_box_machine_pickup_time_expired';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=InpostStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InpostStatus.js","sourceRoot":"","sources":["../../../../src/inpost/models/InpostStatus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ import type { DateTimeISO } from '@nzyme/types';
2
+ import type { InpostStatus } from './InpostStatus.js';
3
+ export type InpostTrackingData = {
4
+ tracking_number: string;
5
+ service: string;
6
+ type: string;
7
+ status: InpostStatus;
8
+ custom_attributes: {
9
+ size: string;
10
+ target_machine_id: string;
11
+ target_machine_detail: {
12
+ name: string;
13
+ opening_hours: string;
14
+ location_description: string;
15
+ location: {
16
+ latitude: number;
17
+ longitude: number;
18
+ };
19
+ address: {
20
+ line1: string;
21
+ line2: string;
22
+ };
23
+ type: string[];
24
+ location247: boolean;
25
+ };
26
+ end_of_week_collection: boolean;
27
+ };
28
+ tracking_details: {
29
+ origin_status: string;
30
+ status: InpostStatus;
31
+ agency: null;
32
+ location: null;
33
+ datetime: DateTimeISO;
34
+ }[];
35
+ expected_flow: InpostStatus[];
36
+ created_at: DateTimeISO;
37
+ updated_at: DateTimeISO;
38
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=InpostTrackingData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InpostTrackingData.js","sourceRoot":"","sources":["../../../../src/inpost/models/InpostTrackingData.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export * from './inpost/InpostPointList.js';
2
+ export * from './inpost/InpostPointGet.js';
3
+ export * from './inpost/InpostTrackingGet.js';
4
+ export * from './inpost/models/InpostPointData.js';
5
+ export * from './inpost/models/InpostStatus.js';
6
+ export * from './inpost/models/InpostTrackingData.js';
@@ -0,0 +1,7 @@
1
+ export * from './inpost/InpostPointList.js';
2
+ export * from './inpost/InpostPointGet.js';
3
+ export * from './inpost/InpostTrackingGet.js';
4
+ export * from './inpost/models/InpostPointData.js';
5
+ export * from './inpost/models/InpostStatus.js';
6
+ export * from './inpost/models/InpostTrackingData.js';
7
+ //# sourceMappingURL=inpost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inpost.js","sourceRoot":"","sources":["../../src/inpost.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAE9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@nzyme/apis",
3
+ "version": "0.9.0",
4
+ "typesVersions": {
5
+ "*": {
6
+ "*": [
7
+ "./dist/esm/*.d.ts"
8
+ ]
9
+ }
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "import": {
14
+ "types": "./dist/esm/index.d.ts",
15
+ "default": "./dist/esm/index.js"
16
+ },
17
+ "require": {
18
+ "types": "./dist/cjs/index.d.ts",
19
+ "default": "./dist/cjs/index.cjs"
20
+ },
21
+ "default": {
22
+ "types": "./dist/esm/index.d.ts",
23
+ "default": "./dist/esm/index.js"
24
+ }
25
+ },
26
+ "./*": {
27
+ "import": {
28
+ "types": "./dist/esm/*.d.ts",
29
+ "default": "./dist/esm/*.js"
30
+ },
31
+ "require": {
32
+ "types": "./dist/cjs/*.d.ts",
33
+ "default": "./dist/cjs/*.cjs"
34
+ },
35
+ "default": {
36
+ "types": "./dist/esm/*.d.ts",
37
+ "default": "./dist/esm/*.js"
38
+ }
39
+ }
40
+ },
41
+ "sideEffects": false,
42
+ "license": "MIT",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "https://github.com/kedrzu/nzyme.git"
46
+ },
47
+ "author": "Michał Kędrzyński <m.kedrzynski@gmail.com>",
48
+ "type": "module",
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "files": [
53
+ "dist"
54
+ ],
55
+ "scripts": {
56
+ "eslint": "eslint . --fix --cache"
57
+ },
58
+ "dependencies": {
59
+ "@nzyme/fetch-utils": "^0.9.0",
60
+ "@nzyme/ioc": "^0.9.0",
61
+ "@nzyme/types": "^0.9.0",
62
+ "@nzyme/utils": "^0.9.0",
63
+ "tslib": "^2.8.1"
64
+ },
65
+ "devDependencies": {
66
+ "@nzyme/eslint": "^0.9.0",
67
+ "@nzyme/tsconfig": "^0.9.0",
68
+ "typescript": "^5.8.2"
69
+ }
70
+ }