@shipengine/connect-carrier-api 4.1.8 → 4.3.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/lib/app/carrier-app-definition.d.ts +8 -1
- package/lib/app/create-endpoint-mapping.d.ts +2 -3
- package/lib/app/create-endpoint-mapping.js +1 -0
- package/lib/app/create-endpoint-mapping.js.map +1 -1
- package/lib/app/metadata/carrier.d.ts +3 -0
- package/lib/app/metadata/carrier.js +2 -0
- package/lib/app/metadata/carrier.js.map +1 -1
- package/lib/app/metadata/package-rating-group-dimensions.d.ts +22 -0
- package/lib/app/metadata/package-rating-group-dimensions.js +17 -0
- package/lib/app/metadata/package-rating-group-dimensions.js.map +1 -0
- package/lib/app/metadata/package-rating-group-weight.d.ts +10 -0
- package/lib/app/metadata/package-rating-group-weight.js +11 -0
- package/lib/app/metadata/package-rating-group-weight.js.map +1 -0
- package/lib/app/metadata/package-rating-group.d.ts +19 -0
- package/lib/app/metadata/package-rating-group.js +16 -0
- package/lib/app/metadata/package-rating-group.js.map +1 -0
- package/package.json +2 -2
- package/src/app/carrier-app-definition.ts +8 -1
- package/src/app/create-endpoint-mapping.ts +3 -2
- package/src/app/metadata/carrier.ts +4 -0
- package/src/app/metadata/package-rating-group-dimensions.ts +34 -0
- package/src/app/metadata/package-rating-group-weight.ts +16 -0
- package/src/app/metadata/package-rating-group.ts +34 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -3,7 +3,7 @@ import type { Request } from 'express';
|
|
|
3
3
|
import { RegisterRequest, CreateLabelRequest, VoidLabelsRequest, CreateManifestRequest, GetManifestRequest, SchedulePickupRequest, CancelPickupRequest, GetRatesRequest, TrackingRequest, CancelNotificationRequest, CreateNotificationRequest, ValidateInboundDataRequest, NormalizeTrackingDataRequest, GetRelayPointsRequest, GetServicePointsRequest, GetServicePointRequest, ImportTrackingEventsRequest } from '../requests';
|
|
4
4
|
import { RegisterResponse, CreateLabelResponse, VoidLabelsResponse, CreateManifestResponse, SchedulePickupResponse, CancelPickupResponse, GetRatesResponse, TrackingResponse, CancelNotificationResponse, CreateNotificationResponse, ValidateInboundDataResponse, NormalizeTrackingDataResponse, GetRelayPointsResponse, GetServicePointsResponse, GetServicePointResponse } from '../responses';
|
|
5
5
|
import { CarrierAppMetadata } from './metadata/carrier-app-metadata';
|
|
6
|
-
import { RequestResponseInfo } from '@shipengine/connect-runtime';
|
|
6
|
+
import { RequestResponseInfo, Handler } from '@shipengine/connect-runtime';
|
|
7
7
|
/**
|
|
8
8
|
* @description This defines a connect carrier app
|
|
9
9
|
*/
|
|
@@ -101,4 +101,11 @@ export interface CarrierAppDefinition {
|
|
|
101
101
|
redactExternalRequest?: (req: RequestResponseInfo) => Promise<RequestResponseInfo> | RequestResponseInfo;
|
|
102
102
|
/** @description A method that gets additional information to return with the diagnostic version route */
|
|
103
103
|
getAdditionalVersionInfo?: () => Promise<Record<string, string>> | Record<string, string>;
|
|
104
|
+
/**
|
|
105
|
+
* @description A collection of additional routes that can be used to extend the functionality of the app.
|
|
106
|
+
* Extension methods are not automatically called by the ShipEngine platform, and require working with Auctane developers to implement.
|
|
107
|
+
* The request and response shapes of each method will be defined by Auctane, but will not be documented as part of Connect unless
|
|
108
|
+
* they are made public and the functionality is taken out of extensions and into a named method.
|
|
109
|
+
*/
|
|
110
|
+
Extensions?: Record<string, Handler>;
|
|
104
111
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Method } from '@shipengine/connect-runtime';
|
|
2
|
-
import { ApiEndpoints } from './constants';
|
|
1
|
+
import { Method, Handler } from '@shipengine/connect-runtime';
|
|
3
2
|
import { CarrierAppDefinition } from './carrier-app-definition';
|
|
4
|
-
export declare const createEndpointMapping: (definition: CarrierAppDefinition) => [Method,
|
|
3
|
+
export declare const createEndpointMapping: (definition: CarrierAppDefinition) => [Method, string, Handler | undefined][];
|
|
@@ -23,6 +23,7 @@ const createEndpointMapping = (definition) => [
|
|
|
23
23
|
[connect_runtime_1.Method.POST, constants_1.ApiEndpoints.GetServicePoints, definition.GetServicePoints],
|
|
24
24
|
[connect_runtime_1.Method.POST, constants_1.ApiEndpoints.GetServicePoint, definition.GetServicePoint],
|
|
25
25
|
[connect_runtime_1.Method.POST, constants_1.ApiEndpoints.ImportTrackingEvents, definition.ImportTrackingEvents],
|
|
26
|
+
...(0, connect_runtime_1.mapExtensions)(definition.Extensions),
|
|
26
27
|
];
|
|
27
28
|
exports.createEndpointMapping = createEndpointMapping;
|
|
28
29
|
//# sourceMappingURL=create-endpoint-mapping.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-endpoint-mapping.js","sourceRoot":"","sources":["../../src/app/create-endpoint-mapping.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"create-endpoint-mapping.js","sourceRoot":"","sources":["../../src/app/create-endpoint-mapping.ts"],"names":[],"mappings":";;;AAAA,iEAA6E;AAC7E,2CAA2C;AAGpC,MAAM,qBAAqB,GAAG,CACnC,UAAgC,EACS,EAAE,CAAC;IAC5C,iFAAiF;IACjF,yFAAyF;IACzF,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,kBAAkB,EAAE,UAAU,CAAC,kBAAkB,CAAC;IAC7E,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC;IACjE,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC;IAC/D,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,cAAc,EAAE,UAAU,CAAC,cAAc,CAAC;IACrE,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC;IAC/D,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,kBAAkB,EAAE,UAAU,CAAC,kBAAkB,CAAC;IAC7E,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC;IACzD,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,qBAAqB,EAAE,UAAU,CAAC,qBAAqB,CAAC;IACnF,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC;IACzD,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,cAAc,EAAE,UAAU,CAAC,cAAc,CAAC;IACrE,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC;IACnD,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,mBAAmB,EAAE,UAAU,CAAC,mBAAmB,CAAC;IAC/E,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC;IAC7D,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,cAAc,EAAE,UAAU,CAAC,cAAc,CAAC;IACrE,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,CAAC;IACzE,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,eAAe,EAAE,UAAU,CAAC,eAAe,CAAC;IACvE,CAAC,wBAAM,CAAC,IAAI,EAAE,wBAAY,CAAC,oBAAoB,EAAE,UAAU,CAAC,oBAAoB,CAAC;IACjF,GAAG,IAAA,+BAAa,EAAC,UAAU,CAAC,UAAU,CAAC;CACxC,CAAC;AAvBW,QAAA,qBAAqB,yBAuBhC"}
|
|
@@ -10,6 +10,7 @@ import { ConfirmationDictionary } from './confirmation-type';
|
|
|
10
10
|
import Joi from 'joi';
|
|
11
11
|
import { NativeRatingConfiguration } from './native-rating-configuration';
|
|
12
12
|
import { Zone } from './zone';
|
|
13
|
+
import { PackageRatingGroup } from './package-rating-group';
|
|
13
14
|
/** @description Basic structure for each carrier */
|
|
14
15
|
export interface Carrier {
|
|
15
16
|
/** @description Defines UI Modals for connecting and updating settings */
|
|
@@ -55,5 +56,7 @@ export interface Carrier {
|
|
|
55
56
|
DocumentTemplate?: string;
|
|
56
57
|
/** @description List of possible zones used by the carrier. */
|
|
57
58
|
Zones?: Zone[];
|
|
59
|
+
/** @description List of package rating groups for the carrier */
|
|
60
|
+
PackageRatingGroups?: PackageRatingGroup[];
|
|
58
61
|
}
|
|
59
62
|
export declare const CarrierSchema: Joi.ObjectSchema<any>;
|
|
@@ -16,6 +16,7 @@ const native_rating_configuration_1 = require("./native-rating-configuration");
|
|
|
16
16
|
const file_exists_1 = require("./custom-validators/file-exists");
|
|
17
17
|
const zone_1 = require("./zone");
|
|
18
18
|
const connect_runtime_1 = require("@shipengine/connect-runtime");
|
|
19
|
+
const package_rating_group_1 = require("./package-rating-group");
|
|
19
20
|
exports.CarrierSchema = joi_1.default.object({
|
|
20
21
|
AccountModals: account_modals_1.AccountModalsSchema.required(),
|
|
21
22
|
PackageTypes: joi_1.default.array().optional().items(package_type_1.PackageTypeSchema).unique('Id'),
|
|
@@ -58,5 +59,6 @@ exports.CarrierSchema = joi_1.default.object({
|
|
|
58
59
|
.pattern(new RegExp('^.*.carrier$'))
|
|
59
60
|
.message('Template file must have .carrier extension.'),
|
|
60
61
|
Zones: joi_1.default.array().optional().items(zone_1.ZoneSchema).unique('ApiCode'),
|
|
62
|
+
PackageRatingGroups: joi_1.default.array().optional().items(package_rating_group_1.PackageRatingGroupSchema).unique('Id'),
|
|
61
63
|
}).with('DocumentTemplate', 'ApiCode');
|
|
62
64
|
//# sourceMappingURL=carrier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carrier.js","sourceRoot":"","sources":["../../../src/app/metadata/carrier.ts"],"names":[],"mappings":";;;;AAAA,qDAAsE;AACtE,iDAAgE;AAChE,yDAA4E;AAC5E,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C,CAAC,CAAC,QAAQ,EAAE;IACb,YAAY,EAAE,6DAA+B,CAAC,QAAQ,EAAE;IACxD,gBAAgB,EAAE,aAAG,CAAC,MAAM,EAAE;SAC3B,QAAQ,EAAE;SACV,MAAM,CAAC,wBAAU,EAAE,iBAAiB,CAAC;SACrC,OAAO,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC;SACnC,OAAO,CAAC,6CAA6C,CAAC;IACzD,KAAK,EAAE,aAAG,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,iBAAU,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;IACjE,mBAAmB,EAAE,aAAG,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,+CAAwB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;CACzF,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { DimensionUnit } from '../../models';
|
|
3
|
+
/** @description Dimensions specific to a package rate class */
|
|
4
|
+
export interface PackageRatingGroupDimensions {
|
|
5
|
+
/** @description Unit of the dimensions */
|
|
6
|
+
Unit: DimensionUnit;
|
|
7
|
+
/** @description Length of the package */
|
|
8
|
+
Length?: number;
|
|
9
|
+
/** @description Width of the package */
|
|
10
|
+
Width?: number;
|
|
11
|
+
/** @description Height of the package */
|
|
12
|
+
Height?: number;
|
|
13
|
+
/** @description Girth of the package as defined by the carrier */
|
|
14
|
+
Girth?: number;
|
|
15
|
+
/** @description No two sides exceed this amount */
|
|
16
|
+
NoTwoSides?: number;
|
|
17
|
+
/** @description Length plus girth should not exceed this amount */
|
|
18
|
+
LengthPlusGirth?: number;
|
|
19
|
+
/** @description Volume of the package */
|
|
20
|
+
Volume?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const PackageRatingGroupDimensionsSchema: Joi.ObjectSchema<any>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackageRatingGroupDimensionsSchema = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const joi_1 = tslib_1.__importDefault(require("joi"));
|
|
6
|
+
const dimension_unit_schema_1 = require("../../models/units/dimension-unit-schema");
|
|
7
|
+
exports.PackageRatingGroupDimensionsSchema = joi_1.default.object({
|
|
8
|
+
Unit: dimension_unit_schema_1.DimensionUnitSchema.required(),
|
|
9
|
+
Length: joi_1.default.number().min(0).optional(),
|
|
10
|
+
Width: joi_1.default.number().min(0).optional(),
|
|
11
|
+
Height: joi_1.default.number().min(0).optional(),
|
|
12
|
+
NoTwoSides: joi_1.default.number().min(0).optional(),
|
|
13
|
+
LengthPlusGirth: joi_1.default.number().min(0).optional(),
|
|
14
|
+
Girth: joi_1.default.number().min(0).optional(),
|
|
15
|
+
Volume: joi_1.default.number().min(0).optional(),
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=package-rating-group-dimensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-rating-group-dimensions.js","sourceRoot":"","sources":["../../../src/app/metadata/package-rating-group-dimensions.ts"],"names":[],"mappings":";;;;AAAA,sDAAsB;AAEtB,oFAA+E;AAsBlE,QAAA,kCAAkC,GAAG,aAAG,CAAC,MAAM,CAAC;IAC3D,IAAI,EAAE,2CAAmB,CAAC,QAAQ,EAAE;IACpC,MAAM,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtC,KAAK,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrC,MAAM,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtC,UAAU,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC1C,eAAe,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC/C,KAAK,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrC,MAAM,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { WeightUnit } from '../../models';
|
|
3
|
+
/** @description Weight of a package rating group */
|
|
4
|
+
export interface PackageRatingGroupWeight {
|
|
5
|
+
/** @description Unit of the weight */
|
|
6
|
+
Unit: WeightUnit;
|
|
7
|
+
/** @description Actual weight value */
|
|
8
|
+
Value: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const PackageRatingGroupWeightSchema: Joi.ObjectSchema<any>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackageRatingGroupWeightSchema = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const joi_1 = tslib_1.__importDefault(require("joi"));
|
|
6
|
+
const weight_unit_schema_1 = require("../../models/units/weight-unit-schema");
|
|
7
|
+
exports.PackageRatingGroupWeightSchema = joi_1.default.object({
|
|
8
|
+
Unit: weight_unit_schema_1.WeightUnitSchema.required(),
|
|
9
|
+
Value: joi_1.default.number().min(0),
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=package-rating-group-weight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-rating-group-weight.js","sourceRoot":"","sources":["../../../src/app/metadata/package-rating-group-weight.ts"],"names":[],"mappings":";;;;AAAA,sDAAsB;AAEtB,8EAAyE;AAU5D,QAAA,8BAA8B,GAAG,aAAG,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,qCAAgB,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { PackageRatingGroupDimensions } from './package-rating-group-dimensions';
|
|
3
|
+
import { PackageRatingGroupWeight } from './package-rating-group-weight';
|
|
4
|
+
/** @description Details about how packages are related to rates */
|
|
5
|
+
export interface PackageRatingGroup {
|
|
6
|
+
/** @description Id of the rating group */
|
|
7
|
+
Id: string;
|
|
8
|
+
/** @description Id of the package type to which this rating group corresponds */
|
|
9
|
+
PackageTypeId: string;
|
|
10
|
+
/** @description Name of the package rating group */
|
|
11
|
+
Name: string;
|
|
12
|
+
/** @description This is the code that will be sent to requests, this should be the same code the carrier's api would expect */
|
|
13
|
+
CarrierPackageTypeCode: string;
|
|
14
|
+
/** @description Maximum allowable dimensions of packages for the rating group */
|
|
15
|
+
DimensionLimits: PackageRatingGroupDimensions;
|
|
16
|
+
/** @description Maximum allowable weight of packages for the rating group */
|
|
17
|
+
MaxWeight: PackageRatingGroupWeight;
|
|
18
|
+
}
|
|
19
|
+
export declare const PackageRatingGroupSchema: Joi.ObjectSchema<any>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackageRatingGroupSchema = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const joi_1 = tslib_1.__importDefault(require("joi"));
|
|
6
|
+
const package_rating_group_dimensions_1 = require("./package-rating-group-dimensions");
|
|
7
|
+
const package_rating_group_weight_1 = require("./package-rating-group-weight");
|
|
8
|
+
exports.PackageRatingGroupSchema = joi_1.default.object({
|
|
9
|
+
Id: joi_1.default.string().uuid().required(),
|
|
10
|
+
PackageTypeId: joi_1.default.string().uuid().required(),
|
|
11
|
+
Name: joi_1.default.string().required().max(50),
|
|
12
|
+
CarrierPackageTypeCode: joi_1.default.string().required().max(50),
|
|
13
|
+
DimensionLimits: package_rating_group_dimensions_1.PackageRatingGroupDimensionsSchema.optional(),
|
|
14
|
+
MaxWeight: package_rating_group_weight_1.PackageRatingGroupWeightSchema.optional(),
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=package-rating-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-rating-group.js","sourceRoot":"","sources":["../../../src/app/metadata/package-rating-group.ts"],"names":[],"mappings":";;;;AAAA,sDAAsB;AACtB,uFAG2C;AAC3C,+EAGuC;AAkB1B,QAAA,wBAAwB,GAAG,aAAG,CAAC,MAAM,CAAC;IACjD,EAAE,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAClC,aAAa,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC7C,IAAI,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;IACrC,sBAAsB,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;IACvD,eAAe,EAAE,oEAAkC,CAAC,QAAQ,EAAE;IAC9D,SAAS,EAAE,4DAA8B,CAAC,QAAQ,EAAE;CACrD,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipengine/connect-carrier-api",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "This is the typescript/javascript definitions for carrier api",
|
|
5
5
|
"homepage": "https://connect.shipengine.com",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"tslib": "^2.5.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@shipengine/connect-runtime": "^4.
|
|
48
|
+
"@shipengine/connect-runtime": "^4.2.0",
|
|
49
49
|
"express": "^4.18.2",
|
|
50
50
|
"winston": "^3.8.2"
|
|
51
51
|
}
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
|
|
41
41
|
import { CarrierAppMetadata } from './metadata/carrier-app-metadata';
|
|
42
42
|
|
|
43
|
-
import { RequestResponseInfo } from '@shipengine/connect-runtime';
|
|
43
|
+
import { RequestResponseInfo, Handler } from '@shipengine/connect-runtime';
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* @description This defines a connect carrier app
|
|
@@ -167,4 +167,11 @@ export interface CarrierAppDefinition {
|
|
|
167
167
|
) => Promise<RequestResponseInfo> | RequestResponseInfo;
|
|
168
168
|
/** @description A method that gets additional information to return with the diagnostic version route */
|
|
169
169
|
getAdditionalVersionInfo?: () => Promise<Record<string, string>> | Record<string, string>;
|
|
170
|
+
/**
|
|
171
|
+
* @description A collection of additional routes that can be used to extend the functionality of the app.
|
|
172
|
+
* Extension methods are not automatically called by the ShipEngine platform, and require working with Auctane developers to implement.
|
|
173
|
+
* The request and response shapes of each method will be defined by Auctane, but will not be documented as part of Connect unless
|
|
174
|
+
* they are made public and the functionality is taken out of extensions and into a named method.
|
|
175
|
+
*/
|
|
176
|
+
Extensions?: Record<string, Handler>;
|
|
170
177
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Method } from '@shipengine/connect-runtime';
|
|
1
|
+
import { Method, Handler, mapExtensions } from '@shipengine/connect-runtime';
|
|
2
2
|
import { ApiEndpoints } from './constants';
|
|
3
3
|
import { CarrierAppDefinition } from './carrier-app-definition';
|
|
4
4
|
|
|
5
5
|
export const createEndpointMapping = (
|
|
6
6
|
definition: CarrierAppDefinition,
|
|
7
|
-
): [Method,
|
|
7
|
+
): [Method, string, Handler | undefined][] => [
|
|
8
8
|
//TODO: Remove `Method.POST` from this and all other maps since they are ALL post
|
|
9
9
|
//TODO: Remove JOI validation from all endpoints and replace them with OpenAPI validation
|
|
10
10
|
[Method.POST, ApiEndpoints.CancelNotification, definition.CancelNotification],
|
|
@@ -24,4 +24,5 @@ export const createEndpointMapping = (
|
|
|
24
24
|
[Method.POST, ApiEndpoints.GetServicePoints, definition.GetServicePoints],
|
|
25
25
|
[Method.POST, ApiEndpoints.GetServicePoint, definition.GetServicePoint],
|
|
26
26
|
[Method.POST, ApiEndpoints.ImportTrackingEvents, definition.ImportTrackingEvents],
|
|
27
|
+
...mapExtensions(definition.Extensions),
|
|
27
28
|
];
|
|
@@ -16,6 +16,7 @@ import { fileExists } from './custom-validators/file-exists';
|
|
|
16
16
|
import { Zone, ZoneSchema } from './zone';
|
|
17
17
|
|
|
18
18
|
import { ApiCodeRegex, ApiCodeValidationMessage } from '@shipengine/connect-runtime';
|
|
19
|
+
import { PackageRatingGroup, PackageRatingGroupSchema } from './package-rating-group';
|
|
19
20
|
|
|
20
21
|
/** @description Basic structure for each carrier */
|
|
21
22
|
export interface Carrier {
|
|
@@ -62,6 +63,8 @@ export interface Carrier {
|
|
|
62
63
|
DocumentTemplate?: string;
|
|
63
64
|
/** @description List of possible zones used by the carrier. */
|
|
64
65
|
Zones?: Zone[];
|
|
66
|
+
/** @description List of package rating groups for the carrier */
|
|
67
|
+
PackageRatingGroups?: PackageRatingGroup[];
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
export const CarrierSchema = Joi.object({
|
|
@@ -110,4 +113,5 @@ export const CarrierSchema = Joi.object({
|
|
|
110
113
|
.pattern(new RegExp('^.*.carrier$'))
|
|
111
114
|
.message('Template file must have .carrier extension.'),
|
|
112
115
|
Zones: Joi.array().optional().items(ZoneSchema).unique('ApiCode'),
|
|
116
|
+
PackageRatingGroups: Joi.array().optional().items(PackageRatingGroupSchema).unique('Id'),
|
|
113
117
|
}).with('DocumentTemplate', 'ApiCode');
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { DimensionUnit } from '../../models';
|
|
3
|
+
import { DimensionUnitSchema } from '../../models/units/dimension-unit-schema';
|
|
4
|
+
|
|
5
|
+
/** @description Dimensions specific to a package rate class */
|
|
6
|
+
export interface PackageRatingGroupDimensions {
|
|
7
|
+
/** @description Unit of the dimensions */
|
|
8
|
+
Unit: DimensionUnit;
|
|
9
|
+
/** @description Length of the package */
|
|
10
|
+
Length?: number;
|
|
11
|
+
/** @description Width of the package */
|
|
12
|
+
Width?: number;
|
|
13
|
+
/** @description Height of the package */
|
|
14
|
+
Height?: number;
|
|
15
|
+
/** @description Girth of the package as defined by the carrier */
|
|
16
|
+
Girth?: number;
|
|
17
|
+
/** @description No two sides exceed this amount */
|
|
18
|
+
NoTwoSides?: number;
|
|
19
|
+
/** @description Length plus girth should not exceed this amount */
|
|
20
|
+
LengthPlusGirth?: number;
|
|
21
|
+
/** @description Volume of the package */
|
|
22
|
+
Volume?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const PackageRatingGroupDimensionsSchema = Joi.object({
|
|
26
|
+
Unit: DimensionUnitSchema.required(),
|
|
27
|
+
Length: Joi.number().min(0).optional(),
|
|
28
|
+
Width: Joi.number().min(0).optional(),
|
|
29
|
+
Height: Joi.number().min(0).optional(),
|
|
30
|
+
NoTwoSides: Joi.number().min(0).optional(),
|
|
31
|
+
LengthPlusGirth: Joi.number().min(0).optional(),
|
|
32
|
+
Girth: Joi.number().min(0).optional(),
|
|
33
|
+
Volume: Joi.number().min(0).optional(),
|
|
34
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { WeightUnit } from '../../models';
|
|
3
|
+
import { WeightUnitSchema } from '../../models/units/weight-unit-schema';
|
|
4
|
+
|
|
5
|
+
/** @description Weight of a package rating group */
|
|
6
|
+
export interface PackageRatingGroupWeight {
|
|
7
|
+
/** @description Unit of the weight */
|
|
8
|
+
Unit: WeightUnit;
|
|
9
|
+
/** @description Actual weight value */
|
|
10
|
+
Value: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const PackageRatingGroupWeightSchema = Joi.object({
|
|
14
|
+
Unit: WeightUnitSchema.required(),
|
|
15
|
+
Value: Joi.number().min(0),
|
|
16
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import {
|
|
3
|
+
PackageRatingGroupDimensions,
|
|
4
|
+
PackageRatingGroupDimensionsSchema,
|
|
5
|
+
} from './package-rating-group-dimensions';
|
|
6
|
+
import {
|
|
7
|
+
PackageRatingGroupWeight,
|
|
8
|
+
PackageRatingGroupWeightSchema,
|
|
9
|
+
} from './package-rating-group-weight';
|
|
10
|
+
|
|
11
|
+
/** @description Details about how packages are related to rates */
|
|
12
|
+
export interface PackageRatingGroup {
|
|
13
|
+
/** @description Id of the rating group */
|
|
14
|
+
Id: string;
|
|
15
|
+
/** @description Id of the package type to which this rating group corresponds */
|
|
16
|
+
PackageTypeId: string;
|
|
17
|
+
/** @description Name of the package rating group */
|
|
18
|
+
Name: string;
|
|
19
|
+
/** @description This is the code that will be sent to requests, this should be the same code the carrier's api would expect */
|
|
20
|
+
CarrierPackageTypeCode: string;
|
|
21
|
+
/** @description Maximum allowable dimensions of packages for the rating group */
|
|
22
|
+
DimensionLimits: PackageRatingGroupDimensions;
|
|
23
|
+
/** @description Maximum allowable weight of packages for the rating group */
|
|
24
|
+
MaxWeight: PackageRatingGroupWeight;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const PackageRatingGroupSchema = Joi.object({
|
|
28
|
+
Id: Joi.string().uuid().required(),
|
|
29
|
+
PackageTypeId: Joi.string().uuid().required(),
|
|
30
|
+
Name: Joi.string().required().max(50),
|
|
31
|
+
CarrierPackageTypeCode: Joi.string().required().max(50), // Copied from package type validation
|
|
32
|
+
DimensionLimits: PackageRatingGroupDimensionsSchema.optional(),
|
|
33
|
+
MaxWeight: PackageRatingGroupWeightSchema.optional(),
|
|
34
|
+
});
|