@duffel/api 1.28.0 → 2.0.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.
- package/dist/booking/AirlineInitiatedChanges/AirlineInitiatedChangesTypes.d.ts +2 -2
- package/dist/booking/OfferRequests/OfferRequestsTypes.d.ts +2 -2
- package/dist/booking/Offers/OfferTypes.d.ts +3 -3
- package/dist/booking/Orders/OrdersTypes.d.ts +4 -4
- package/dist/booking/SeatMaps/SeatMapTypes.d.ts +3 -3
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/typings.d.ts +3673 -0
- package/package.json +17 -17
- package/dist/Client.d.ts +0 -37
- package/dist/Resource.d.ts +0 -16
- package/dist/index.d.ts +0 -46
- package/dist/types/ClientType.d.ts +0 -76
- package/dist/types/index.d.ts +0 -3381
- package/dist/types/shared.d.ts +0 -157
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duffel/api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Javascript client library for the Duffel API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
7
|
-
"types": "dist/
|
|
7
|
+
"types": "dist/typings.d.ts",
|
|
8
8
|
"homepage": "https://duffel.com",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"duffel"
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"scripts": {
|
|
18
18
|
"generate:operation": "node ./scripts/createOperation.mjs",
|
|
19
|
-
"build": "rm -rf dist && rollup -c",
|
|
19
|
+
"build": "rm -rf dist && rollup -c && yarn remove-declaration-files",
|
|
20
|
+
"remove-declaration-files": "rm -rf dist/types dist/Client.d.ts dist/index.d.ts dist/Resource.d.ts",
|
|
20
21
|
"build:test": "rm -rf dist && tsc --noEmit && rollup -c",
|
|
21
22
|
"start": "node ./dist/index.js",
|
|
22
23
|
"dev": "ts-node ./src/index.ts",
|
|
@@ -56,41 +57,40 @@
|
|
|
56
57
|
"node-fetch": "2.6.9"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"@babel/core": "7.21.
|
|
60
|
-
"@babel/preset-env": "7.
|
|
61
|
-
"@babel/preset-typescript": "7.21.
|
|
62
|
-
"@commitlint/cli": "17.
|
|
60
|
+
"@babel/core": "7.21.5",
|
|
61
|
+
"@babel/preset-env": "7.21.5",
|
|
62
|
+
"@babel/preset-typescript": "7.21.5",
|
|
63
|
+
"@commitlint/cli": "17.5.1",
|
|
63
64
|
"@commitlint/config-angular": "17.4.4",
|
|
64
|
-
"@commitlint/cz-commitlint": "17.
|
|
65
|
-
"@rollup/plugin-commonjs": "
|
|
66
|
-
"@rollup/plugin-
|
|
67
|
-
"@rollup/plugin-node-resolve": "13.3.0",
|
|
65
|
+
"@commitlint/cz-commitlint": "17.5.0",
|
|
66
|
+
"@rollup/plugin-commonjs": "24.1.0",
|
|
67
|
+
"@rollup/plugin-node-resolve": "15.0.2",
|
|
68
68
|
"@types/jest": "29.0.3",
|
|
69
69
|
"@typescript-eslint/eslint-plugin": "5.35.1",
|
|
70
70
|
"@typescript-eslint/parser": "5.35.1",
|
|
71
71
|
"colors": "1.4.0",
|
|
72
72
|
"commitizen": "4.3.0",
|
|
73
73
|
"dotenv": "16.0.3",
|
|
74
|
-
"eslint": "8.
|
|
74
|
+
"eslint": "8.36.0",
|
|
75
75
|
"eslint-config-prettier": "8.8.0",
|
|
76
76
|
"eslint-plugin-spellcheck": "0.0.20",
|
|
77
77
|
"husky": "8.0.3",
|
|
78
78
|
"jest": "29.0.3",
|
|
79
79
|
"lint-staged": "13.1.2",
|
|
80
80
|
"nock": "13.2.9",
|
|
81
|
-
"prettier": "2.8.
|
|
82
|
-
"rollup": "
|
|
83
|
-
"rollup-plugin-dts": "
|
|
81
|
+
"prettier": "2.8.8",
|
|
82
|
+
"rollup": "3.21.3",
|
|
83
|
+
"rollup-plugin-dts-bundle": "^1.0.0",
|
|
84
84
|
"rollup-plugin-inject-process-env": "1.3.1",
|
|
85
85
|
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
86
86
|
"rollup-plugin-terser": "7.0.2",
|
|
87
87
|
"rollup-plugin-typescript2": "0.33.0",
|
|
88
88
|
"ts-jest": "28.0.8",
|
|
89
89
|
"ts-node": "10.9.1",
|
|
90
|
-
"typescript": "4.
|
|
90
|
+
"typescript": "4.9.5"
|
|
91
91
|
},
|
|
92
92
|
"engines": {
|
|
93
|
-
"node": ">=
|
|
93
|
+
"node": ">=18.*"
|
|
94
94
|
},
|
|
95
95
|
"release": {
|
|
96
96
|
"plugins": [
|
package/dist/Client.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { DuffelResponse, SDKOptions, ApiResponseMeta, ApiResponseError } from './types';
|
|
2
|
-
export interface Config {
|
|
3
|
-
token: string;
|
|
4
|
-
basePath?: string;
|
|
5
|
-
apiVersion?: string;
|
|
6
|
-
debug?: SDKOptions;
|
|
7
|
-
source?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare class DuffelError extends Error {
|
|
10
|
-
meta: ApiResponseMeta;
|
|
11
|
-
errors: ApiResponseError[];
|
|
12
|
-
headers: Record<string, string>;
|
|
13
|
-
constructor({ meta, errors, headers, }: {
|
|
14
|
-
meta: ApiResponseMeta;
|
|
15
|
-
errors: ApiResponseError[];
|
|
16
|
-
headers: Record<string, string>;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
export declare class Client {
|
|
20
|
-
private token;
|
|
21
|
-
private basePath;
|
|
22
|
-
private apiVersion;
|
|
23
|
-
private debug;
|
|
24
|
-
private source;
|
|
25
|
-
constructor({ token, basePath, apiVersion, debug, source }: Config);
|
|
26
|
-
request: <T_Data = any>({ method, path, data, params, compress, }: {
|
|
27
|
-
method: string;
|
|
28
|
-
path: string;
|
|
29
|
-
data?: Record<string, any> | undefined;
|
|
30
|
-
params?: Record<string, any> | undefined;
|
|
31
|
-
compress?: boolean | undefined;
|
|
32
|
-
}) => Promise<DuffelResponse<T_Data>>;
|
|
33
|
-
paginatedRequest<T_Data = any>({ path, params, }: {
|
|
34
|
-
path: string;
|
|
35
|
-
params?: Record<string, any>;
|
|
36
|
-
}): AsyncGenerator<DuffelResponse<T_Data>, void, unknown>;
|
|
37
|
-
}
|
package/dist/Resource.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Client } from './Client';
|
|
2
|
-
import { DuffelResponse } from './types';
|
|
3
|
-
export declare class Resource {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: Client);
|
|
6
|
-
protected request: <T_Data = any>({ method, path, data, params, }: {
|
|
7
|
-
method: string;
|
|
8
|
-
path: string;
|
|
9
|
-
data?: Record<string, any> | undefined;
|
|
10
|
-
params?: Record<string, any> | undefined;
|
|
11
|
-
}) => Promise<DuffelResponse<T_Data>>;
|
|
12
|
-
protected paginatedRequest: <T_Data = any>({ path, params, }: {
|
|
13
|
-
path: string;
|
|
14
|
-
params?: Record<string, any> | undefined;
|
|
15
|
-
}) => AsyncGenerator<DuffelResponse<T_Data>, void, unknown>;
|
|
16
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { PaymentIntents } from './DuffelPayments';
|
|
2
|
-
import { OfferRequests, Offers, OrderCancellations, Orders, OrderChangeRequests, OrderChangeOffers, OrderChanges, Payments, PartialOfferRequests, SeatMaps, AirlineInitiatedChanges } from './booking';
|
|
3
|
-
import { Config, DuffelError as _DuffelError } from './Client';
|
|
4
|
-
import { Aircraft, Airlines, Airports } from './supportingResources';
|
|
5
|
-
import { Suggestions } from './Places/Suggestions';
|
|
6
|
-
import { Refunds } from './DuffelPayments/Refunds';
|
|
7
|
-
import { Sessions } from './Links';
|
|
8
|
-
import { Webhooks } from './notifications';
|
|
9
|
-
export interface DuffelAPIClient {
|
|
10
|
-
aircraft: Aircraft;
|
|
11
|
-
airlines: Airlines;
|
|
12
|
-
airports: Airports;
|
|
13
|
-
offers: Offers;
|
|
14
|
-
offerRequests: OfferRequests;
|
|
15
|
-
orders: Orders;
|
|
16
|
-
orderChangeRequests: OrderChangeRequests;
|
|
17
|
-
orderChangeOffers: OrderChangeOffers;
|
|
18
|
-
orderChanges: OrderChanges;
|
|
19
|
-
orderCancellations: OrderCancellations;
|
|
20
|
-
payments: Payments;
|
|
21
|
-
seatMaps: SeatMaps;
|
|
22
|
-
}
|
|
23
|
-
export declare class Duffel {
|
|
24
|
-
private client;
|
|
25
|
-
aircraft: Aircraft;
|
|
26
|
-
airlineInitiatedChanges: AirlineInitiatedChanges;
|
|
27
|
-
airlines: Airlines;
|
|
28
|
-
airports: Airports;
|
|
29
|
-
links: Sessions;
|
|
30
|
-
offerRequests: OfferRequests;
|
|
31
|
-
offers: Offers;
|
|
32
|
-
orders: Orders;
|
|
33
|
-
orderChangeRequests: OrderChangeRequests;
|
|
34
|
-
orderChangeOffers: OrderChangeOffers;
|
|
35
|
-
orderChanges: OrderChanges;
|
|
36
|
-
orderCancellations: OrderCancellations;
|
|
37
|
-
payments: Payments;
|
|
38
|
-
seatMaps: SeatMaps;
|
|
39
|
-
paymentIntents: PaymentIntents;
|
|
40
|
-
partialOfferRequests: PartialOfferRequests;
|
|
41
|
-
suggestions: Suggestions;
|
|
42
|
-
refunds: Refunds;
|
|
43
|
-
webhooks: Webhooks;
|
|
44
|
-
constructor(config: Config);
|
|
45
|
-
}
|
|
46
|
-
export declare const DuffelError: typeof _DuffelError;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Headers } from 'node-fetch';
|
|
2
|
-
/**
|
|
3
|
-
* Our list APIs will only return a limited number of results at a time.
|
|
4
|
-
* By default, we'll return 50 results per page, but you can set this to any number between 1 and 200.
|
|
5
|
-
* @link https://duffel.com/docs/api/overview/pagination
|
|
6
|
-
*/
|
|
7
|
-
export interface PaginationMeta {
|
|
8
|
-
/**
|
|
9
|
-
* The number of results to be returned in a page, between 1 and 200 (optional, default is 50)
|
|
10
|
-
*/
|
|
11
|
-
limit?: number;
|
|
12
|
-
/**
|
|
13
|
-
* "Before" cursor for pagination
|
|
14
|
-
*/
|
|
15
|
-
before?: string;
|
|
16
|
-
/**
|
|
17
|
-
* "After" cursor for pagination
|
|
18
|
-
*/
|
|
19
|
-
after?: string | null;
|
|
20
|
-
}
|
|
21
|
-
export interface ApiResponseMeta {
|
|
22
|
-
/**
|
|
23
|
-
* The identifier of the request
|
|
24
|
-
*/
|
|
25
|
-
request_id: string;
|
|
26
|
-
/**
|
|
27
|
-
* The [HTTP status](https://httpstatuses.com/) of the request
|
|
28
|
-
*/
|
|
29
|
-
status: number;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Duffel uses standard [HTTP response codes](https://httpstatuses.com/) to indicate the success or failure of API requests.
|
|
33
|
-
* @link https://duffel.com/docs/api/overview/errors
|
|
34
|
-
*/
|
|
35
|
-
export interface ApiResponseError {
|
|
36
|
-
/**
|
|
37
|
-
* A machine-readable identifier for this specific error
|
|
38
|
-
*/
|
|
39
|
-
code: string;
|
|
40
|
-
/**
|
|
41
|
-
* A URL pointing to a place in our documentation where you can read about the error
|
|
42
|
-
*/
|
|
43
|
-
documentation_url: string;
|
|
44
|
-
/**
|
|
45
|
-
* A more detailed human-readable description of what went wrong
|
|
46
|
-
*/
|
|
47
|
-
message: string;
|
|
48
|
-
/**
|
|
49
|
-
* A quick and simple description of what went wrong
|
|
50
|
-
*/
|
|
51
|
-
title: string;
|
|
52
|
-
/**
|
|
53
|
-
* A machine-readable identifier for the general category of error
|
|
54
|
-
*/
|
|
55
|
-
type: string;
|
|
56
|
-
}
|
|
57
|
-
export interface DuffelResponse<T_Data> {
|
|
58
|
-
/**
|
|
59
|
-
* The body of the response
|
|
60
|
-
*/
|
|
61
|
-
data: T_Data;
|
|
62
|
-
/**
|
|
63
|
-
* Optional metadata for the request
|
|
64
|
-
*/
|
|
65
|
-
meta?: PaginationMeta;
|
|
66
|
-
/**
|
|
67
|
-
* The headers from the http response
|
|
68
|
-
*/
|
|
69
|
-
headers?: Headers;
|
|
70
|
-
}
|
|
71
|
-
export interface SDKOptions {
|
|
72
|
-
/**
|
|
73
|
-
* If `true` it will output the path and the method called
|
|
74
|
-
*/
|
|
75
|
-
verbose?: boolean;
|
|
76
|
-
}
|