@truetms/truetms-node 0.2.5 → 0.2.7

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.
@@ -0,0 +1,93 @@
1
+ query listTrips(
2
+ $search: String
3
+ $sort: TripSort
4
+ $skip: Int
5
+ $take: Int
6
+ $status: Status
7
+ $excludeCarrierAssigned: Boolean
8
+ $excludeDriverAssigned: Boolean
9
+ ) {
10
+ trips(
11
+ search: $search
12
+ sort: $sort
13
+ skip: $skip
14
+ take: $take
15
+ status: $status
16
+ excludeCarrierAssigned: $excludeCarrierAssigned
17
+ excludeDriverAssigned: $excludeDriverAssigned
18
+ ) {
19
+ count
20
+ data {
21
+ _id
22
+ tripNumber
23
+ status
24
+ shipments {
25
+ _id
26
+ shipmentNumber
27
+ referenceNumbers
28
+ isFromSplit
29
+ isFromRotation
30
+ parentShipment {
31
+ _id
32
+ }
33
+ }
34
+ shipmentLocations {
35
+ _id
36
+ name
37
+ addressLabel
38
+ addressTimezone
39
+ locationType
40
+ arrivalTime
41
+ waitingDuration
42
+ setupDuration
43
+ serviceDuration
44
+ shipper {
45
+ _id
46
+ name
47
+ address {
48
+ label
49
+ }
50
+ addressTimezone
51
+ }
52
+ receiver {
53
+ _id
54
+ name
55
+ address {
56
+ label
57
+ }
58
+ addressTimezone
59
+ }
60
+ timeWindows {
61
+ fromDate
62
+ toDate
63
+ }
64
+ }
65
+ trailer {
66
+ _id
67
+ type
68
+ serialNumber
69
+ }
70
+ tractor {
71
+ _id
72
+ serialNumber
73
+ }
74
+ driver {
75
+ _id
76
+ firstname
77
+ lastname
78
+ }
79
+ carrier {
80
+ _id
81
+ name
82
+ code
83
+ }
84
+ firstPickupTime
85
+ lastDropoffTime
86
+ tags
87
+ customFields {
88
+ key
89
+ value
90
+ }
91
+ }
92
+ }
93
+ }
@@ -3,9 +3,11 @@ import { getSdk } from "../graphql/generated";
3
3
 
4
4
  const client = new GraphQLClient(
5
5
  process.env.TRUETMS_STAGE === "LOCAL"
6
- ? "http://localhost:3001/graphql"
6
+ ? "http://127.0.0.1:3001/graphql"
7
7
  : process.env.TRUETMS_STAGE === "QA"
8
8
  ? "https://qa-lynks-api.tecafrik.com/graphql"
9
+ : process.env.TRUETMS_STAGE === "BETA"
10
+ ? "https://beta-api.truetms.com/graphql"
9
11
  : "https://api.truetms.com/graphql"
10
12
  );
11
13
 
package/src/sdk/auth.ts CHANGED
@@ -10,6 +10,8 @@ import { authenticateApiCall, TrueTMSOptions } from ".";
10
10
  const openIdConnectUrl =
11
11
  process.env.TRUETMS_STAGE === "QA" || process.env.TRUETMS_STAGE === "LOCAL"
12
12
  ? "https://qa-lynks-keycloak.tecafrik.com/auth/realms/truetms/protocol/openid-connect"
13
+ : process.env.TRUETMS_STAGE === "BETA"
14
+ ? "https://beta-auth.truetms.com/auth/realms/truetms/protocol/openid-connect"
13
15
  : "https://auth.truetms.com/auth/realms/truetms/protocol/openid-connect";
14
16
 
15
17
  export const trueTmsOpenIdClient = create({
package/src/sdk/index.ts CHANGED
@@ -5,6 +5,7 @@ import TrueTMSDriverSettlementsSdk from "./driverSettlements";
5
5
  import TrueTMSInvoicesSdk from "./invoices";
6
6
  import TrueTMSTractorsSdk from "./tractors";
7
7
  import TrueTMSTransactionsSdk from "./transactions";
8
+ import TrueTMSTripsSdk from "./trips";
8
9
  import TrueTMSUsersSdk from "./users";
9
10
 
10
11
  export type TrueTMSOptions = {
@@ -23,6 +24,7 @@ class TrueTMS {
23
24
  public users: TrueTMSUsersSdk;
24
25
  public transactions: TrueTMSTransactionsSdk;
25
26
  public businessEntities: TrueTMSBusinessEntitiesSdk;
27
+ public trips: TrueTMSTripsSdk;
26
28
 
27
29
  constructor(private options: TrueTMSOptions) {
28
30
  this.drivers = new TrueTMSDriverSdk(options);
@@ -33,6 +35,7 @@ class TrueTMS {
33
35
  this.users = new TrueTMSUsersSdk(options);
34
36
  this.transactions = new TrueTMSTransactionsSdk(options);
35
37
  this.businessEntities = new TrueTMSBusinessEntitiesSdk(options);
38
+ this.trips = new TrueTMSTripsSdk(options);
36
39
  }
37
40
  }
38
41
 
@@ -54,7 +57,7 @@ export function authenticateApiCall<F extends Function, R>(wrappedFn: F): F {
54
57
  clientSecret
55
58
  )
56
59
  ).access_token;
57
- return wrappedFn(...args, {
60
+ return wrappedFn(...(args.length ? args : [{}]), {
58
61
  Authorization: `Bearer ${accessToken}`,
59
62
  });
60
63
  } as F;
@@ -0,0 +1,10 @@
1
+ import { TrueTMSOptions, authenticateApiCall } from ".";
2
+ import trueTmsGraphqlClient from "../providers/truetms-graphql-client";
3
+
4
+ class TrueTMSTripsSdk {
5
+ constructor(private options: TrueTMSOptions) {}
6
+
7
+ listTrips = authenticateApiCall(trueTmsGraphqlClient.listTrips);
8
+ }
9
+
10
+ export default TrueTMSTripsSdk;