@shipengine/connect-carrier-api 2.12.13 → 2.12.15
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/README.md +11 -3
- package/lib/app/build-native-rating-routes.js +3 -3
- package/lib/app/build-native-rating-routes.js.map +1 -1
- package/lib/app/carrier-app-definition.d.ts +7 -1
- package/lib/app/carrier-app.js +6 -0
- package/lib/app/carrier-app.js.map +1 -1
- package/lib/app/constants.d.ts +2 -1
- package/lib/app/constants.js +1 -0
- package/lib/app/constants.js.map +1 -1
- package/lib/app/internal/metadata.js +3 -0
- package/lib/app/internal/metadata.js.map +1 -1
- package/lib/app/internal/route.d.ts +1 -1
- package/lib/app/metadata/service-point-location-type.d.ts +6 -0
- package/lib/app/metadata/service-point-location-type.js +12 -0
- package/lib/app/metadata/service-point-location-type.js.map +1 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/models/service-points/service-point-schema.js +2 -0
- package/lib/models/service-points/service-point-schema.js.map +1 -1
- package/lib/models/service-points/service-point.d.ts +3 -0
- package/lib/models/service-points/service-point.js.map +1 -1
- package/lib/models/tracking/imported-tracking-event-schema.d.ts +2 -0
- package/lib/models/tracking/imported-tracking-event-schema.js +12 -0
- package/lib/models/tracking/imported-tracking-event-schema.js.map +1 -0
- package/lib/models/tracking/imported-tracking-event.d.ts +16 -0
- package/lib/models/tracking/imported-tracking-event.js +7 -0
- package/lib/models/tracking/imported-tracking-event.js.map +1 -0
- package/lib/models/tracking/index.d.ts +2 -0
- package/lib/models/tracking/index.js +2 -0
- package/lib/models/tracking/index.js.map +1 -1
- package/lib/requests/import-tracking-events-request.d.ts +3 -0
- package/lib/requests/import-tracking-events-request.js +8 -0
- package/lib/requests/import-tracking-events-request.js.map +1 -0
- package/lib/requests/index.d.ts +8 -7
- package/lib/requests/index.js +8 -7
- package/lib/requests/index.js.map +1 -1
- package/package.json +3 -3
- package/spec.json +114 -1
- package/src/app/carrier-app-definition.ts +9 -0
- package/src/app/carrier-app.ts +7 -0
- package/src/app/constants.ts +1 -0
- package/src/app/internal/metadata.ts +4 -0
- package/src/app/internal/route.ts +1 -1
- package/src/app/metadata/service-point-location-type.ts +10 -0
- package/src/index.ts +2 -2
- package/src/models/service-points/service-point-schema.ts +2 -0
- package/src/models/service-points/service-point.ts +3 -0
- package/src/models/tracking/imported-tracking-event-schema.ts +8 -0
- package/src/models/tracking/imported-tracking-event.ts +17 -0
- package/src/models/tracking/index.ts +2 -0
- package/src/requests/import-tracking-events-request.ts +3 -0
- package/src/requests/index.ts +8 -7
- package/tsconfig.json +0 -3
- package/tsconfig.tsbuildinfo +1 -1
package/spec.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "Shipping API",
|
|
5
5
|
"description": "This API specification describes the canonical ShipEngine Shipping API connector module.",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.17.1"
|
|
7
7
|
},
|
|
8
8
|
"paths": {
|
|
9
9
|
"/Register": {
|
|
@@ -570,6 +570,40 @@
|
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
+
},
|
|
574
|
+
"/ImportTrackingEvents": {
|
|
575
|
+
"post": {
|
|
576
|
+
"tags": [
|
|
577
|
+
"Tracking"
|
|
578
|
+
],
|
|
579
|
+
"description": "This method returns imported tracking events for a connection, and should only be implemented if you support\r\nimporting tracking data in bulk via file exchange or API requests.\r\n \r\nAny information needed to retrieve tracking data for a connection should be collected in your registration\r\nform and will be made available as metadata in the request.",
|
|
580
|
+
"operationId": "ImportTrackingEvents",
|
|
581
|
+
"requestBody": {
|
|
582
|
+
"description": "An object containing information about the connection to import tracking events for.",
|
|
583
|
+
"content": {
|
|
584
|
+
"application/json": {
|
|
585
|
+
"schema": {
|
|
586
|
+
"$ref": "#/components/schemas/ImportTrackingEventsRequest"
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
},
|
|
591
|
+
"responses": {
|
|
592
|
+
"200": {
|
|
593
|
+
"description": "A list of imported tracking events",
|
|
594
|
+
"content": {
|
|
595
|
+
"application/json": {
|
|
596
|
+
"schema": {
|
|
597
|
+
"type": "array",
|
|
598
|
+
"items": {
|
|
599
|
+
"$ref": "#/components/schemas/ImportedTrackingEvent"
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
573
607
|
}
|
|
574
608
|
},
|
|
575
609
|
"components": {
|
|
@@ -2224,6 +2258,35 @@
|
|
|
2224
2258
|
"additionalProperties": false,
|
|
2225
2259
|
"description": "A key value pair, allowing custom properties to be stored."
|
|
2226
2260
|
},
|
|
2261
|
+
"ImportedTrackingEvent": {
|
|
2262
|
+
"type": "object",
|
|
2263
|
+
"properties": {
|
|
2264
|
+
"tracking_info": {
|
|
2265
|
+
"$ref": "#/components/schemas/TrackingInfo"
|
|
2266
|
+
},
|
|
2267
|
+
"update_method": {
|
|
2268
|
+
"$ref": "#/components/schemas/UpdateMethods"
|
|
2269
|
+
},
|
|
2270
|
+
"error_messages": {
|
|
2271
|
+
"type": "array",
|
|
2272
|
+
"items": {
|
|
2273
|
+
"type": "string"
|
|
2274
|
+
},
|
|
2275
|
+
"description": "Any error messages resulting from processing the tracking event",
|
|
2276
|
+
"nullable": true
|
|
2277
|
+
},
|
|
2278
|
+
"warning_messages": {
|
|
2279
|
+
"type": "array",
|
|
2280
|
+
"items": {
|
|
2281
|
+
"type": "string"
|
|
2282
|
+
},
|
|
2283
|
+
"description": "Any warning messages resulting from processing the tracking event",
|
|
2284
|
+
"nullable": true
|
|
2285
|
+
}
|
|
2286
|
+
},
|
|
2287
|
+
"additionalProperties": false,
|
|
2288
|
+
"description": "This model represents an imported tracking event"
|
|
2289
|
+
},
|
|
2227
2290
|
"ImporterOfRecord": {
|
|
2228
2291
|
"type": "object",
|
|
2229
2292
|
"properties": {
|
|
@@ -2289,6 +2352,18 @@
|
|
|
2289
2352
|
"additionalProperties": false,
|
|
2290
2353
|
"description": "Basic structure for a Importer Record"
|
|
2291
2354
|
},
|
|
2355
|
+
"ImportTrackingEventsRequest": {
|
|
2356
|
+
"required": [
|
|
2357
|
+
"transaction_id"
|
|
2358
|
+
],
|
|
2359
|
+
"type": "object",
|
|
2360
|
+
"allOf": [
|
|
2361
|
+
{
|
|
2362
|
+
"$ref": "#/components/schemas/BaseRequest"
|
|
2363
|
+
}
|
|
2364
|
+
],
|
|
2365
|
+
"additionalProperties": false
|
|
2366
|
+
},
|
|
2292
2367
|
"InboundDataContentTypes": {
|
|
2293
2368
|
"enum": [
|
|
2294
2369
|
"tracking"
|
|
@@ -3192,6 +3267,9 @@
|
|
|
3192
3267
|
"$ref": "#/components/schemas/ServicePointFeature"
|
|
3193
3268
|
},
|
|
3194
3269
|
"nullable": true
|
|
3270
|
+
},
|
|
3271
|
+
"type": {
|
|
3272
|
+
"$ref": "#/components/schemas/ServicePointLocationType"
|
|
3195
3273
|
}
|
|
3196
3274
|
},
|
|
3197
3275
|
"additionalProperties": false
|
|
@@ -3224,6 +3302,13 @@
|
|
|
3224
3302
|
],
|
|
3225
3303
|
"type": "string"
|
|
3226
3304
|
},
|
|
3305
|
+
"ServicePointLocationType": {
|
|
3306
|
+
"enum": [
|
|
3307
|
+
"pudo",
|
|
3308
|
+
"locker"
|
|
3309
|
+
],
|
|
3310
|
+
"type": "string"
|
|
3311
|
+
},
|
|
3227
3312
|
"ServicePointResponseAddress": {
|
|
3228
3313
|
"required": [
|
|
3229
3314
|
"postal_code",
|
|
@@ -3338,6 +3423,31 @@
|
|
|
3338
3423
|
"type": "string",
|
|
3339
3424
|
"description": "The code associated with the package type",
|
|
3340
3425
|
"nullable": true
|
|
3426
|
+
},
|
|
3427
|
+
"label_messages": {
|
|
3428
|
+
"$ref": "#/components/schemas/LabelMessage"
|
|
3429
|
+
},
|
|
3430
|
+
"customs": {
|
|
3431
|
+
"$ref": "#/components/schemas/Customs"
|
|
3432
|
+
},
|
|
3433
|
+
"insured_value": {
|
|
3434
|
+
"required": [
|
|
3435
|
+
"currency",
|
|
3436
|
+
"amount"
|
|
3437
|
+
],
|
|
3438
|
+
"type": "object",
|
|
3439
|
+
"properties": {
|
|
3440
|
+
"amount": {
|
|
3441
|
+
"type": "string",
|
|
3442
|
+
"description": "Decimal currency value, as a string."
|
|
3443
|
+
},
|
|
3444
|
+
"currency": {
|
|
3445
|
+
"type": "string",
|
|
3446
|
+
"description": "Alpha-3 currency code complying with ISO 4217."
|
|
3447
|
+
}
|
|
3448
|
+
},
|
|
3449
|
+
"description": "The insured value of this package.",
|
|
3450
|
+
"nullable": true
|
|
3341
3451
|
}
|
|
3342
3452
|
},
|
|
3343
3453
|
"additionalProperties": false,
|
|
@@ -3377,6 +3487,9 @@
|
|
|
3377
3487
|
},
|
|
3378
3488
|
"advanced_options": {
|
|
3379
3489
|
"$ref": "#/components/schemas/AdvancedOptions"
|
|
3490
|
+
},
|
|
3491
|
+
"pickup_location": {
|
|
3492
|
+
"$ref": "#/components/schemas/PudoLocation"
|
|
3380
3493
|
}
|
|
3381
3494
|
},
|
|
3382
3495
|
"additionalProperties": false,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ImportedTrackingEvent } from '../models';
|
|
1
2
|
import {
|
|
2
3
|
RegisterRequest,
|
|
3
4
|
CreateLabelRequest,
|
|
@@ -15,6 +16,7 @@ import {
|
|
|
15
16
|
GetRelayPointsRequest,
|
|
16
17
|
GetServicePointsRequest,
|
|
17
18
|
GetServicePointRequest,
|
|
19
|
+
ImportTrackingEventsRequest,
|
|
18
20
|
} from '../requests';
|
|
19
21
|
|
|
20
22
|
import {
|
|
@@ -144,4 +146,11 @@ export interface CarrierAppDefinition {
|
|
|
144
146
|
GetServicePoint?: (
|
|
145
147
|
request: GetServicePointRequest,
|
|
146
148
|
) => GetServicePointResponse | Promise<GetServicePointResponse>;
|
|
149
|
+
/**
|
|
150
|
+
* @description This endpoint is used to import tracking events for a connection by id
|
|
151
|
+
* @param request Data needed by the provider to import tracking events
|
|
152
|
+
*/
|
|
153
|
+
ImportTrackingEvents?: (
|
|
154
|
+
request: ImportTrackingEventsRequest,
|
|
155
|
+
) => AsyncGenerator<ImportedTrackingEvent>;
|
|
147
156
|
}
|
package/src/app/carrier-app.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { OpenApiSpecification } from '../spec';
|
|
|
6
6
|
import { Metadata } from './internal/metadata';
|
|
7
7
|
import { CarrierSpecification } from './internal/carrier-specification';
|
|
8
8
|
import { CarrierAppMetadataSchema } from './metadata';
|
|
9
|
+
import { ImportedTrackingEventSchema } from '../models';
|
|
9
10
|
import {
|
|
10
11
|
RegisterResponseSchema,
|
|
11
12
|
CancelNotificationResponseSchema,
|
|
@@ -152,6 +153,12 @@ export class CarrierApp implements ConnectRuntimeApp {
|
|
|
152
153
|
definition.GetServicePoint,
|
|
153
154
|
GetServicePointResponseSchema,
|
|
154
155
|
],
|
|
156
|
+
[
|
|
157
|
+
Method.POST,
|
|
158
|
+
ApiEndpoints.ImportTrackingEvents,
|
|
159
|
+
definition.ImportTrackingEvents,
|
|
160
|
+
ImportedTrackingEventSchema,
|
|
161
|
+
],
|
|
155
162
|
).forEach(([method, path, implementation, schema]) => {
|
|
156
163
|
if (implementation) {
|
|
157
164
|
this.routes.push({
|
package/src/app/constants.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface FileRoute {
|
|
|
17
17
|
/** @description The definition for a route and how it will be handled */
|
|
18
18
|
export interface HandlerRoute {
|
|
19
19
|
/** @description The method that will be called to handle this request */
|
|
20
|
-
handler?: (req: any) => any | Promise<any>;
|
|
20
|
+
handler?: (req: any) => any | Promise<any> | AsyncGenerator<any>;
|
|
21
21
|
/** @description The optional method used to validate the response for this route. Used for warning purposes. */
|
|
22
22
|
validateResponse?: (response: any) => string[] | undefined;
|
|
23
23
|
}
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,8 @@ export * as models from './models';
|
|
|
2
2
|
export * as requests from './requests';
|
|
3
3
|
export * as responses from './responses';
|
|
4
4
|
|
|
5
|
-
export * from './requests';
|
|
6
|
-
export * from './responses';
|
|
7
5
|
export * from './app';
|
|
8
6
|
export * from './models';
|
|
7
|
+
export * from './requests';
|
|
8
|
+
export * from './responses';
|
|
9
9
|
export * from './spec';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Joi from 'joi';
|
|
2
2
|
import { ServicePointFeaturesEnumSchema } from '../../app/metadata/service-point-feature';
|
|
3
|
+
import { ServicePointLocationTypeEnumSchema } from '../../app/metadata/service-point-location-type';
|
|
3
4
|
import { ServicePointResponseAddressSchema } from './service-point-response-address-schema';
|
|
4
5
|
import { WeeklyHoursOfOperationSchema } from './weekly-hours-of-operation-schema';
|
|
5
6
|
|
|
@@ -8,4 +9,5 @@ export const ServicePointSchema = Joi.object({
|
|
|
8
9
|
address: ServicePointResponseAddressSchema.required(),
|
|
9
10
|
hours_of_operation: WeeklyHoursOfOperationSchema.required(),
|
|
10
11
|
features: Joi.array().items(ServicePointFeaturesEnumSchema).optional(),
|
|
12
|
+
type: ServicePointLocationTypeEnumSchema.optional(),
|
|
11
13
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ServicePointFeaturesEnum } from '../../app/metadata/service-point-feature';
|
|
2
|
+
import { ServicePointLocationTypeEnum } from '../../app/metadata/service-point-location-type';
|
|
2
3
|
import { ServicePointResponseAddress } from './service-point-response-address';
|
|
3
4
|
import { WeeklyHoursOfOperation } from './weekly-hours-of-operation';
|
|
4
5
|
|
|
@@ -12,4 +13,6 @@ export class ServicePoint {
|
|
|
12
13
|
hours_of_operation!: WeeklyHoursOfOperation;
|
|
13
14
|
/** @description Features supported by the service point */
|
|
14
15
|
features?: ServicePointFeaturesEnum[];
|
|
16
|
+
/** @description Location type like PUDOs, parcelshops, postoffices, lockers, retailers own stores etc. */
|
|
17
|
+
type?: ServicePointLocationTypeEnum;
|
|
15
18
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { TrackingInfoSchema } from './tracking-info-schema';
|
|
3
|
+
|
|
4
|
+
export const ImportedTrackingEventSchema = Joi.object({
|
|
5
|
+
tracking_info: TrackingInfoSchema.optional(),
|
|
6
|
+
error_messages: Joi.array().optional().items(Joi.string()),
|
|
7
|
+
warning_messages: Joi.array().optional().items(Joi.string()),
|
|
8
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TrackingInfo } from './tracking-info';
|
|
2
|
+
import { UpdateMethods } from './update-method';
|
|
3
|
+
|
|
4
|
+
export class ImportedTrackingEvent {
|
|
5
|
+
/** @description The tracking information for the shipment */
|
|
6
|
+
tracking_info?: TrackingInfo;
|
|
7
|
+
/**
|
|
8
|
+
* @description Optional method for updating the tracking information state, i.e. is the returned
|
|
9
|
+
* information the complete state of the package or should it be appended to the existing state.
|
|
10
|
+
* Defaults to `append` if not specified.
|
|
11
|
+
*/
|
|
12
|
+
update_method?: UpdateMethods;
|
|
13
|
+
/** @description Any error messages resulting from processing the tracking event */
|
|
14
|
+
error_messages?: string[];
|
|
15
|
+
/** @description Any warning messages resulting from processing the tracking event */
|
|
16
|
+
warning_messages?: string[];
|
|
17
|
+
}
|
package/src/requests/index.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
export * from './cancel-notification-request';
|
|
1
2
|
export * from './cancel-pickup-request';
|
|
2
3
|
export * from './create-label-request';
|
|
3
4
|
export * from './create-manifest-request';
|
|
5
|
+
export * from './create-notification-request';
|
|
4
6
|
export * from './get-manifest-request';
|
|
5
7
|
export * from './get-rates-request';
|
|
8
|
+
export * from './get-relay-points-request';
|
|
9
|
+
export * from './get-service-point-request';
|
|
10
|
+
export * from './get-service-points-request';
|
|
11
|
+
export * from './import-tracking-events-request';
|
|
12
|
+
export * from './normalize-tracking-data-request';
|
|
6
13
|
export * from './register-request';
|
|
7
14
|
export * from './schedule-pickup-request';
|
|
8
15
|
export * from './tracking-request';
|
|
9
|
-
export * from './void-labels-request';
|
|
10
|
-
export * from './create-notification-request';
|
|
11
|
-
export * from './cancel-notification-request';
|
|
12
16
|
export * from './validate-inbound-data-request';
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './get-relay-points-request';
|
|
15
|
-
export * from './get-service-points-request';
|
|
16
|
-
export * from './get-service-point-request';
|
|
17
|
+
export * from './void-labels-request';
|
package/tsconfig.json
CHANGED
|
@@ -3,14 +3,11 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"allowJs": true,
|
|
5
5
|
"declaration": true,
|
|
6
|
-
"esModuleInterop": true,
|
|
7
6
|
"importHelpers": true,
|
|
8
7
|
"module": "commonjs",
|
|
9
8
|
"outDir": "lib",
|
|
10
9
|
"rootDir": "src",
|
|
11
10
|
"sourceMap": true,
|
|
12
|
-
"strict": true,
|
|
13
|
-
"target": "es2017",
|
|
14
11
|
"composite": true
|
|
15
12
|
},
|
|
16
13
|
"include": ["src/**/*"],
|