@shipengine/connect-carrier-api 2.1.21 → 2.2.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 +1 -1
- package/lib/app/carrier-app.d.ts +1 -0
- package/lib/app/carrier-app.js +91 -63
- package/lib/app/carrier-app.js.map +1 -1
- package/lib/app/constants.d.ts +14 -0
- package/lib/app/constants.js +19 -0
- package/lib/app/constants.js.map +1 -0
- package/lib/app/internal/{carrier-app-specificaion.d.ts → carrier-app-specification.d.ts} +4 -1
- package/lib/app/internal/{carrier-app-specificaion.js → carrier-app-specification.js} +1 -1
- package/lib/app/internal/carrier-app-specification.js.map +1 -0
- package/lib/app/internal/{carrier-specificaion.d.ts → carrier-specification.d.ts} +0 -0
- package/lib/app/internal/{carrier-specificaion.js → carrier-specification.js} +1 -1
- package/lib/app/internal/carrier-specification.js.map +1 -0
- package/lib/app/internal/metadata.d.ts +4 -2
- package/lib/app/internal/metadata.js +6 -2
- package/lib/app/internal/metadata.js.map +1 -1
- package/lib/app/internal/route.d.ts +1 -0
- package/lib/app/metadata/auth-identifier.d.ts +10 -0
- package/lib/app/metadata/auth-identifier.js +18 -0
- package/lib/app/metadata/auth-identifier.js.map +1 -0
- package/lib/app/metadata/auth-specification.d.ts +19 -0
- package/lib/app/metadata/auth-specification.js +20 -0
- package/lib/app/metadata/auth-specification.js.map +1 -0
- package/lib/app/metadata/carrier-app-metadata.d.ts +3 -1
- package/lib/app/metadata/carrier-app-metadata.js +3 -2
- package/lib/app/metadata/carrier-app-metadata.js.map +1 -1
- package/lib/app/metadata/index.d.ts +4 -1
- package/lib/app/metadata/index.js +4 -1
- package/lib/app/metadata/index.js.map +1 -1
- package/lib/app/metadata/monoauth.d.ts +102 -0
- package/lib/app/metadata/monoauth.js +82 -0
- package/lib/app/metadata/monoauth.js.map +1 -0
- package/lib/models/addresses/address-base.d.ts +2 -0
- package/lib/models/addresses/address-base.js.map +1 -1
- package/lib/models/billing/billing-categories.d.ts +2 -0
- package/lib/models/billing/billing-categories.js +4 -1
- package/lib/models/billing/billing-categories.js.map +1 -1
- package/lib/models/billing/billing-line-item.d.ts +2 -0
- package/lib/models/billing/billing-line-item.js +12 -1
- package/lib/models/billing/billing-line-item.js.map +1 -1
- package/lib/models/currency.d.ts +2 -0
- package/lib/models/currency.js +7 -1
- package/lib/models/currency.js.map +1 -1
- package/lib/models/documents/document-type.d.ts +2 -0
- package/lib/models/documents/document-type.js +4 -1
- package/lib/models/documents/document-type.js.map +1 -1
- package/lib/models/documents/document.d.ts +2 -0
- package/lib/models/documents/document.js +10 -1
- package/lib/models/documents/document.js.map +1 -1
- package/lib/models/identifier.d.ts +2 -0
- package/lib/models/identifier.js +7 -1
- package/lib/models/identifier.js.map +1 -1
- package/lib/models/inbound-content-types.d.ts +2 -0
- package/lib/models/inbound-content-types.js +4 -1
- package/lib/models/inbound-content-types.js.map +1 -1
- package/lib/models/labels/document-formats.d.ts +2 -0
- package/lib/models/labels/document-formats.js +4 -1
- package/lib/models/labels/document-formats.js.map +1 -1
- package/lib/models/labels/form-download.d.ts +2 -0
- package/lib/models/labels/form-download.js +6 -1
- package/lib/models/labels/form-download.js.map +1 -1
- package/lib/models/labels/label-download.d.ts +2 -0
- package/lib/models/labels/label-download.js +6 -1
- package/lib/models/labels/label-download.js.map +1 -1
- package/lib/models/labels/label-package.d.ts +2 -0
- package/lib/models/labels/label-package.js +10 -1
- package/lib/models/labels/label-package.js.map +1 -1
- package/lib/models/labels/void-response.d.ts +3 -1
- package/lib/models/labels/void-response.js +10 -1
- package/lib/models/labels/void-response.js.map +1 -1
- package/lib/models/manifests/manifest.d.ts +2 -0
- package/lib/models/manifests/manifest.js +10 -1
- package/lib/models/manifests/manifest.js.map +1 -1
- package/lib/models/pickup/pickup-confirmation.d.ts +2 -0
- package/lib/models/pickup/pickup-confirmation.js +10 -1
- package/lib/models/pickup/pickup-confirmation.js.map +1 -1
- package/lib/models/pickup/pickup-window.d.ts +2 -0
- package/lib/models/pickup/pickup-window.js +9 -1
- package/lib/models/pickup/pickup-window.js.map +1 -1
- package/lib/models/pickup/shipment-identifier.d.ts +2 -0
- package/lib/models/pickup/shipment-identifier.js +8 -1
- package/lib/models/pickup/shipment-identifier.js.map +1 -1
- package/lib/models/rates/rate.d.ts +2 -0
- package/lib/models/rates/rate.js +18 -1
- package/lib/models/rates/rate.js.map +1 -1
- package/lib/models/registration/credentials.d.ts +2 -0
- package/lib/models/registration/credentials.js +7 -1
- package/lib/models/registration/credentials.js.map +1 -1
- package/lib/models/resource-download.d.ts +2 -0
- package/lib/models/resource-download.js +7 -1
- package/lib/models/resource-download.js.map +1 -1
- package/lib/models/time-window.d.ts +2 -0
- package/lib/models/time-window.js +8 -1
- package/lib/models/time-window.js.map +1 -1
- package/lib/models/tracking/lat-long.d.ts +2 -0
- package/lib/models/tracking/lat-long.js +7 -1
- package/lib/models/tracking/lat-long.js.map +1 -1
- package/lib/models/tracking/service.d.ts +2 -0
- package/lib/models/tracking/service.js +7 -1
- package/lib/models/tracking/service.js.map +1 -1
- package/lib/models/tracking/standardized-status-codes.d.ts +2 -0
- package/lib/models/tracking/standardized-status-codes.js +4 -1
- package/lib/models/tracking/standardized-status-codes.js.map +1 -1
- package/lib/models/tracking/track-event.d.ts +2 -0
- package/lib/models/tracking/track-event.js +18 -1
- package/lib/models/tracking/track-event.js.map +1 -1
- package/lib/models/tracking/tracking-info.d.ts +2 -0
- package/lib/models/tracking/tracking-info.js +27 -1
- package/lib/models/tracking/tracking-info.js.map +1 -1
- package/lib/models/tracking/update-method.d.ts +2 -0
- package/lib/models/tracking/update-method.js +4 -1
- package/lib/models/tracking/update-method.js.map +1 -1
- package/lib/models/units/dimensions.d.ts +2 -0
- package/lib/models/units/dimensions.js +8 -1
- package/lib/models/units/dimensions.js.map +1 -1
- package/lib/responses/base-response.d.ts +2 -0
- package/lib/responses/base-response.js +6 -1
- package/lib/responses/base-response.js.map +1 -1
- package/lib/responses/cancel-notification-response.d.ts +2 -0
- package/lib/responses/cancel-notification-response.js +7 -1
- package/lib/responses/cancel-notification-response.js.map +1 -1
- package/lib/responses/cancel-pickup-response.d.ts +2 -0
- package/lib/responses/cancel-pickup-response.js +9 -1
- package/lib/responses/cancel-pickup-response.js.map +1 -1
- package/lib/responses/create-label-response.d.ts +2 -0
- package/lib/responses/create-label-response.js +19 -1
- package/lib/responses/create-label-response.js.map +1 -1
- package/lib/responses/create-manifest-response.d.ts +2 -0
- package/lib/responses/create-manifest-response.js +8 -1
- package/lib/responses/create-manifest-response.js.map +1 -1
- package/lib/responses/create-notification-response.d.ts +2 -0
- package/lib/responses/create-notification-response.js +6 -1
- package/lib/responses/create-notification-response.js.map +1 -1
- package/lib/responses/get-rates-response.d.ts +2 -0
- package/lib/responses/get-rates-response.js +7 -1
- package/lib/responses/get-rates-response.js.map +1 -1
- package/lib/responses/normalize-tracking-data-response.d.ts +3 -1
- package/lib/responses/normalize-tracking-data-response.js +13 -0
- package/lib/responses/normalize-tracking-data-response.js.map +1 -1
- package/lib/responses/register-response.d.ts +2 -0
- package/lib/responses/register-response.js +8 -1
- package/lib/responses/register-response.js.map +1 -1
- package/lib/responses/schedule-pickup-response.d.ts +2 -0
- package/lib/responses/schedule-pickup-response.js +11 -1
- package/lib/responses/schedule-pickup-response.js.map +1 -1
- package/lib/responses/tracking-response.d.ts +1 -0
- package/lib/responses/tracking-response.js +5 -1
- package/lib/responses/tracking-response.js.map +1 -1
- package/lib/responses/validate-inbound-data-response.d.ts +3 -1
- package/lib/responses/validate-inbound-data-response.js +12 -0
- package/lib/responses/validate-inbound-data-response.js.map +1 -1
- package/lib/responses/void-labels-response.d.ts +2 -0
- package/lib/responses/void-labels-response.js +7 -1
- package/lib/responses/void-labels-response.js.map +1 -1
- package/package.json +1 -1
- package/src/app/carrier-app-definition.ts +1 -1
- package/src/app/carrier-app.ts +126 -66
- package/src/app/constants.ts +14 -0
- package/src/app/internal/{carrier-app-specificaion.ts → carrier-app-specification.ts} +4 -1
- package/src/app/internal/{carrier-specificaion.ts → carrier-specification.ts} +0 -0
- package/src/app/internal/metadata.ts +8 -2
- package/src/app/internal/route.ts +1 -0
- package/src/app/metadata/auth-identifier.ts +17 -0
- package/src/app/metadata/auth-specification.ts +39 -0
- package/src/app/metadata/carrier-app-metadata.ts +9 -1
- package/src/app/metadata/index.ts +4 -1
- package/src/app/metadata/monoauth.ts +171 -0
- package/src/models/addresses/address-base.ts +2 -0
- package/src/models/billing/billing-categories.ts +6 -0
- package/src/models/billing/billing-line-item.ts +14 -2
- package/src/models/currency.ts +7 -0
- package/src/models/documents/document-type.ts +6 -0
- package/src/models/documents/document.ts +11 -2
- package/src/models/identifier.ts +7 -0
- package/src/models/inbound-content-types.ts +5 -0
- package/src/models/labels/document-formats.ts +5 -0
- package/src/models/labels/form-download.ts +6 -1
- package/src/models/labels/label-download.ts +6 -1
- package/src/models/labels/label-package.ts +9 -2
- package/src/models/labels/void-response.ts +9 -2
- package/src/models/manifests/manifest.ts +9 -1
- package/src/models/pickup/pickup-confirmation.ts +11 -2
- package/src/models/pickup/pickup-window.ts +8 -0
- package/src/models/pickup/shipment-identifier.ts +7 -1
- package/src/models/rates/rate.ts +20 -2
- package/src/models/registration/credentials.ts +7 -0
- package/src/models/resource-download.ts +7 -0
- package/src/models/time-window.ts +8 -0
- package/src/models/tracking/lat-long.ts +7 -0
- package/src/models/tracking/service.ts +6 -0
- package/src/models/tracking/standardized-status-codes.ts +6 -0
- package/src/models/tracking/track-event.ts +16 -0
- package/src/models/tracking/tracking-info.ts +29 -4
- package/src/models/tracking/update-method.ts +6 -0
- package/src/models/units/dimensions.ts +7 -0
- package/src/responses/base-response.ts +6 -0
- package/src/responses/cancel-notification-response.ts +7 -1
- package/src/responses/cancel-pickup-response.ts +9 -1
- package/src/responses/create-label-response.ts +25 -1
- package/src/responses/create-manifest-response.ts +8 -2
- package/src/responses/create-notification-response.ts +6 -1
- package/src/responses/get-rates-response.ts +7 -2
- package/src/responses/normalize-tracking-data-response.ts +16 -5
- package/src/responses/register-response.ts +6 -1
- package/src/responses/schedule-pickup-response.ts +18 -2
- package/src/responses/tracking-response.ts +6 -2
- package/src/responses/validate-inbound-data-response.ts +12 -4
- package/src/responses/void-labels-response.ts +7 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/app/internal/carrier-app-specificaion.js.map +0 -1
- package/lib/app/internal/carrier-specificaion.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { AuthSpecification } from '../metadata/auth-specification';
|
|
1
2
|
import { ShippingProviderConnector } from '../metadata/shipping-provider-connector';
|
|
2
|
-
import { CarrierSpecification } from './carrier-
|
|
3
|
+
import { CarrierSpecification } from './carrier-specification';
|
|
3
4
|
|
|
4
5
|
/** @description This represents a single integration which may contain multiple carrier sources */
|
|
5
6
|
export interface CarrierAppSpecification {
|
|
@@ -9,6 +10,8 @@ export interface CarrierAppSpecification {
|
|
|
9
10
|
Name: string;
|
|
10
11
|
/** @description Information about the connector */
|
|
11
12
|
Connector: ShippingProviderConnector;
|
|
13
|
+
/** @description The specification for authorizing with this carrier */
|
|
14
|
+
AuthProcess?: AuthSpecification;
|
|
12
15
|
/** @description A list of carrier sources associated with this integration */
|
|
13
16
|
Carriers: CarrierSpecification[];
|
|
14
17
|
}
|
|
File without changes
|
|
@@ -2,8 +2,9 @@ import { CarrierAppDefinition } from '../carrier-app-definition';
|
|
|
2
2
|
import { ShippingProviderConnector } from '../metadata/shipping-provider-connector';
|
|
3
3
|
import { FunctionSpecification } from '../metadata/function';
|
|
4
4
|
|
|
5
|
-
import { CarrierAppSpecification } from './carrier-app-
|
|
6
|
-
import { CarrierSpecification } from './carrier-
|
|
5
|
+
import { CarrierAppSpecification } from './carrier-app-specification';
|
|
6
|
+
import { CarrierSpecification } from './carrier-specification';
|
|
7
|
+
import { AuthSpecification } from '../metadata/auth-specification';
|
|
7
8
|
|
|
8
9
|
const fn = (name: string): FunctionSpecification => ({
|
|
9
10
|
Name: name,
|
|
@@ -52,11 +53,16 @@ export class Metadata implements CarrierAppSpecification {
|
|
|
52
53
|
Id: string;
|
|
53
54
|
Name: string;
|
|
54
55
|
Connector: ShippingProviderConnector;
|
|
56
|
+
AuthProcess?: AuthSpecification;
|
|
55
57
|
Carriers: CarrierSpecification[];
|
|
56
58
|
|
|
57
59
|
constructor(app: CarrierAppDefinition) {
|
|
58
60
|
this.Id = app.Metadata.Id;
|
|
59
61
|
this.Name = app.Metadata.Name;
|
|
62
|
+
this.AuthProcess = app.Metadata.AuthProcess;
|
|
63
|
+
if (this.AuthProcess) {
|
|
64
|
+
this.AuthProcess.Identifier.Version = '2.0';
|
|
65
|
+
}
|
|
60
66
|
this.Carriers = app.Metadata.Carriers.map(
|
|
61
67
|
(c) => new CarrierSpecification(c),
|
|
62
68
|
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
3
|
+
export enum AuthenticationType {
|
|
4
|
+
OAuth = 'oauth',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export class AuthIdentifier {
|
|
8
|
+
AuthenticationType!: AuthenticationType;
|
|
9
|
+
Version?: string;
|
|
10
|
+
IsSandbox?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const AuthIdentifierSchema = Joi.object({
|
|
14
|
+
AuthenticationType: Joi.string().required().valid('oauth'),
|
|
15
|
+
Version: Joi.string().optional(),
|
|
16
|
+
IsSandbox: Joi.bool().optional(),
|
|
17
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AuthIdentifier, AuthIdentifierSchema } from './auth-identifier';
|
|
2
|
+
import {
|
|
3
|
+
AccessToken,
|
|
4
|
+
AccessTokenSchema,
|
|
5
|
+
AuthorizationConfiguration,
|
|
6
|
+
AuthorizationConfigurationSchema,
|
|
7
|
+
Parameter,
|
|
8
|
+
ParameterSchema,
|
|
9
|
+
RefreshTokenConfiguration,
|
|
10
|
+
RefreshTokenConfigurationSchema,
|
|
11
|
+
RequestTokenConfiguration,
|
|
12
|
+
RequestTokenConfigurationSchema,
|
|
13
|
+
} from './monoauth';
|
|
14
|
+
import Joi from 'joi';
|
|
15
|
+
|
|
16
|
+
/** @description Used to specify information about an integrations authentication */
|
|
17
|
+
export class AuthSpecification {
|
|
18
|
+
/** @description Identify the type of Auth being used by the integration */
|
|
19
|
+
Identifier!: AuthIdentifier;
|
|
20
|
+
/** @description Added to allow oauth 1.0 to work. */
|
|
21
|
+
access_token?: AccessToken;
|
|
22
|
+
/** @description Authorization: the beginning of an OAuth2.0 flow that ensures the user is logged in and approves access to the Resource. */
|
|
23
|
+
authorization?: AuthorizationConfiguration;
|
|
24
|
+
/** @description Request Token: server-server code for token exchange */
|
|
25
|
+
request_token?: RequestTokenConfiguration;
|
|
26
|
+
/** @description Refresh Token: server-server refresh token exchange for access token **NOTE: sometimes a new RT is also created** */
|
|
27
|
+
refresh_token?: RefreshTokenConfiguration;
|
|
28
|
+
/** @description Advanced configurations used for oauth 1.0 */
|
|
29
|
+
advanced_configuration?: Parameter[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const AuthSpecificationSchema = Joi.object({
|
|
33
|
+
Identifier: AuthIdentifierSchema,
|
|
34
|
+
access_token: AccessTokenSchema.optional(),
|
|
35
|
+
authorization: AuthorizationConfigurationSchema.optional(),
|
|
36
|
+
request_token: RequestTokenConfigurationSchema.optional(),
|
|
37
|
+
refresh_token: RefreshTokenConfigurationSchema.optional(),
|
|
38
|
+
advanced_configuration: Joi.array().optional().items(ParameterSchema),
|
|
39
|
+
});
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import Joi from 'joi';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AuthSpecification,
|
|
4
|
+
AuthSpecificationSchema,
|
|
5
|
+
Carrier,
|
|
6
|
+
CarrierSchema,
|
|
7
|
+
} from '.';
|
|
3
8
|
|
|
4
9
|
export interface CarrierAppMetadata {
|
|
5
10
|
/** @description Id of the carrier app */
|
|
6
11
|
Id: string;
|
|
7
12
|
/** @description Name of the carrier */
|
|
8
13
|
Name: string;
|
|
14
|
+
/** @description The specification for authorizing with this order source */
|
|
15
|
+
AuthProcess?: AuthSpecification;
|
|
9
16
|
/** @description List of carriers for the app */
|
|
10
17
|
Carriers: Carrier[];
|
|
11
18
|
}
|
|
@@ -15,6 +22,7 @@ export const CarrierAppMetadataSchema = Joi.object({
|
|
|
15
22
|
.uuid({ version: ['uuidv4'] })
|
|
16
23
|
.required(),
|
|
17
24
|
Name: Joi.string().required(),
|
|
25
|
+
AuthProcess: AuthSpecificationSchema.optional(),
|
|
18
26
|
Carriers: Joi.array()
|
|
19
27
|
.unique('Id')
|
|
20
28
|
.required()
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './account-modals';
|
|
2
|
+
export * from './auth-identifier';
|
|
3
|
+
export * from './auth-specification';
|
|
4
|
+
export * from './carrier';
|
|
2
5
|
export * from './carrier-app-metadata';
|
|
3
6
|
export * from './carrier-attributes';
|
|
4
|
-
export * from './carrier';
|
|
5
7
|
export * from './confirmation-type';
|
|
6
8
|
export * from './country-association';
|
|
7
9
|
export * from './diagnostic-routes';
|
|
@@ -9,6 +11,7 @@ export * from './enums';
|
|
|
9
11
|
export * from './function';
|
|
10
12
|
export * from './label-formats';
|
|
11
13
|
export * from './label-sizes';
|
|
14
|
+
export * from './monoauth';
|
|
12
15
|
export * from './package-type';
|
|
13
16
|
export * from './service-class';
|
|
14
17
|
export * from './service-grade';
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
3
|
+
export class Parameter {
|
|
4
|
+
/** @description The name of the parameter */
|
|
5
|
+
name!: string;
|
|
6
|
+
/** @description The value associated with the parameter */
|
|
7
|
+
value!: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const MethodSchema = Joi.string().valid(
|
|
11
|
+
'GET',
|
|
12
|
+
'POST',
|
|
13
|
+
'DELETE',
|
|
14
|
+
'PUT',
|
|
15
|
+
'get',
|
|
16
|
+
'post',
|
|
17
|
+
'delete',
|
|
18
|
+
'put',
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export const ParameterSchema = Joi.object({
|
|
22
|
+
name: Joi.string().required(),
|
|
23
|
+
value: Joi.string().required(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export class DateTimeConfiguration {
|
|
27
|
+
/** @description JSONPath to the JSON element containing the date-time */
|
|
28
|
+
path!: string;
|
|
29
|
+
/** @description DateTime format string compliant with
|
|
30
|
+
* https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings */
|
|
31
|
+
date_time_format!: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const DateTimeConfigurationSchema = Joi.object({
|
|
35
|
+
path: Joi.string().required(),
|
|
36
|
+
date_time_format: Joi.string().required(),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export type MapOfStrings = {
|
|
40
|
+
[key: string]: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** @description Optional configuration to take full control of parsing and extracting fields
|
|
44
|
+
* from the integration's JSON response body.
|
|
45
|
+
* Note for JSONPath: strings not starting with $ are interpreted as string literals
|
|
46
|
+
*/
|
|
47
|
+
export class ResponseTransformationConfiguration {
|
|
48
|
+
/** @description JSONPath to the JSON element for access_token. */
|
|
49
|
+
access_token!: string;
|
|
50
|
+
/** @description JSONPath to the JSON element for token_type */
|
|
51
|
+
token_type!: string;
|
|
52
|
+
/** @description JSONPath to the JSON element for refresh_token */
|
|
53
|
+
refresh_token?: string;
|
|
54
|
+
/** @description JSONPath to the JSON element for expires_in. Mutually exclusive with expires_at */
|
|
55
|
+
expires_in?: string;
|
|
56
|
+
/** @description Configuration for parsing a date-time, when the integration is lacking expires_in.
|
|
57
|
+
* Mutually exclusive with expires_in.
|
|
58
|
+
*/
|
|
59
|
+
expires_at?: DateTimeConfiguration;
|
|
60
|
+
/** @description Optional collection of properties to include in the connection_context sent back with the auth flow result.
|
|
61
|
+
* Property value may be JSONPath or a string literal.
|
|
62
|
+
* E.g.
|
|
63
|
+
* "connection_context": {
|
|
64
|
+
* "account_number": "$.data.account_number"
|
|
65
|
+
* }
|
|
66
|
+
*/
|
|
67
|
+
connection_context?: MapOfStrings;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const MapOfStringsSchema = Joi.object().pattern(
|
|
71
|
+
Joi.string(),
|
|
72
|
+
Joi.string(),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
export const ResponseTransformationConfigurationSchema = Joi.object({
|
|
76
|
+
access_token: Joi.string().required(),
|
|
77
|
+
token_type: Joi.string().required(),
|
|
78
|
+
refresh_token: Joi.string().optional(),
|
|
79
|
+
expires_in: Joi.string().optional(),
|
|
80
|
+
expires_at: DateTimeConfigurationSchema.optional(),
|
|
81
|
+
connection_context: MapOfStringsSchema.optional(),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export class AccessToken {
|
|
85
|
+
/** @description OAuth1 only. The url to obtain the temporary Access (aka Request) Token to start a flow **/
|
|
86
|
+
url_template!: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const AccessTokenSchema = Joi.object({
|
|
90
|
+
url_template: Joi.string().required(),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export class RequestTokenConfiguration {
|
|
94
|
+
/** @description The url to obtain the access token using the authorization code on the backend @example "http://{auth_state:store_name}.store.com/admin/oauth/request", "http://store.com/oauth/request" */
|
|
95
|
+
url_template!: string;
|
|
96
|
+
/** @description A list of query parameters that will be attached to the url */
|
|
97
|
+
query_parameters?: Parameter[];
|
|
98
|
+
/** @description Method to use when making the server-server code for token request @example "GET", "POST" */
|
|
99
|
+
method?: string;
|
|
100
|
+
/** @description List of parameters that are sent to the integration when exchanging the code for the token. These are built using ContentType */
|
|
101
|
+
body?: Parameter[];
|
|
102
|
+
/** @description List of headers that are sent to the integration when requesting a token */
|
|
103
|
+
headers?: Parameter[];
|
|
104
|
+
/** @description Response payload parsing */
|
|
105
|
+
response?: ResponseTransformationConfiguration;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const RequestTokenConfigurationSchema = Joi.object({
|
|
109
|
+
url_template: Joi.string().required(),
|
|
110
|
+
query_parameters: Joi.array().optional().items(ParameterSchema),
|
|
111
|
+
method: MethodSchema.optional(),
|
|
112
|
+
body: Joi.array().optional().items(ParameterSchema),
|
|
113
|
+
headers: Joi.array().optional().items(ParameterSchema),
|
|
114
|
+
response: ResponseTransformationConfigurationSchema.optional(),
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export class RefreshTokenConfiguration {
|
|
118
|
+
/** @description The url to refresh the access token using the authorization code on the backend @example "http://{auth_state:store_name}.store.com/admin/oauth/refresh", "http://store.com/oauth/refresh" */
|
|
119
|
+
url_template!: string;
|
|
120
|
+
/** @description A list of query parameters that will be attached to the url */
|
|
121
|
+
query_parameters?: Parameter[];
|
|
122
|
+
/** @description Method to use when making the server-server code for token request @example "GET", "POST" */
|
|
123
|
+
method?: string;
|
|
124
|
+
/** @description List of parameters that are sent to the integration during the server-server refresh token request. These are built using the content type specified in the headers array. */
|
|
125
|
+
body?: Parameter[];
|
|
126
|
+
/** @description List of headers that are sent to the integration when refreshing a token */
|
|
127
|
+
headers?: Parameter[];
|
|
128
|
+
/** @description Response payload parsing */
|
|
129
|
+
response?: ResponseTransformationConfiguration;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const RefreshTokenConfigurationSchema = Joi.object({
|
|
133
|
+
url_template: Joi.string().required(),
|
|
134
|
+
query_parameters: Joi.array().optional().items(ParameterSchema),
|
|
135
|
+
method: MethodSchema.optional(),
|
|
136
|
+
body: Joi.array().optional().items(ParameterSchema),
|
|
137
|
+
headers: Joi.array().optional().items(ParameterSchema),
|
|
138
|
+
response: ResponseTransformationConfigurationSchema.optional(),
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
export class NonceConfiguration {
|
|
142
|
+
name!: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const NonceConfigurationSchema = Joi.object({
|
|
146
|
+
name: Joi.string().required(),
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export class AuthorizationConfiguration {
|
|
150
|
+
/** @description The url to obtain the access token using the authorization code on the backend @example "http://{auth_state:store_name}.store.com/admin/oauth/authorize", "http://store.com/oauth/authorize" */
|
|
151
|
+
url_template!: string;
|
|
152
|
+
/** @description A list of query parameters that will be attached to the url */
|
|
153
|
+
query_parameters?: Parameter[];
|
|
154
|
+
/** @description Method to use when making the server-server code for token request @example "GET", "POST" */
|
|
155
|
+
method?: string;
|
|
156
|
+
/** @description List of parameters that are sent to the integration during the server-server authorization request. These are built using the content type specified in the headers array. */
|
|
157
|
+
body?: Parameter[];
|
|
158
|
+
/** @description List of headers that are sent to the integration when authorizing a token */
|
|
159
|
+
headers?: Parameter[];
|
|
160
|
+
/** @description A nonce query parameter included on the accept request, then returned and validated on the redirect request */
|
|
161
|
+
nonce?: NonceConfiguration;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export const AuthorizationConfigurationSchema = Joi.object({
|
|
165
|
+
url_template: Joi.string().required(),
|
|
166
|
+
query_parameters: Joi.array().optional().items(ParameterSchema),
|
|
167
|
+
method: MethodSchema.optional(),
|
|
168
|
+
body: Joi.array().optional().items(ParameterSchema),
|
|
169
|
+
headers: Joi.array().optional().items(ParameterSchema),
|
|
170
|
+
nonce: NonceConfigurationSchema.optional(),
|
|
171
|
+
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Category for a billing line item */
|
|
2
4
|
export enum BillingCategories {
|
|
3
5
|
Uncategorized = 'uncategorized',
|
|
@@ -23,3 +25,7 @@ export enum BillingCategories {
|
|
|
23
25
|
/** @description Amount to be paid to the driver, used for local delivery and courier services. */
|
|
24
26
|
Tip = 'tip',
|
|
25
27
|
}
|
|
28
|
+
|
|
29
|
+
export const BillingCategoriesSchema = Joi.string().valid(
|
|
30
|
+
...Object.values(BillingCategories),
|
|
31
|
+
);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
BillingCategories,
|
|
3
|
+
BillingCategoriesSchema,
|
|
4
|
+
} from './billing-categories';
|
|
5
|
+
import { Currency, CurrencySchema } from '../currency';
|
|
6
|
+
import Joi from 'joi';
|
|
3
7
|
|
|
4
8
|
/** @description Basic structure of each charge or line item */
|
|
5
9
|
export class BillingLineItem {
|
|
@@ -9,3 +13,11 @@ export class BillingLineItem {
|
|
|
9
13
|
memo?: string;
|
|
10
14
|
amount!: Currency;
|
|
11
15
|
}
|
|
16
|
+
|
|
17
|
+
export const BillingLineItemSchema = Joi.object({
|
|
18
|
+
billing_category: BillingCategoriesSchema.required(),
|
|
19
|
+
carrier_description: Joi.string().optional().empty(),
|
|
20
|
+
carrier_billing_code: Joi.string().optional().empty(),
|
|
21
|
+
memo: Joi.string().optional().empty(),
|
|
22
|
+
amount: CurrencySchema.required(),
|
|
23
|
+
});
|
package/src/models/currency.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Basic structure for defining an amount of money and its currency */
|
|
2
4
|
export class Currency {
|
|
3
5
|
currency!: string;
|
|
4
6
|
amount!: string;
|
|
5
7
|
}
|
|
8
|
+
|
|
9
|
+
export const CurrencySchema = Joi.object({
|
|
10
|
+
currency: Joi.string().required(),
|
|
11
|
+
amount: Joi.string().required(),
|
|
12
|
+
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Types of documents */
|
|
2
4
|
export enum DocumentType {
|
|
3
5
|
Label = 'label',
|
|
@@ -5,3 +7,7 @@ export enum DocumentType {
|
|
|
5
7
|
CommercialInvoice = 'commercial_invoice',
|
|
6
8
|
BillOfLading = 'bill_of_lading',
|
|
7
9
|
}
|
|
10
|
+
|
|
11
|
+
export const DocumentTypeSchema = Joi.string().valid(
|
|
12
|
+
...Object.values(DocumentType),
|
|
13
|
+
);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { DocumentType } from './document-type';
|
|
2
|
-
import {
|
|
1
|
+
import { DocumentType, DocumentTypeSchema } from './document-type';
|
|
2
|
+
import {
|
|
3
|
+
DocumentFormat,
|
|
4
|
+
DocumentFormatSchema,
|
|
5
|
+
} from '../labels/document-formats';
|
|
6
|
+
import Joi from 'joi';
|
|
3
7
|
|
|
4
8
|
/** @description Basic structure for a document */
|
|
5
9
|
export class Document {
|
|
@@ -7,3 +11,8 @@ export class Document {
|
|
|
7
11
|
data!: string;
|
|
8
12
|
format!: DocumentFormat;
|
|
9
13
|
}
|
|
14
|
+
export const DocumentSchema = Joi.object({
|
|
15
|
+
type: Joi.array().required().min(1).items(DocumentTypeSchema),
|
|
16
|
+
data: Joi.string().required(),
|
|
17
|
+
format: DocumentFormatSchema.required(),
|
|
18
|
+
});
|
package/src/models/identifier.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Key value pair to allow custom properties */
|
|
2
4
|
export class Identifier {
|
|
3
5
|
type!: string;
|
|
4
6
|
value!: string;
|
|
5
7
|
}
|
|
8
|
+
|
|
9
|
+
export const IdentifierSchema = Joi.object({
|
|
10
|
+
type: Joi.string().required(),
|
|
11
|
+
value: Joi.string().required(),
|
|
12
|
+
});
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Types of inbound content */
|
|
2
4
|
export enum InboundDataContentTypes {
|
|
3
5
|
/** @description Tracking information */
|
|
4
6
|
Tracking = 'tracking',
|
|
5
7
|
}
|
|
8
|
+
export const InboundDataContentTypesSchema = Joi.string().valid(
|
|
9
|
+
...Object.values(InboundDataContentTypes),
|
|
10
|
+
);
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { ResourceDownload, ResourceDownloadSchema } from '../resource-download';
|
|
2
3
|
|
|
3
4
|
export class FormDownload extends ResourceDownload {
|
|
4
5
|
form_data?: string;
|
|
5
6
|
}
|
|
7
|
+
|
|
8
|
+
export const FormDownloadSchema = ResourceDownloadSchema.keys({
|
|
9
|
+
form_data: Joi.string().optional().empty(),
|
|
10
|
+
});
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { ResourceDownload, ResourceDownloadSchema } from '../resource-download';
|
|
2
3
|
|
|
3
4
|
export class LabelDownload extends ResourceDownload {
|
|
4
5
|
label_data?: string;
|
|
5
6
|
}
|
|
7
|
+
|
|
8
|
+
export const LabelDownloadSchema = ResourceDownloadSchema.keys({
|
|
9
|
+
label_data: Joi.string().optional().empty(),
|
|
10
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Identifier } from '../identifier';
|
|
2
|
-
import { Document } from '../documents';
|
|
1
|
+
import { Identifier, IdentifierSchema } from '../identifier';
|
|
2
|
+
import { Document, DocumentSchema } from '../documents';
|
|
3
|
+
import Joi from 'joi';
|
|
3
4
|
|
|
4
5
|
/** @description Package information provided by the carrier */
|
|
5
6
|
export class LabelPackage {
|
|
@@ -8,3 +9,9 @@ export class LabelPackage {
|
|
|
8
9
|
alternative_identifiers?: Identifier[];
|
|
9
10
|
documents?: Document[];
|
|
10
11
|
}
|
|
12
|
+
|
|
13
|
+
export const LabelPackageSchema = Joi.object({
|
|
14
|
+
tracking_number: Joi.string().optional().empty(),
|
|
15
|
+
alternative_identifiers: Joi.array().optional().items(IdentifierSchema),
|
|
16
|
+
documents: Joi.array().optional().items(DocumentSchema),
|
|
17
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { BillingLineItem, BillingLineItemSchema } from '../billing';
|
|
3
3
|
/** @description Basic structure for a response to void a label */
|
|
4
4
|
export class VoidResponse {
|
|
5
5
|
/** @description Id for the void response */
|
|
@@ -11,3 +11,10 @@ export class VoidResponse {
|
|
|
11
11
|
/** @description Individual Billing Line items which remain after voiding the label, e.g. a cancellation fee. */
|
|
12
12
|
billing_line_items?: BillingLineItem[];
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
export const VoidResponseSchema = Joi.object({
|
|
16
|
+
void_request_id: Joi.string().required(),
|
|
17
|
+
message: Joi.string().optional().empty(),
|
|
18
|
+
errors: Joi.array().optional().items(Joi.string()),
|
|
19
|
+
billing_line_items: Joi.array().optional().items(BillingLineItemSchema),
|
|
20
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { ResourceDownload, ResourceDownloadSchema } from '../resource-download';
|
|
2
3
|
|
|
3
4
|
/** @description Basic structure of a manifest */
|
|
4
5
|
export class Manifest {
|
|
@@ -7,3 +8,10 @@ export class Manifest {
|
|
|
7
8
|
document_href?: string;
|
|
8
9
|
document_data?: string;
|
|
9
10
|
}
|
|
11
|
+
|
|
12
|
+
export const ManifestSchema = Joi.object({
|
|
13
|
+
manifest_id: Joi.string().optional().empty(),
|
|
14
|
+
document_download: ResourceDownloadSchema.optional(),
|
|
15
|
+
document_href: Joi.string().optional().empty(),
|
|
16
|
+
document_data: Joi.string().optional().empty(),
|
|
17
|
+
});
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { Identifier, IdentifierSchema } from '../identifier';
|
|
3
|
+
import {
|
|
4
|
+
ShipmentIdentifier,
|
|
5
|
+
ShipmentIdentifierSchema,
|
|
6
|
+
} from './shipment-identifier';
|
|
3
7
|
|
|
4
8
|
/** @description Basic structure for a pickup confirmation */
|
|
5
9
|
export class PickupConfirmation {
|
|
@@ -7,3 +11,8 @@ export class PickupConfirmation {
|
|
|
7
11
|
alternate_identifiers?: Identifier[];
|
|
8
12
|
shipment_identifiers?: ShipmentIdentifier[];
|
|
9
13
|
}
|
|
14
|
+
export const PickupConfirmationSchema = Joi.object({
|
|
15
|
+
confirmation_id: Joi.string().optional().empty(),
|
|
16
|
+
alternate_identifiers: Joi.array().optional().items(IdentifierSchema),
|
|
17
|
+
shipment_identifiers: Joi.array().optional().items(ShipmentIdentifierSchema),
|
|
18
|
+
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Time window for pickup */
|
|
2
4
|
export class PickupWindow {
|
|
3
5
|
time_zone_iana!: string;
|
|
@@ -5,3 +7,9 @@ export class PickupWindow {
|
|
|
5
7
|
start_time?: string;
|
|
6
8
|
end_time?: string;
|
|
7
9
|
}
|
|
10
|
+
export const PickupWindowSchema = Joi.object({
|
|
11
|
+
time_zone_iana: Joi.string().required(),
|
|
12
|
+
pickup_date: Joi.string().required().isoDate(),
|
|
13
|
+
start_time: Joi.string().optional().isoDate(),
|
|
14
|
+
end_time: Joi.string().optional().isoDate(),
|
|
15
|
+
});
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { Identifier, IdentifierSchema } from '../identifier';
|
|
2
3
|
|
|
3
4
|
/** @description Identifier object for shiments */
|
|
4
5
|
export class ShipmentIdentifier {
|
|
5
6
|
tracking_number?: string;
|
|
6
7
|
alternate_identifiers?: Identifier[];
|
|
7
8
|
}
|
|
9
|
+
|
|
10
|
+
export const ShipmentIdentifierSchema = Joi.object({
|
|
11
|
+
tracking_number: Joi.string().optional().empty(),
|
|
12
|
+
alternate_identifiers: Joi.array().optional().items(IdentifierSchema),
|
|
13
|
+
});
|
package/src/models/rates/rate.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import {
|
|
3
|
+
BillingLineItem,
|
|
4
|
+
BillingLineItemSchema,
|
|
5
|
+
} from '../billing/billing-line-item';
|
|
6
|
+
import { TimeWindow, TimeWindowSchema } from '../time-window';
|
|
3
7
|
|
|
4
8
|
/** @description Basic structure for a rate */
|
|
5
9
|
export class Rate {
|
|
@@ -28,3 +32,17 @@ export class Rate {
|
|
|
28
32
|
*/
|
|
29
33
|
expiration_datetime?: string;
|
|
30
34
|
}
|
|
35
|
+
|
|
36
|
+
export const RateSchema = Joi.object({
|
|
37
|
+
service_code: Joi.string().optional().empty(),
|
|
38
|
+
ship_datetime: Joi.string().optional().empty().isoDate(),
|
|
39
|
+
estimated_delivery_datetime: Joi.string().optional().empty().isoDate(),
|
|
40
|
+
billing_line_items: Joi.array().optional().items(BillingLineItemSchema),
|
|
41
|
+
error_messages: Joi.array().optional().items(Joi.string()),
|
|
42
|
+
warning_messages: Joi.array().optional().items(Joi.string()),
|
|
43
|
+
negotiated_rate: Joi.boolean().optional(),
|
|
44
|
+
carrier_pickup_window: TimeWindowSchema.optional(),
|
|
45
|
+
delivery_window: TimeWindowSchema.optional(),
|
|
46
|
+
carrier_rate_id: Joi.string().optional().empty(),
|
|
47
|
+
expiration_datetime: Joi.string().optional().empty().isoDate(),
|
|
48
|
+
});
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Basic structure for credentials */
|
|
2
4
|
export class Credentials {
|
|
3
5
|
username!: string;
|
|
4
6
|
password!: string;
|
|
5
7
|
}
|
|
8
|
+
|
|
9
|
+
export const CredentialsSchema = Joi.object({
|
|
10
|
+
username: Joi.string().required(),
|
|
11
|
+
password: Joi.string().required(),
|
|
12
|
+
});
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Basic structure for a resource to download */
|
|
2
4
|
export class ResourceDownload {
|
|
3
5
|
href?: string;
|
|
4
6
|
data?: string;
|
|
5
7
|
}
|
|
8
|
+
|
|
9
|
+
export const ResourceDownloadSchema = Joi.object({
|
|
10
|
+
href: Joi.string().optional().empty(),
|
|
11
|
+
data: Joi.string().optional().empty(),
|
|
12
|
+
});
|