@mydoormot/app-types 1.0.2 → 1.1.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.
@@ -5,9 +5,9 @@ CLI Using tsconfig: tsconfig.json
5
5
  CLI tsup v7.2.0
6
6
  CLI Target: node16
7
7
  CJS Build start
8
- CJS dist/index.js 3.20 KB
9
- CJS ⚡️ Build success in 58ms
8
+ CJS dist/index.js 4.42 KB
9
+ CJS ⚡️ Build success in 141ms
10
10
  DTS Build start
11
- DTS ⚡️ Build success in 788ms
12
- DTS dist/index.d.ts 2.50 KB
13
- Done in 1.42s.
11
+ DTS ⚡️ Build success in 2013ms
12
+ DTS dist/index.d.ts 7.71 KB
13
+ Done in 4.06s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @mydoormot/app-types
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Add latlng
8
+
9
+ ## 1.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Added errand invoice types
14
+
3
15
  ## 1.0.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -53,6 +53,37 @@ type UserAddress = {
53
53
  direction?: string;
54
54
  };
55
55
 
56
+ declare enum EnterpriseType {
57
+ Restaurant = "restaurant",
58
+ Dispatch = "dispatch",
59
+ Property = "property",
60
+ Store = "store"
61
+ }
62
+
63
+ declare enum InvoiceStatus {
64
+ Pending = "pending",
65
+ Paid = "paid",
66
+ Cancelled = "cancelled",
67
+ Failed = "failed"
68
+ }
69
+ declare enum PaymentOptions {
70
+ Cash = "cash",
71
+ Card = "card"
72
+ }
73
+ interface Invoice {
74
+ id: string;
75
+ user: string;
76
+ invoiceType: EnterpriseType | `${EnterpriseType}`;
77
+ amount: number;
78
+ paymentType: PaymentOptions | `${PaymentOptions}`;
79
+ status: InvoiceStatus | `${InvoiceStatus}`;
80
+ version: number;
81
+ referenceId?: string;
82
+ errandId?: string;
83
+ authorizationUrl?: string;
84
+ accessCode?: string;
85
+ }
86
+
56
87
  declare enum ErrandStatus {
57
88
  Pending = "pending",
58
89
  RiderAssigned = "rider-assigned",
@@ -68,6 +99,201 @@ declare const errandTimeline: {
68
99
  title: ErrandStatus;
69
100
  description: string;
70
101
  }[];
102
+ interface PendingErrand {
103
+ _id: string;
104
+ rider: string;
105
+ customerId: string;
106
+ parcelSize: ParcelSize;
107
+ deliveryStatus: ErrandStatus;
108
+ invoice: {
109
+ invoiceStatus: string;
110
+ refId: string;
111
+ transactionId: string;
112
+ };
113
+ nameOfItem: string;
114
+ pickupDetails: {
115
+ cityId: string;
116
+ address: string;
117
+ landmark: string;
118
+ fullName: string;
119
+ mobileNumber: string;
120
+ };
121
+ deliveryDetails: {
122
+ cityId: string;
123
+ address: string;
124
+ landmark: string;
125
+ fullName: string;
126
+ mobileNumber: string;
127
+ };
128
+ scheduleDate: string;
129
+ additionalData: string;
130
+ createdAt: string;
131
+ updatedAt: string;
132
+ version: number;
133
+ pickupLocation: {
134
+ cityId: string;
135
+ cityName: string;
136
+ cityCoords: number[];
137
+ stateId: string;
138
+ stateName: string;
139
+ stateCoords: number[];
140
+ };
141
+ deliveryLocation: {
142
+ cityId: string;
143
+ cityName: string;
144
+ cityCoords: number[];
145
+ stateId: string;
146
+ stateName: string;
147
+ stateCoords: number[];
148
+ };
149
+ errandTimeline: string;
150
+ id: string;
151
+ }
152
+ interface Errand {
153
+ id: string;
154
+ rider: string | Rider;
155
+ customerId: string;
156
+ nameOfItem: string;
157
+ pickupDetails: AddressDetails;
158
+ deliveryDetails: AddressDetails;
159
+ parcelSize: `${ParcelSize}`;
160
+ deliveryStatus: ErrandStatus | `${ErrandStatus}`;
161
+ invoice: {
162
+ invoiceStatus: InvoiceStatus | `${InvoiceStatus}`;
163
+ refId: string;
164
+ authorizationUrl: string;
165
+ accessCode: string;
166
+ invoiceId?: string;
167
+ };
168
+ aliasId: string;
169
+ errandTimeline: string | ErrandTimeline;
170
+ updatedAt: Date;
171
+ createdAt: Date;
172
+ errandRating?: string;
173
+ payOnDeliveryAmount?: string;
174
+ additionalData?: string;
175
+ deliveryDate?: Date;
176
+ }
177
+ interface AggragatedErrand extends Errand {
178
+ parcelSize: `${ParcelSize}`;
179
+ invoiceDetails: Invoice;
180
+ pickupLocation: {
181
+ cityId: string;
182
+ cityName: string;
183
+ cityCoords: number[];
184
+ stateId: string;
185
+ stateName: string;
186
+ stateCoords: number[];
187
+ };
188
+ deliveryLocation: {
189
+ cityId: string;
190
+ cityName: string;
191
+ cityCoords: number[];
192
+ stateId: string;
193
+ stateName: string;
194
+ stateCoords: number[];
195
+ };
196
+ riderUserDetails: User;
197
+ errandRatingDetails?: ErrandRating;
198
+ }
199
+ interface ErrandRating {
200
+ createdAt: string;
201
+ errandId: string;
202
+ rating: number;
203
+ ratingText: string;
204
+ riderId: string;
205
+ updatedAt: string;
206
+ userId: string;
207
+ version: number;
208
+ _id: string;
209
+ }
210
+ declare enum AddressTypes {
211
+ DeliveryAddress = "deliveryAddress",
212
+ PickupAddress = "pickupAddress"
213
+ }
214
+ interface Rider {
215
+ id: string;
216
+ _id: string;
217
+ user: string | User;
218
+ city: string;
219
+ currLocation?: {
220
+ coordinates: number[];
221
+ };
222
+ active: boolean;
223
+ name?: string;
224
+ }
225
+ interface ActiveRider {
226
+ _id: string;
227
+ user: string;
228
+ enterprise: string;
229
+ city: string;
230
+ verified: boolean;
231
+ currLocation: {
232
+ type: 'Point';
233
+ coordinates: [];
234
+ };
235
+ active: boolean;
236
+ vehicleNumber: string;
237
+ rating: number;
238
+ hasBeenRated: number;
239
+ createdAt: string;
240
+ updatedAt: string;
241
+ version: number;
242
+ numErrands: number;
243
+ available: boolean;
244
+ fullName: string;
245
+ }
246
+ declare enum DeliveryStatus {
247
+ Pending = "pending",
248
+ EnRoute = "en-route",
249
+ Delivered = "delivered",
250
+ Cancelled = "cancelled"
251
+ }
252
+ declare enum ParcelSize {
253
+ Bike = "bike",
254
+ Large = "large",
255
+ Medium = "medium",
256
+ Small = "small"
257
+ }
258
+ interface ErrandTimeline {
259
+ id: string;
260
+ errandId: string;
261
+ timeline: {
262
+ status: ErrandStatus;
263
+ title: string;
264
+ description: string;
265
+ time?: string;
266
+ date?: Date;
267
+ }[];
268
+ currTimelineIndex: number;
269
+ updatedAt: Date;
270
+ createdAt: Date;
271
+ }
272
+ interface ErrandTimeline {
273
+ id: string;
274
+ errandId: string;
275
+ timeline: {
276
+ status: ErrandStatus;
277
+ title: string;
278
+ description: string;
279
+ time?: string;
280
+ date?: Date;
281
+ }[];
282
+ currTimelineIndex: number;
283
+ updatedAt: Date;
284
+ createdAt: Date;
285
+ }
286
+ type AddressDetails = {
287
+ cityId: string;
288
+ address: string;
289
+ fullName: string;
290
+ location: {
291
+ coordinates: number[];
292
+ };
293
+ mobileNumber?: string;
294
+ landmark?: string;
295
+ addressId?: string;
296
+ };
71
297
 
72
298
  type City = {
73
299
  id: string;
@@ -97,6 +323,7 @@ type State = {
97
323
  updatedAt: Date;
98
324
  createdAt: Date;
99
325
  };
326
+ type LatLng = `${number},${number}`;
100
327
 
101
328
  interface PaginateResult<T> {
102
329
  docs: T[];
@@ -114,4 +341,4 @@ interface PaginateResult<T> {
114
341
  [customLabel: string]: T[] | number | boolean | null | undefined;
115
342
  }
116
343
 
117
- export { AuthType, City, ErrandStatus, PaginateResult, RoleType, State, User, UserAddress, errandTimeline };
344
+ export { ActiveRider, AddressDetails, AddressTypes, AggragatedErrand, AuthType, City, DeliveryStatus, Errand, ErrandRating, ErrandStatus, ErrandTimeline, Invoice, InvoiceStatus, LatLng, PaginateResult, ParcelSize, PaymentOptions, PendingErrand, Rider, RoleType, State, User, UserAddress, errandTimeline };
package/dist/index.js CHANGED
@@ -20,8 +20,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ AddressTypes: () => AddressTypes,
23
24
  AuthType: () => AuthType,
25
+ DeliveryStatus: () => DeliveryStatus,
24
26
  ErrandStatus: () => ErrandStatus,
27
+ InvoiceStatus: () => InvoiceStatus,
28
+ ParcelSize: () => ParcelSize,
29
+ PaymentOptions: () => PaymentOptions,
25
30
  RoleType: () => RoleType,
26
31
  errandTimeline: () => errandTimeline
27
32
  });
@@ -60,11 +65,6 @@ var errandTimeline = [
60
65
  title: "pending" /* Pending */,
61
66
  description: "Your errand is pending, you would be notified as soon as it is started"
62
67
  },
63
- {
64
- status: "rider-assigned" /* RiderAssigned */,
65
- title: "rider-assigned" /* RiderAssigned */,
66
- description: "Your errand has been assigned to a dispatch rider, you would be notified by the dispatch rider shortly"
67
- },
68
68
  {
69
69
  status: "started" /* Started */,
70
70
  title: "started" /* Started */,
@@ -86,10 +86,48 @@ var errandTimeline = [
86
86
  description: "Your package has been delivered and the errand closed, please leave a review and a rating for the rider"
87
87
  }
88
88
  ];
89
+ var AddressTypes = /* @__PURE__ */ ((AddressTypes2) => {
90
+ AddressTypes2["DeliveryAddress"] = "deliveryAddress";
91
+ AddressTypes2["PickupAddress"] = "pickupAddress";
92
+ return AddressTypes2;
93
+ })(AddressTypes || {});
94
+ var DeliveryStatus = /* @__PURE__ */ ((DeliveryStatus2) => {
95
+ DeliveryStatus2["Pending"] = "pending";
96
+ DeliveryStatus2["EnRoute"] = "en-route";
97
+ DeliveryStatus2["Delivered"] = "delivered";
98
+ DeliveryStatus2["Cancelled"] = "cancelled";
99
+ return DeliveryStatus2;
100
+ })(DeliveryStatus || {});
101
+ var ParcelSize = /* @__PURE__ */ ((ParcelSize2) => {
102
+ ParcelSize2["Bike"] = "bike";
103
+ ParcelSize2["Large"] = "large";
104
+ ParcelSize2["Medium"] = "medium";
105
+ ParcelSize2["Small"] = "small";
106
+ return ParcelSize2;
107
+ })(ParcelSize || {});
108
+
109
+ // src/invoice.ts
110
+ var InvoiceStatus = /* @__PURE__ */ ((InvoiceStatus2) => {
111
+ InvoiceStatus2["Pending"] = "pending";
112
+ InvoiceStatus2["Paid"] = "paid";
113
+ InvoiceStatus2["Cancelled"] = "cancelled";
114
+ InvoiceStatus2["Failed"] = "failed";
115
+ return InvoiceStatus2;
116
+ })(InvoiceStatus || {});
117
+ var PaymentOptions = /* @__PURE__ */ ((PaymentOptions2) => {
118
+ PaymentOptions2["Cash"] = "cash";
119
+ PaymentOptions2["Card"] = "card";
120
+ return PaymentOptions2;
121
+ })(PaymentOptions || {});
89
122
  // Annotate the CommonJS export names for ESM import in node:
90
123
  0 && (module.exports = {
124
+ AddressTypes,
91
125
  AuthType,
126
+ DeliveryStatus,
92
127
  ErrandStatus,
128
+ InvoiceStatus,
129
+ ParcelSize,
130
+ PaymentOptions,
93
131
  RoleType,
94
132
  errandTimeline
95
133
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mydoormot/app-types",
3
- "version": "1.0.2",
3
+ "version": "1.1.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/src/errand.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { Invoice, InvoiceStatus } from './invoice';
2
+ import { User } from './user';
3
+
1
4
  export enum ErrandStatus {
2
5
  Pending = 'pending',
3
6
  RiderAssigned = 'rider-assigned',
@@ -17,13 +20,6 @@ export const errandTimeline = [
17
20
  'Your errand is pending, you would be notified as soon as it is started',
18
21
  },
19
22
 
20
- {
21
- status: ErrandStatus.RiderAssigned,
22
- title: ErrandStatus.RiderAssigned,
23
- description:
24
- 'Your errand has been assigned to a dispatch rider, you would be notified by the dispatch rider shortly',
25
- },
26
-
27
23
  {
28
24
  status: ErrandStatus.Started,
29
25
  title: ErrandStatus.Started,
@@ -50,3 +46,212 @@ export const errandTimeline = [
50
46
  'Your package has been delivered and the errand closed, please leave a review and a rating for the rider',
51
47
  },
52
48
  ];
49
+
50
+ export interface PendingErrand {
51
+ _id: string;
52
+ rider: string;
53
+ customerId: string;
54
+ parcelSize: ParcelSize;
55
+ deliveryStatus: ErrandStatus;
56
+ invoice: {
57
+ invoiceStatus: string;
58
+ refId: string;
59
+ transactionId: string;
60
+ };
61
+ nameOfItem: string;
62
+ pickupDetails: {
63
+ cityId: string;
64
+ address: string;
65
+ landmark: string;
66
+ fullName: string;
67
+ mobileNumber: string;
68
+ };
69
+ deliveryDetails: {
70
+ cityId: string;
71
+ address: string;
72
+ landmark: string;
73
+ fullName: string;
74
+ mobileNumber: string;
75
+ };
76
+ scheduleDate: string;
77
+
78
+ additionalData: string;
79
+ createdAt: string;
80
+ updatedAt: string;
81
+ version: number;
82
+ pickupLocation: {
83
+ cityId: string;
84
+ cityName: string;
85
+ cityCoords: number[];
86
+ stateId: string;
87
+ stateName: string;
88
+ stateCoords: number[];
89
+ };
90
+ deliveryLocation: {
91
+ cityId: string;
92
+ cityName: string;
93
+ cityCoords: number[];
94
+ stateId: string;
95
+ stateName: string;
96
+ stateCoords: number[];
97
+ };
98
+ errandTimeline: string;
99
+ id: string;
100
+ }
101
+
102
+ export interface Errand {
103
+ id: string;
104
+ rider: string | Rider;
105
+ customerId: string;
106
+ nameOfItem: string;
107
+ pickupDetails: AddressDetails;
108
+ deliveryDetails: AddressDetails;
109
+ parcelSize: `${ParcelSize}`;
110
+ deliveryStatus: ErrandStatus | `${ErrandStatus}`;
111
+ invoice: {
112
+ invoiceStatus: InvoiceStatus | `${InvoiceStatus}`;
113
+ refId: string;
114
+ authorizationUrl: string;
115
+ accessCode: string;
116
+ invoiceId?: string;
117
+ };
118
+ aliasId: string;
119
+ errandTimeline: string | ErrandTimeline;
120
+ updatedAt: Date;
121
+ createdAt: Date;
122
+
123
+ errandRating?: string;
124
+ payOnDeliveryAmount?: string;
125
+ additionalData?: string;
126
+ deliveryDate?: Date;
127
+ }
128
+
129
+ export interface AggragatedErrand extends Errand {
130
+ parcelSize: `${ParcelSize}`;
131
+ invoiceDetails: Invoice;
132
+ pickupLocation: {
133
+ cityId: string;
134
+ cityName: string;
135
+ cityCoords: number[];
136
+ stateId: string;
137
+ stateName: string;
138
+ stateCoords: number[];
139
+ };
140
+ deliveryLocation: {
141
+ cityId: string;
142
+ cityName: string;
143
+ cityCoords: number[];
144
+ stateId: string;
145
+ stateName: string;
146
+ stateCoords: number[];
147
+ };
148
+ riderUserDetails: User;
149
+ errandRatingDetails?: ErrandRating;
150
+ }
151
+
152
+ export interface ErrandTimeline {
153
+ id: string;
154
+ errandId: string;
155
+ timeline: {
156
+ status: ErrandStatus;
157
+ title: string;
158
+ description: string;
159
+ time?: string;
160
+ date?: Date;
161
+ }[];
162
+ currTimelineIndex: number;
163
+ updatedAt: Date;
164
+ createdAt: Date;
165
+ }
166
+
167
+ export interface ErrandRating {
168
+ createdAt: string;
169
+ errandId: string;
170
+ rating: number;
171
+ ratingText: string;
172
+ riderId: string;
173
+ updatedAt: string;
174
+ userId: string;
175
+ version: number;
176
+ _id: string;
177
+ }
178
+
179
+ export enum AddressTypes {
180
+ DeliveryAddress = 'deliveryAddress',
181
+ PickupAddress = 'pickupAddress',
182
+ }
183
+
184
+ export interface Rider {
185
+ id: string;
186
+ _id: string;
187
+ user: string | User;
188
+ city: string;
189
+ currLocation?: {
190
+ coordinates: number[];
191
+ };
192
+ active: boolean;
193
+ name?: string;
194
+ }
195
+
196
+ export interface ActiveRider {
197
+ _id: string;
198
+ user: string;
199
+ enterprise: string;
200
+ city: string;
201
+ verified: boolean;
202
+ currLocation: {
203
+ type: 'Point';
204
+ coordinates: [];
205
+ };
206
+ active: boolean;
207
+ vehicleNumber: string;
208
+ rating: number;
209
+ hasBeenRated: number;
210
+ createdAt: string;
211
+ updatedAt: string;
212
+ version: number;
213
+ numErrands: number;
214
+ available: boolean;
215
+ fullName: string;
216
+ }
217
+
218
+ export enum DeliveryStatus {
219
+ Pending = 'pending',
220
+ EnRoute = 'en-route',
221
+ Delivered = 'delivered',
222
+ Cancelled = 'cancelled',
223
+ }
224
+
225
+ export enum ParcelSize {
226
+ Bike = 'bike',
227
+ Large = 'large',
228
+ Medium = 'medium',
229
+ Small = 'small',
230
+ }
231
+
232
+ export interface ErrandTimeline {
233
+ id: string;
234
+ errandId: string;
235
+ timeline: {
236
+ status: ErrandStatus;
237
+ title: string;
238
+ description: string;
239
+ time?: string;
240
+ date?: Date;
241
+ }[];
242
+ currTimelineIndex: number;
243
+ updatedAt: Date;
244
+ createdAt: Date;
245
+ }
246
+
247
+ export type AddressDetails = {
248
+ cityId: string;
249
+ address: string;
250
+ fullName: string;
251
+ location: {
252
+ coordinates: number[];
253
+ };
254
+ mobileNumber?: string;
255
+ landmark?: string;
256
+ addressId?: string;
257
+ };
package/src/index.ts CHANGED
@@ -17,3 +17,4 @@ export interface PaginateResult<T> {
17
17
  export * from './user';
18
18
  export * from './errand';
19
19
  export * from './location';
20
+ export * from './invoice';
package/src/invoice.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { EnterpriseType } from './enterprise';
2
+
1
3
  export enum InvoiceStatus {
2
4
  Pending = 'pending',
3
5
  Paid = 'paid',
@@ -9,3 +11,17 @@ export enum PaymentOptions {
9
11
  Cash = 'cash',
10
12
  Card = 'card',
11
13
  }
14
+
15
+ export interface Invoice {
16
+ id: string;
17
+ user: string;
18
+ invoiceType: EnterpriseType | `${EnterpriseType}`;
19
+ amount: number;
20
+ paymentType: PaymentOptions | `${PaymentOptions}`;
21
+ status: InvoiceStatus | `${InvoiceStatus}`;
22
+ version: number;
23
+ referenceId?: string;
24
+ errandId?: string;
25
+ authorizationUrl?: string;
26
+ accessCode?: string;
27
+ }
package/src/location.ts CHANGED
@@ -28,3 +28,5 @@ export type State = {
28
28
  updatedAt: Date;
29
29
  createdAt: Date;
30
30
  };
31
+
32
+ export type LatLng = `${number},${number}`;