sm-types 1.4.4 → 1.5.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.
Files changed (57) hide show
  1. package/dist/README.md +3 -0
  2. package/{common → dist/common}/index.d.ts +0 -0
  3. package/{common → dist/common}/index.js +0 -0
  4. package/{common → dist/common}/shared/index.d.ts +0 -0
  5. package/{common → dist/common}/shared/index.js +0 -0
  6. package/dist/errors/index.d.ts +1 -0
  7. package/dist/errors/index.js +23 -0
  8. package/dist/errors/user/create-user.d.ts +4 -0
  9. package/dist/errors/user/create-user.js +7 -0
  10. package/dist/errors/user/index.d.ts +1 -0
  11. package/dist/errors/user/index.js +13 -0
  12. package/dist/package.json +35 -0
  13. package/{sm-airlines → dist/sm-airlines}/command-params/index.d.ts +0 -0
  14. package/{sm-airlines → dist/sm-airlines}/command-params/index.js +0 -0
  15. package/{sm-airlines → dist/sm-airlines}/dtos/index.d.ts +0 -0
  16. package/{sm-airlines → dist/sm-airlines}/dtos/index.js +0 -0
  17. package/{sm-airlines → dist/sm-airlines}/dtos/request.d.ts +0 -0
  18. package/{sm-airlines → dist/sm-airlines}/dtos/request.js +0 -0
  19. package/{sm-airlines → dist/sm-airlines}/dtos/response.d.ts +0 -0
  20. package/{sm-airlines → dist/sm-airlines}/dtos/response.js +0 -0
  21. package/{sm-airlines → dist/sm-airlines}/index.d.ts +0 -0
  22. package/{sm-airlines → dist/sm-airlines}/index.js +0 -0
  23. package/{sm-azul → dist/sm-azul}/index.d.ts +0 -0
  24. package/{sm-azul → dist/sm-azul}/index.js +0 -0
  25. package/{sm-azul → dist/sm-azul}/shared/index.d.ts +0 -0
  26. package/{sm-azul → dist/sm-azul}/shared/index.js +0 -0
  27. package/{sm-car-rentals → dist/sm-car-rentals}/index.d.ts +0 -0
  28. package/{sm-car-rentals → dist/sm-car-rentals}/index.js +0 -0
  29. package/{sm-car-rentals → dist/sm-car-rentals}/localiza/index.d.ts +0 -0
  30. package/{sm-car-rentals → dist/sm-car-rentals}/localiza/index.js +0 -0
  31. package/{sm-car-rentals → dist/sm-car-rentals}/movida/index.d.ts +0 -0
  32. package/{sm-car-rentals → dist/sm-car-rentals}/movida/index.js +0 -0
  33. package/{sm-tech → dist/sm-tech}/index.d.ts +0 -0
  34. package/{sm-tech → dist/sm-tech}/index.js +0 -0
  35. package/{sm-tech → dist/sm-tech}/shared/index.d.ts +0 -0
  36. package/{sm-tech → dist/sm-tech}/shared/index.js +0 -0
  37. package/{sm-wcf → dist/sm-wcf}/index.d.ts +0 -0
  38. package/{sm-wcf → dist/sm-wcf}/index.js +0 -0
  39. package/package.json +22 -13
  40. package/src/common/index.ts +13 -0
  41. package/src/common/shared/index.ts +16 -0
  42. package/src/errors/index.ts +1 -0
  43. package/src/errors/user/create-user.ts +5 -0
  44. package/src/errors/user/index.ts +1 -0
  45. package/src/sm-airlines/command-params/index.ts +30 -0
  46. package/src/sm-airlines/dtos/index.ts +20 -0
  47. package/src/sm-airlines/dtos/request.ts +44 -0
  48. package/src/sm-airlines/dtos/response.ts +73 -0
  49. package/src/sm-airlines/index.ts +672 -0
  50. package/src/sm-azul/index.ts +231 -0
  51. package/src/sm-azul/shared/index.ts +895 -0
  52. package/src/sm-car-rentals/index.ts +163 -0
  53. package/src/sm-car-rentals/localiza/index.ts +12 -0
  54. package/src/sm-car-rentals/movida/index.ts +11 -0
  55. package/src/sm-tech/index.ts +137 -0
  56. package/src/sm-tech/shared/index.ts +116 -0
  57. package/src/sm-wcf/index.ts +201 -0
package/dist/README.md ADDED
@@ -0,0 +1,3 @@
1
+ ## sm-types
2
+
3
+ Package containing useful types for sm
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ export * as UserErrors from './user';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.UserErrors = void 0;
23
+ exports.UserErrors = __importStar(require("./user"));
@@ -0,0 +1,4 @@
1
+ export declare const CreateUser: {
2
+ EMAIL_TAKEN_BY_ACTIVE_USER: string;
3
+ EMAIL_TAKEN_BY_INACTIVE_USER: string;
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateUser = void 0;
4
+ exports.CreateUser = {
5
+ EMAIL_TAKEN_BY_ACTIVE_USER: 'user:create:email_taken_by_active_user',
6
+ EMAIL_TAKEN_BY_INACTIVE_USER: 'user:create:email_taken_by_inactive_user'
7
+ };
@@ -0,0 +1 @@
1
+ export * from './create-user';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./create-user"), exports);
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "sm-types",
3
+ "author": "Smartrips",
4
+ "license": "ISC",
5
+ "keywords": [],
6
+ "version": "1.5.1",
7
+ "description": "",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git@github.com:smartrips-br/sm-types.git"
11
+ },
12
+ "scripts": {
13
+ "prebuild": "rimraf dist",
14
+ "build": "npm run transpile && npm run copy-files",
15
+ "transpile": "tsc",
16
+ "copy-files": "cp ./package.json ./dist && cp ./README.md ./dist",
17
+ "prepublishOnly": "npm run build && cd dist"
18
+ },
19
+ "engines": {
20
+ "node": ">=12.22.0 <=13.0.0",
21
+ "npm": ">=6.13.4",
22
+ "yarn": ">=0.23.4"
23
+ },
24
+ "main": "index.js",
25
+ "types": "index.d.ts",
26
+ "files": [
27
+ "*/**"
28
+ ],
29
+ "dependencies": {
30
+ "typescript": "^4.1.3"
31
+ },
32
+ "devDependencies": {
33
+ "rimraf": "3.0.2"
34
+ }
35
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,26 +1,35 @@
1
1
  {
2
2
  "name": "sm-types",
3
- "version": "1.4.4",
3
+ "author": "Smartrips",
4
+ "license": "ISC",
5
+ "keywords": [],
6
+ "version": "1.5.1",
4
7
  "description": "",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git@github.com:smartrips-br/sm-types.git"
11
+ },
5
12
  "scripts": {
6
- "build": "tsc",
7
- "prepare": "npm run build",
8
- "test": "echo \"Error: no test specified\" && exit 1"
13
+ "prebuild": "rimraf dist",
14
+ "build": "npm run transpile && npm run copy-files",
15
+ "transpile": "tsc",
16
+ "copy-files": "cp ./package.json ./dist && cp ./README.md ./dist",
17
+ "prepublishOnly": "npm run build && cd dist"
18
+ },
19
+ "engines": {
20
+ "node": ">=12.22.0 <=13.0.0",
21
+ "npm": ">=6.13.4",
22
+ "yarn": ">=0.23.4"
9
23
  },
10
- "keywords": [],
11
- "author": "Caio Poyares",
12
- "license": "ISC",
13
24
  "main": "index.js",
14
25
  "types": "index.d.ts",
15
26
  "files": [
16
- "/common",
17
- "/sm-tech",
18
- "/sm-wcf",
19
- "/sm-azul",
20
- "/sm-airlines",
21
- "/sm-car-rentals"
27
+ "*/**"
22
28
  ],
23
29
  "dependencies": {
24
30
  "typescript": "^4.1.3"
31
+ },
32
+ "devDependencies": {
33
+ "rimraf": "3.0.2"
25
34
  }
26
35
  }
@@ -0,0 +1,13 @@
1
+ import * as SharedTypes from './shared';
2
+
3
+ export interface IPaymentMethod {
4
+ holderName?: string;
5
+ number?: string;
6
+ expirationDate?: string;
7
+ cvv?: string;
8
+ brand?: SharedTypes.ICardBrandsType;
9
+ pgmId?: string;
10
+ creditCardToken?: string;
11
+ cardType?: string;
12
+ payment_type: SharedTypes.PaymentMethodType;
13
+ }
@@ -0,0 +1,16 @@
1
+ const ICardBrands = {
2
+ MasterCard: "mastercard",
3
+ Visa: "visa",
4
+ Amex: "string",
5
+ Diners: "diners",
6
+ Elo: "elo"
7
+ } as const;
8
+
9
+ const PaymentMethods = {
10
+ CreditCard: 'credit_card',
11
+ Billed: 'billed'
12
+ } as const;
13
+
14
+ type ValueOf<T> = T[keyof T];
15
+ export type ICardBrandsType = ValueOf<typeof ICardBrands>;
16
+ export type PaymentMethodType = ValueOf<typeof PaymentMethods>
@@ -0,0 +1 @@
1
+ export * as UserErrors from './user'
@@ -0,0 +1,5 @@
1
+ export const CreateUser = {
2
+ EMAIL_TAKEN_BY_ACTIVE_USER: 'user:create:email_taken_by_active_user',
3
+ EMAIL_TAKEN_BY_INACTIVE_USER: 'user:create:email_taken_by_inactive_user'
4
+ }
5
+
@@ -0,0 +1 @@
1
+ export * from './create-user'
@@ -0,0 +1,30 @@
1
+ import { IAddOfferReqDto, IReserveOfferReqDto, IBuyOfferReqDto } from "../dtos";
2
+
3
+ export interface IAddOfferCommandParams extends IAddOfferReqDto {}
4
+
5
+ export interface IRefreshAvailabilityCommandParams {
6
+ offerId: string;
7
+ }
8
+ export interface IBuyOfferCommandParams extends IBuyOfferReqDto {
9
+ offerId: string;
10
+ }
11
+ export interface ICancelOfferCommandParams {
12
+ offerId: string;
13
+ }
14
+ export interface IReserveOfferCommandParams extends IReserveOfferReqDto {
15
+ offerId: string;
16
+ }
17
+ export interface IOrderReserveOfferCommandParams extends IReserveOfferReqDto {
18
+ offerId: string;
19
+ webhookUrl: string;
20
+ }
21
+ export interface IProcessReserveCommandParams extends IReserveOfferReqDto {
22
+ offerId: string;
23
+ webhookPath: string;
24
+ }
25
+ export interface IReplaceOfferCommandParams {
26
+ offerId: string;
27
+ }
28
+ export interface ICheckReserveQueryParams {
29
+ offerId: string;
30
+ }
@@ -0,0 +1,20 @@
1
+ export {
2
+ IAddOfferReqDto,
3
+ IBuyOfferReqDto,
4
+ IReserveOfferReqDto,
5
+ IOrderReserveOfferReqDto,
6
+ IListOffersReqDto,
7
+ } from "./request";
8
+ export {
9
+ IListOffersResDto,
10
+ IAddOfferResDto,
11
+ IGetOfferDetailsResDto,
12
+ IRefreshAvailabilityResDto,
13
+ IReplaceOfferResDto,
14
+ IReserveOfferResDto,
15
+ IOrderReserveOfferResDto,
16
+ ICheckReserveOfferResDto,
17
+ IBuyOfferResDto,
18
+ ICancelOfferResDto,
19
+ IGetChargeDetailsResDto
20
+ } from "./response";
@@ -0,0 +1,44 @@
1
+ import {
2
+ IPaxInfo,
3
+ IPassengerInfo,
4
+ IContactInfo,
5
+ IRoute,
6
+ IOrderOptions,
7
+ ISmWcfOffer,
8
+ } from "../index";
9
+ export interface IListOffersReqDto {
10
+ international: boolean;
11
+ cabinClass: string;
12
+ promoCode: string;
13
+ airlinesCode: string;
14
+ paxInfo: IPaxInfo;
15
+ routes: IRoute[];
16
+ config: {
17
+ sortType: IOrderOptions;
18
+ groupByRoute: boolean;
19
+ };
20
+ }
21
+ export interface IAddOfferReqDto {
22
+ international: boolean;
23
+ offerDetails: ISmWcfOffer;
24
+ cabinClass: string;
25
+ promoCode: string;
26
+ airlinesCode: string;
27
+ paxInfo: IPaxInfo;
28
+ routes: IRoute[];
29
+ recordLocator?: string;
30
+ bookingCode?: string;
31
+ }
32
+ export interface IReserveOfferReqDto {
33
+ contactInfo: IContactInfo;
34
+ passengersInfo: IPassengerInfo[];
35
+ }
36
+ export interface IOrderReserveOfferReqDto {
37
+ contactInfo: IContactInfo;
38
+ passengersInfo: IPassengerInfo[];
39
+ webhookUrl: string;
40
+ }
41
+ export interface IBuyOfferReqDto {
42
+ paymentDataHash: string;
43
+ passengersInfo: IPassengerInfo[];
44
+ }
@@ -0,0 +1,73 @@
1
+ import {
2
+ IListOffersFiltersInfo,
3
+ ISmAzulOffer,
4
+ ISmWcfOffer,
5
+ IPriceDetails,
6
+ ISuppliers,
7
+ } from "../index";
8
+ export interface IListOffersResDto {
9
+ generalData: IListOffersFiltersInfo;
10
+ offers: ISmWcfOffer[];
11
+ }
12
+ export interface IAddOfferResDto {
13
+ hasPriceChanged: boolean;
14
+ available: boolean;
15
+ verifiedOffer: ISmWcfOffer;
16
+ airlinesOfferId: number;
17
+ }
18
+ export declare type IGetOfferDetailsResDto = ISmAzulOffer | ISmWcfOffer;
19
+ export interface IRefreshAvailabilityResDto {
20
+ availability: boolean;
21
+ reservedUntil?: Date;
22
+ currentPrice: number;
23
+ selectedPrice: number;
24
+ isSamePrice: boolean;
25
+ refreshedOffer: ISmWcfOffer;
26
+ stillReserved: boolean;
27
+ }
28
+ export interface IReplaceOfferResDto {
29
+ replacingOffer: ISmWcfOffer;
30
+ newAirlinesOfferId: any;
31
+ }
32
+ export interface IReserveOfferResDto {
33
+ status: string;
34
+ recordLocator: string;
35
+ price: number;
36
+ priceDetails?: IPriceDetails;
37
+ reservedUntil: Date | string;
38
+ extraLocators?: string;
39
+ refreshedOffer: ISmWcfOffer;
40
+ }
41
+ export interface IOrderReserveOfferResDto {
42
+ message: string;
43
+ messageId: string;
44
+ }
45
+ export interface ICheckReserveOfferResDto {
46
+ error?: boolean;
47
+ message?: string;
48
+ availability: boolean;
49
+ reservedUntil?: Date;
50
+ currentPrice: number;
51
+ selectedPrice: number;
52
+ priceDetails: IPriceDetails;
53
+ isSamePrice: boolean;
54
+ }
55
+ export interface IBuyOfferResDto {
56
+ recordLocator: string;
57
+ bookingCode: string;
58
+ price: number;
59
+ emittedAt: Date;
60
+ }
61
+ export interface ICancelOfferResDto {
62
+ supplier: ISuppliers;
63
+ recordLocator: string;
64
+ costToCancel?: number;
65
+ refundedValue?: number;
66
+ }
67
+
68
+ export interface IGetChargeDetailsResDto {
69
+ client_discount: number;
70
+ cia_charge: number;
71
+ smartrips_charge: number;
72
+ final_price: number;
73
+ }