@de./sdk-rn 1.1.7 → 1.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.
Files changed (61) hide show
  1. package/dist/allend/Agent/consolidation.d.ts +9 -0
  2. package/dist/allend/Agent/consolidation.d.ts.map +1 -0
  3. package/dist/allend/Agent/consolidation.js +27 -0
  4. package/dist/allend/Agent/consolidation.js.map +1 -0
  5. package/dist/allend/Agent/delivery.d.ts +12 -0
  6. package/dist/allend/Agent/delivery.d.ts.map +1 -0
  7. package/dist/allend/Agent/delivery.js +55 -0
  8. package/dist/allend/Agent/delivery.js.map +1 -0
  9. package/dist/allend/Agent/dispatch.d.ts +9 -0
  10. package/dist/allend/Agent/dispatch.d.ts.map +1 -0
  11. package/dist/allend/Agent/dispatch.js +27 -0
  12. package/dist/allend/Agent/dispatch.js.map +1 -0
  13. package/dist/allend/Agent/index.d.ts +35 -0
  14. package/dist/allend/Agent/index.d.ts.map +1 -0
  15. package/dist/allend/Agent/index.js +74 -0
  16. package/dist/allend/Agent/index.js.map +1 -0
  17. package/dist/allend/Agent/navigation.d.ts +9 -0
  18. package/dist/allend/Agent/navigation.d.ts.map +1 -0
  19. package/dist/allend/Agent/navigation.js +28 -0
  20. package/dist/allend/Agent/navigation.js.map +1 -0
  21. package/dist/allend/Agent/origin.d.ts +10 -0
  22. package/dist/allend/Agent/origin.d.ts.map +1 -0
  23. package/dist/allend/Agent/origin.js +37 -0
  24. package/dist/allend/Agent/origin.js.map +1 -0
  25. package/dist/allend/Agent/reallocation.d.ts +8 -0
  26. package/dist/allend/Agent/reallocation.d.ts.map +1 -0
  27. package/dist/allend/Agent/reallocation.js +17 -0
  28. package/dist/allend/Agent/reallocation.js.map +1 -0
  29. package/dist/allend/Agent/realtime.d.ts +37 -0
  30. package/dist/allend/Agent/realtime.d.ts.map +1 -0
  31. package/dist/allend/Agent/realtime.js +101 -0
  32. package/dist/allend/Agent/realtime.js.map +1 -0
  33. package/dist/allend/Agent/rides.d.ts +13 -0
  34. package/dist/allend/Agent/rides.d.ts.map +1 -0
  35. package/dist/allend/Agent/rides.js +66 -0
  36. package/dist/allend/Agent/rides.js.map +1 -0
  37. package/dist/allend/Agent/shipping.d.ts +12 -0
  38. package/dist/allend/Agent/shipping.d.ts.map +1 -0
  39. package/dist/allend/Agent/shipping.js +55 -0
  40. package/dist/allend/Agent/shipping.js.map +1 -0
  41. package/dist/index.d.ts +4 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +2 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/utils/index.d.ts +11 -0
  46. package/dist/utils/index.d.ts.map +1 -1
  47. package/dist/utils/index.js +8 -0
  48. package/dist/utils/index.js.map +1 -1
  49. package/package.json +2 -1
  50. package/src/allend/Agent/consolidation.ts +31 -0
  51. package/src/allend/Agent/delivery.ts +61 -0
  52. package/src/allend/Agent/dispatch.ts +31 -0
  53. package/src/allend/Agent/index.ts +102 -0
  54. package/src/allend/Agent/navigation.ts +31 -0
  55. package/src/allend/Agent/origin.ts +42 -0
  56. package/src/allend/Agent/reallocation.ts +18 -0
  57. package/src/allend/Agent/realtime.ts +135 -0
  58. package/src/allend/Agent/rides.ts +73 -0
  59. package/src/allend/Agent/shipping.ts +61 -0
  60. package/src/index.ts +9 -1
  61. package/src/utils/index.ts +20 -1
@@ -0,0 +1,9 @@
1
+ import type { AgentConsolidationRespondValidation, AgentConsolidationHandoffValidation } from '@de./types';
2
+ import { type Http } from '../../utils';
3
+ export default class AgentConsolidation {
4
+ private http;
5
+ constructor(http: Http);
6
+ respond(body: AgentConsolidationRespondValidation['body']): Promise<AgentConsolidationRespondValidation['response']>;
7
+ handoffConfirm(body: AgentConsolidationHandoffValidation['body']): Promise<AgentConsolidationHandoffValidation['response']>;
8
+ }
9
+ //# sourceMappingURL=consolidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consolidation.d.ts","sourceRoot":"","sources":["../../../src/allend/Agent/consolidation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mCAAmC,EACnC,mCAAmC,EACnC,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,KAAK,IAAI,EAAY,MAAM,aAAa,CAAA;AAIjD,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACzB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI;IAEzB,OAAO,CAAE,IAAI,EAAE,mCAAmC,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,mCAAmC,CAAC,UAAU,CAAC,CAAC;IAUtH,cAAc,CAAE,IAAI,EAAE,mCAAmC,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,mCAAmC,CAAC,UAAU,CAAC,CAAC;CASnI"}
@@ -0,0 +1,27 @@
1
+ // ─── Agent Consolidation ──────────────────────────────────────────────────────
2
+ export default class AgentConsolidation {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async respond(body) {
7
+ const { error, message, data } = await this.http.request({
8
+ url: '/agent/consolidation/respond',
9
+ method: 'POST',
10
+ body
11
+ });
12
+ if (error)
13
+ throw new Error(message);
14
+ return data;
15
+ }
16
+ async handoffConfirm(body) {
17
+ const { error, message, data } = await this.http.request({
18
+ url: '/agent/consolidation/handoff/confirm',
19
+ method: 'POST',
20
+ body
21
+ });
22
+ if (error)
23
+ throw new Error(message);
24
+ return data;
25
+ }
26
+ }
27
+ //# sourceMappingURL=consolidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consolidation.js","sourceRoot":"","sources":["../../../src/allend/Agent/consolidation.ts"],"names":[],"mappings":"AAMA,iFAAiF;AAEjF,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACtC,YAAqB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAEnC,KAAK,CAAC,OAAO,CAAE,IAAiD;QAC/D,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuD;YAC9G,GAAG,EAAE,8BAA8B;YACnC,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,cAAc,CAAE,IAAiD;QACtE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuD;YAC9G,GAAG,EAAE,sCAAsC;YAC3C,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;CACD"}
@@ -0,0 +1,12 @@
1
+ import type { AgentDeliveryListValidation, AgentDeliveryGetValidation, AgentDeliveryAcceptValidation, AgentDeliveryUpdateStatusValidation, AgentDeliveryReportIssueValidation } from '@de./types';
2
+ import { type Http } from '../../utils';
3
+ export default class AgentDelivery {
4
+ private http;
5
+ constructor(http: Http);
6
+ list(querystring?: AgentDeliveryListValidation['querystring']): Promise<AgentDeliveryListValidation['response']>;
7
+ get(reference: string): Promise<AgentDeliveryGetValidation['response']>;
8
+ accept(reference: string): Promise<AgentDeliveryAcceptValidation['response']>;
9
+ updateStatus(reference: string, body: AgentDeliveryUpdateStatusValidation['body']): Promise<AgentDeliveryUpdateStatusValidation['response']>;
10
+ reportIssue(reference: string, body: AgentDeliveryReportIssueValidation['body']): Promise<AgentDeliveryReportIssueValidation['response']>;
11
+ }
12
+ //# sourceMappingURL=delivery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../../../src/allend/Agent/delivery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,2BAA2B,EAC3B,0BAA0B,EAC1B,6BAA6B,EAC7B,mCAAmC,EACnC,kCAAkC,EAClC,MAAM,YAAY,CAAA;AACnB,OAAO,EAAM,KAAK,IAAI,EAAY,MAAM,aAAa,CAAA;AAIrD,MAAM,CAAC,OAAO,OAAO,aAAa;IACpB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI;IAEzB,IAAI,CAAE,WAAW,CAAC,EAAE,2BAA2B,CAAC,aAAa,CAAC,GAAI,OAAO,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;IASlH,GAAG,CAAE,SAAS,EAAE,MAAM,GAAI,OAAO,CAAC,0BAA0B,CAAC,UAAU,CAAC,CAAC;IASzE,MAAM,CAAE,SAAS,EAAE,MAAM,GAAI,OAAO,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;IAS/E,YAAY,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,mCAAmC,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,mCAAmC,CAAC,UAAU,CAAC,CAAC;IAU9I,WAAW,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,kCAAkC,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,kCAAkC,CAAC,UAAU,CAAC,CAAC;CASjJ"}
@@ -0,0 +1,55 @@
1
+ import { qs } from '../../utils';
2
+ // ─── Agent Delivery Orders ────────────────────────────────────────────────────
3
+ export default class AgentDelivery {
4
+ constructor(http) {
5
+ this.http = http;
6
+ }
7
+ async list(querystring) {
8
+ const { error, message, data } = await this.http.request({
9
+ url: `/agent/delivery/orders${qs(querystring)}`,
10
+ method: 'GET'
11
+ });
12
+ if (error)
13
+ throw new Error(message);
14
+ return data;
15
+ }
16
+ async get(reference) {
17
+ const { error, message, data } = await this.http.request({
18
+ url: `/agent/delivery/orders/${reference}`,
19
+ method: 'GET'
20
+ });
21
+ if (error)
22
+ throw new Error(message);
23
+ return data;
24
+ }
25
+ async accept(reference) {
26
+ const { error, message, data } = await this.http.request({
27
+ url: `/agent/delivery/orders/${reference}/accept`,
28
+ method: 'POST'
29
+ });
30
+ if (error)
31
+ throw new Error(message);
32
+ return data;
33
+ }
34
+ async updateStatus(reference, body) {
35
+ const { error, message, data } = await this.http.request({
36
+ url: `/agent/delivery/orders/${reference}/status`,
37
+ method: 'PATCH',
38
+ body
39
+ });
40
+ if (error)
41
+ throw new Error(message);
42
+ return data;
43
+ }
44
+ async reportIssue(reference, body) {
45
+ const { error, message, data } = await this.http.request({
46
+ url: `/agent/delivery/orders/${reference}/issue`,
47
+ method: 'POST',
48
+ body
49
+ });
50
+ if (error)
51
+ throw new Error(message);
52
+ return data;
53
+ }
54
+ }
55
+ //# sourceMappingURL=delivery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery.js","sourceRoot":"","sources":["../../../src/allend/Agent/delivery.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,EAAE,EAAuB,MAAM,aAAa,CAAA;AAErD,iFAAiF;AAEjF,MAAM,CAAC,OAAO,OAAO,aAAa;IACjC,YAAqB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAEnC,KAAK,CAAC,IAAI,CAAE,WAAwD;QACnE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA+C;YACtG,GAAG,EAAE,yBAAyB,EAAE,CAAE,WAAW,CAAE,EAAE;YACjD,MAAM,EAAE,KAAK;SACb,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,SAAiB;QAC3B,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA8C;YACrG,GAAG,EAAE,0BAA0B,SAAS,EAAE;YAC1C,MAAM,EAAE,KAAK;SACb,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,MAAM,CAAE,SAAiB;QAC9B,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAiD;YACxG,GAAG,EAAE,0BAA0B,SAAS,SAAS;YACjD,MAAM,EAAE,MAAM;SACd,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,YAAY,CAAE,SAAiB,EAAE,IAAiD;QACvF,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuD;YAC9G,GAAG,EAAE,0BAA0B,SAAS,SAAS;YACjD,MAAM,EAAE,OAAO;YACf,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,WAAW,CAAE,SAAiB,EAAE,IAAgD;QACrF,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAsD;YAC7G,GAAG,EAAE,0BAA0B,SAAS,QAAQ;YAChD,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;CACD"}
@@ -0,0 +1,9 @@
1
+ import type { AgentDispatchRespondValidation, AgentDispatchRateValidation } from '@de./types';
2
+ import { type Http } from '../../utils';
3
+ export default class AgentDispatch {
4
+ private http;
5
+ constructor(http: Http);
6
+ respond(body: AgentDispatchRespondValidation['body']): Promise<AgentDispatchRespondValidation['response']>;
7
+ rate(body: AgentDispatchRateValidation['body']): Promise<AgentDispatchRateValidation['response']>;
8
+ }
9
+ //# sourceMappingURL=dispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/allend/Agent/dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,8BAA8B,EAC9B,2BAA2B,EAC3B,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,KAAK,IAAI,EAAY,MAAM,aAAa,CAAA;AAIjD,MAAM,CAAC,OAAO,OAAO,aAAa;IACpB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI;IAEzB,OAAO,CAAE,IAAI,EAAE,8BAA8B,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,8BAA8B,CAAC,UAAU,CAAC,CAAC;IAU5G,IAAI,CAAE,IAAI,EAAE,2BAA2B,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;CASzG"}
@@ -0,0 +1,27 @@
1
+ // ─── Agent Dispatch ───────────────────────────────────────────────────────────
2
+ export default class AgentDispatch {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async respond(body) {
7
+ const { error, message, data } = await this.http.request({
8
+ url: '/agent/dispatch/respond',
9
+ method: 'POST',
10
+ body
11
+ });
12
+ if (error)
13
+ throw new Error(message);
14
+ return data;
15
+ }
16
+ async rate(body) {
17
+ const { error, message, data } = await this.http.request({
18
+ url: '/agent/dispatch/rate',
19
+ method: 'POST',
20
+ body
21
+ });
22
+ if (error)
23
+ throw new Error(message);
24
+ return data;
25
+ }
26
+ }
27
+ //# sourceMappingURL=dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../src/allend/Agent/dispatch.ts"],"names":[],"mappings":"AAMA,iFAAiF;AAEjF,MAAM,CAAC,OAAO,OAAO,aAAa;IACjC,YAAqB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAEnC,KAAK,CAAC,OAAO,CAAE,IAA4C;QAC1D,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAkD;YACzG,GAAG,EAAE,yBAAyB;YAC9B,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,IAAI,CAAE,IAAyC;QACpD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA+C;YACtG,GAAG,EAAE,sBAAsB;YAC3B,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;CACD"}
@@ -0,0 +1,35 @@
1
+ import type { AgentInfoValidation, AgentAvailabilityValidation, AgentUpdateValidation } from '@de./types';
2
+ import AccessManager from '../Access';
3
+ import AgentRides from './rides';
4
+ import AgentDelivery from './delivery';
5
+ import AgentShipping from './shipping';
6
+ import AgentNavigation from './navigation';
7
+ import AgentConsolidation from './consolidation';
8
+ import AgentReallocation from './reallocation';
9
+ import AgentDispatch from './dispatch';
10
+ import AgentOrigin from './origin';
11
+ import AgentRealtime from './realtime';
12
+ export type AgentConfig = {
13
+ context: string;
14
+ accessToken: string;
15
+ env?: 'dev' | 'prod';
16
+ platform?: 'web' | 'mobile' | 'server' | 'proxy';
17
+ remoteOrigin?: string;
18
+ devHostname?: string;
19
+ };
20
+ export default class Agent extends AccessManager {
21
+ readonly rides: AgentRides;
22
+ readonly delivery: AgentDelivery;
23
+ readonly shipping: AgentShipping;
24
+ readonly navigation: AgentNavigation;
25
+ readonly consolidation: AgentConsolidation;
26
+ readonly reallocation: AgentReallocation;
27
+ readonly dispatch: AgentDispatch;
28
+ readonly origin: AgentOrigin;
29
+ readonly realtime: AgentRealtime;
30
+ constructor(config: AgentConfig);
31
+ info(): Promise<AgentInfoValidation['response']>;
32
+ update(body: AgentUpdateValidation['body']): Promise<AgentUpdateValidation['response']>;
33
+ availability(status: AgentAvailabilityValidation['params']['availability']): Promise<AgentAvailabilityValidation['response']>;
34
+ }
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/allend/Agent/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,EACrB,MAAM,YAAY,CAAA;AACnB,OAAO,aAAa,MAAM,WAAW,CAAA;AAErC,OAAO,UAAU,MAAM,SAAS,CAAA;AAChC,OAAO,aAAa,MAAM,YAAY,CAAA;AACtC,OAAO,aAAa,MAAM,YAAY,CAAA;AACtC,OAAO,eAAe,MAAM,cAAc,CAAA;AAC1C,OAAO,kBAAkB,MAAM,iBAAiB,CAAA;AAChD,OAAO,iBAAiB,MAAM,gBAAgB,CAAA;AAC9C,OAAO,aAAa,MAAM,YAAY,CAAA;AACtC,OAAO,WAAW,MAAM,UAAU,CAAA;AAClC,OAAO,aAAa,MAAM,YAAY,CAAA;AAEtC,MAAM,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;IAChD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAWD,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,aAAa;IAC/C,QAAQ,CAAC,KAAK,EAAU,UAAU,CAAA;IAClC,QAAQ,CAAC,QAAQ,EAAO,aAAa,CAAA;IACrC,QAAQ,CAAC,QAAQ,EAAO,aAAa,CAAA;IACrC,QAAQ,CAAC,UAAU,EAAK,eAAe,CAAA;IACvC,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAA;IAC1C,QAAQ,CAAC,YAAY,EAAG,iBAAiB,CAAA;IACzC,QAAQ,CAAC,QAAQ,EAAO,aAAa,CAAA;IACrC,QAAQ,CAAC,MAAM,EAAS,WAAW,CAAA;IACnC,QAAQ,CAAC,QAAQ,EAAO,aAAa,CAAA;gBAExB,MAAM,EAAE,WAAW;IA2B1B,IAAI,IAAI,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAShD,MAAM,CAAE,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAUzF,YAAY,CAAE,MAAM,EAAE,2BAA2B,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,GAAI,OAAO,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;CAQrI"}
@@ -0,0 +1,74 @@
1
+ import AccessManager from '../Access';
2
+ import AgentRides from './rides';
3
+ import AgentDelivery from './delivery';
4
+ import AgentShipping from './shipping';
5
+ import AgentNavigation from './navigation';
6
+ import AgentConsolidation from './consolidation';
7
+ import AgentReallocation from './reallocation';
8
+ import AgentDispatch from './dispatch';
9
+ import AgentOrigin from './origin';
10
+ import AgentRealtime from './realtime';
11
+ // ─────────────────────────────────────────────────────────────────────────────
12
+ //
13
+ // Agent: Agent Operation Interfaces — de.arch AUX/agent routes.
14
+ // Covers profile, availability, orders (ride/delivery/shipping),
15
+ // navigation, consolidation, reallocation, dispatch, origin — plus the
16
+ // realtime socket channel (order rooms + proactive-consolidation responses).
17
+ //
18
+ // ─────────────────────────────────────────────────────────────────────────────
19
+ export default class Agent extends AccessManager {
20
+ constructor(config) {
21
+ if (!config.context)
22
+ throw new Error('Undefined context. See https://doc.dedot.io/sdk/aux');
23
+ if (!config.accessToken)
24
+ throw new Error('Undefined accessToken. See https://doc.dedot.io/sdk/auth');
25
+ const access = {
26
+ context: config.context,
27
+ accessToken: config.accessToken,
28
+ env: config.env || 'dev',
29
+ platform: config.platform || 'mobile',
30
+ remoteOrigin: config.remoteOrigin,
31
+ devHostname: config.devHostname
32
+ };
33
+ super(access, 'API');
34
+ this.rides = new AgentRides(this);
35
+ this.delivery = new AgentDelivery(this);
36
+ this.shipping = new AgentShipping(this);
37
+ this.navigation = new AgentNavigation(this);
38
+ this.consolidation = new AgentConsolidation(this);
39
+ this.reallocation = new AgentReallocation(this);
40
+ this.dispatch = new AgentDispatch(this);
41
+ this.origin = new AgentOrigin(this);
42
+ this.realtime = new AgentRealtime(access);
43
+ }
44
+ // ── Agent profile ─────────────────────────────────────────────────────────
45
+ async info() {
46
+ const { error, message, data } = await this.request({
47
+ url: '/agent',
48
+ method: 'GET'
49
+ });
50
+ if (error)
51
+ throw new Error(message);
52
+ return data;
53
+ }
54
+ async update(body) {
55
+ const { error, message, data } = await this.request({
56
+ url: '/agent',
57
+ method: 'PATCH',
58
+ body
59
+ });
60
+ if (error)
61
+ throw new Error(message);
62
+ return data;
63
+ }
64
+ async availability(status) {
65
+ const { error, message, data } = await this.request({
66
+ url: `/agent/${status}`,
67
+ method: 'GET'
68
+ });
69
+ if (error)
70
+ throw new Error(message);
71
+ return data;
72
+ }
73
+ }
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/allend/Agent/index.ts"],"names":[],"mappings":"AAMA,OAAO,aAAa,MAAM,WAAW,CAAA;AAErC,OAAO,UAAU,MAAM,SAAS,CAAA;AAChC,O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AAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;CACD"}
@@ -0,0 +1,9 @@
1
+ import type { AgentLocationValidation, AgentNearbyValidation } from '@de./types';
2
+ import { type Http } from '../../utils';
3
+ export default class AgentNavigation {
4
+ private http;
5
+ constructor(http: Http);
6
+ location(body: AgentLocationValidation['body']): Promise<AgentLocationValidation['response']>;
7
+ nearby(body: AgentNearbyValidation['body'], querystring?: AgentNearbyValidation['querystring']): Promise<AgentNearbyValidation['response']>;
8
+ }
9
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/allend/Agent/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,uBAAuB,EACvB,qBAAqB,EACrB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAM,KAAK,IAAI,EAAY,MAAM,aAAa,CAAA;AAIrD,MAAM,CAAC,OAAO,OAAO,eAAe;IACtB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI;IAEzB,QAAQ,CAAE,IAAI,EAAE,uBAAuB,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAU/F,MAAM,CAAE,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,EAAE,qBAAqB,CAAC,aAAa,CAAC,GAAI,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;CASnJ"}
@@ -0,0 +1,28 @@
1
+ import { qs } from '../../utils';
2
+ // ─── Agent Navigation ─────────────────────────────────────────────────────────
3
+ export default class AgentNavigation {
4
+ constructor(http) {
5
+ this.http = http;
6
+ }
7
+ async location(body) {
8
+ const { error, message, data } = await this.http.request({
9
+ url: '/agent/navigation/location',
10
+ method: 'POST',
11
+ body
12
+ });
13
+ if (error)
14
+ throw new Error(message);
15
+ return data;
16
+ }
17
+ async nearby(body, querystring) {
18
+ const { error, message, data } = await this.http.request({
19
+ url: `/agent/navigation/nearby${qs(querystring)}`,
20
+ method: 'POST',
21
+ body
22
+ });
23
+ if (error)
24
+ throw new Error(message);
25
+ return data;
26
+ }
27
+ }
28
+ //# sourceMappingURL=navigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../src/allend/Agent/navigation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,EAAE,EAAuB,MAAM,aAAa,CAAA;AAErD,iFAAiF;AAEjF,MAAM,CAAC,OAAO,OAAO,eAAe;IACnC,YAAqB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAEnC,KAAK,CAAC,QAAQ,CAAE,IAAqC;QACpD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA2C;YAClG,GAAG,EAAE,4BAA4B;YACjC,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,MAAM,CAAE,IAAmC,EAAE,WAAkD;QACpG,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAyC;YAChG,GAAG,EAAE,2BAA2B,EAAE,CAAE,WAAW,CAAE,EAAE;YACnD,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;CACD"}
@@ -0,0 +1,10 @@
1
+ import type { AgentOriginStatusReportValidation, AgentRegisterPoiValidation, AgentAddPoiNoteValidation } from '@de./types';
2
+ import { type Http } from '../../utils';
3
+ export default class AgentOrigin {
4
+ private http;
5
+ constructor(http: Http);
6
+ statusReport(body: AgentOriginStatusReportValidation['body']): Promise<AgentOriginStatusReportValidation['response']>;
7
+ registerPoi(body: AgentRegisterPoiValidation['body']): Promise<AgentRegisterPoiValidation['response']>;
8
+ addPoiNote(body: AgentAddPoiNoteValidation['body']): Promise<AgentAddPoiNoteValidation['response']>;
9
+ }
10
+ //# sourceMappingURL=origin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../../src/allend/Agent/origin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iCAAiC,EACjC,0BAA0B,EAC1B,yBAAyB,EACzB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,KAAK,IAAI,EAAY,MAAM,aAAa,CAAA;AAIjD,MAAM,CAAC,OAAO,OAAO,WAAW;IAClB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI;IAEzB,YAAY,CAAE,IAAI,EAAE,iCAAiC,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,iCAAiC,CAAC,UAAU,CAAC,CAAC;IAUvH,WAAW,CAAE,IAAI,EAAE,0BAA0B,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAUxG,UAAU,CAAE,IAAI,EAAE,yBAAyB,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;CAS3G"}
@@ -0,0 +1,37 @@
1
+ // ─── Agent Origin ─────────────────────────────────────────────────────────────
2
+ export default class AgentOrigin {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async statusReport(body) {
7
+ const { error, message, data } = await this.http.request({
8
+ url: '/agent/origin/status',
9
+ method: 'POST',
10
+ body
11
+ });
12
+ if (error)
13
+ throw new Error(message);
14
+ return data;
15
+ }
16
+ async registerPoi(body) {
17
+ const { error, message, data } = await this.http.request({
18
+ url: '/agent/origin/poi/register',
19
+ method: 'POST',
20
+ body
21
+ });
22
+ if (error)
23
+ throw new Error(message);
24
+ return data;
25
+ }
26
+ async addPoiNote(body) {
27
+ const { error, message, data } = await this.http.request({
28
+ url: '/agent/origin/poi/note',
29
+ method: 'POST',
30
+ body
31
+ });
32
+ if (error)
33
+ throw new Error(message);
34
+ return data;
35
+ }
36
+ }
37
+ //# sourceMappingURL=origin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"origin.js","sourceRoot":"","sources":["../../../src/allend/Agent/origin.ts"],"names":[],"mappings":"AAOA,iFAAiF;AAEjF,MAAM,CAAC,OAAO,OAAO,WAAW;IAC/B,YAAqB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAEnC,KAAK,CAAC,YAAY,CAAE,IAA+C;QAClE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAqD;YAC5G,GAAG,EAAE,sBAAsB;YAC3B,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,WAAW,CAAE,IAAwC;QAC1D,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA8C;YACrG,GAAG,EAAE,4BAA4B;YACjC,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,UAAU,CAAE,IAAuC;QACxD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA6C;YACpG,GAAG,EAAE,wBAAwB;YAC7B,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;CACD"}
@@ -0,0 +1,8 @@
1
+ import type { AgentReallocationRespondValidation } from '@de./types';
2
+ import { type Http } from '../../utils';
3
+ export default class AgentReallocation {
4
+ private http;
5
+ constructor(http: Http);
6
+ respond(body: AgentReallocationRespondValidation['body']): Promise<AgentReallocationRespondValidation['response']>;
7
+ }
8
+ //# sourceMappingURL=reallocation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reallocation.d.ts","sourceRoot":"","sources":["../../../src/allend/Agent/reallocation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,YAAY,CAAA;AACpE,OAAO,EAAE,KAAK,IAAI,EAAY,MAAM,aAAa,CAAA;AAIjD,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACxB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI;IAEzB,OAAO,CAAE,IAAI,EAAE,kCAAkC,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,kCAAkC,CAAC,UAAU,CAAC,CAAC;CAS1H"}
@@ -0,0 +1,17 @@
1
+ // ─── Agent Reallocation ───────────────────────────────────────────────────────
2
+ export default class AgentReallocation {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async respond(body) {
7
+ const { error, message, data } = await this.http.request({
8
+ url: '/agent/reallocation/respond',
9
+ method: 'POST',
10
+ body
11
+ });
12
+ if (error)
13
+ throw new Error(message);
14
+ return data;
15
+ }
16
+ }
17
+ //# sourceMappingURL=reallocation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reallocation.js","sourceRoot":"","sources":["../../../src/allend/Agent/reallocation.ts"],"names":[],"mappings":"AAGA,iFAAiF;AAEjF,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACrC,YAAqB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAEnC,KAAK,CAAC,OAAO,CAAE,IAAgD;QAC9D,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAsD;YAC7G,GAAG,EAAE,6BAA6B;YAClC,MAAM,EAAE,MAAM;YACd,IAAI;SACJ,CAAC,CAAA;QACF,IAAI,KAAK;YAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACZ,CAAC;CACD"}
@@ -0,0 +1,37 @@
1
+ import type { OrderTrackingEvent } from '@de./types';
2
+ import type { RTLocation, Message, Peer } from '../../types';
3
+ import type { AccessOptions } from '../../types/access';
4
+ import AccessManager from '../Access';
5
+ export type AgentRealtimeContext = {
6
+ wid: string;
7
+ type: string;
8
+ xcode: string;
9
+ };
10
+ export default class AgentRealtime extends AccessManager {
11
+ private nsp?;
12
+ private iosHost;
13
+ private agentId?;
14
+ constructor(access: AccessOptions);
15
+ connect(agentId: string): Promise<void>;
16
+ disconnect(): boolean;
17
+ /**
18
+ * Join an order tracking room with a Join Room Token issued by
19
+ * GET /v1/tracking/:reference (role must match this socket's utype)
20
+ */
21
+ join(jrtoken: string): Promise<boolean>;
22
+ sendLocation(location: RTLocation): this;
23
+ sendMessage(message: Message): this;
24
+ onOrderUpdate(fn: (event: OrderTrackingEvent) => void): this;
25
+ onMessage(fn: (message: Message) => void): this;
26
+ onConnected(fn: (peer: Peer) => void): this;
27
+ onDisconnected(fn: (peer: Peer) => void): this;
28
+ ackConsolidation(context: AgentRealtimeContext, offerId: string): this;
29
+ nackConsolidation(context: AgentRealtimeContext, offerId: string, nackReason?: string): this;
30
+ /**
31
+ * Stream the rider's position into the proactive consolidation engine —
32
+ * feeds trajectory tracking (ARRIVED / DIVERGING / STATIONARY) for
33
+ * committed handoffs. Distinct from order-room sendLocation().
34
+ */
35
+ positionUpdate(context: AgentRealtimeContext, location: RTLocation, status?: string): this;
36
+ }
37
+ //# sourceMappingURL=realtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../../../src/allend/Agent/realtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGvD,OAAO,aAAa,MAAM,WAAW,CAAA;AAoBrC,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,aAAa;IACtD,OAAO,CAAC,GAAG,CAAC,CAAQ;IACpB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,OAAO,CAAC,CAAQ;gBAEX,MAAM,EAAE,aAAa;IAQlC,OAAO,CAAE,OAAO,EAAE,MAAM,GAAI,OAAO,CAAC,IAAI,CAAC;IAgBzC,UAAU;IAKV;;;OAGG;IACH,IAAI,CAAE,OAAO,EAAE,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC;IAUzC,YAAY,CAAE,QAAQ,EAAE,UAAU;IAKlC,WAAW,CAAE,OAAO,EAAE,OAAO;IAK7B,aAAa,CAAE,EAAE,EAAE,CAAE,KAAK,EAAE,kBAAkB,KAAM,IAAI;IAKxD,SAAS,CAAE,EAAE,EAAE,CAAE,OAAO,EAAE,OAAO,KAAM,IAAI;IAK3C,WAAW,CAAE,EAAE,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI;IAKvC,cAAc,CAAE,EAAE,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI;IAO1C,gBAAgB,CAAE,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM;IAMhE,iBAAiB,CAAE,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IAMtF;;;;OAIG;IACH,cAAc,CAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM;CAKrF"}
@@ -0,0 +1,101 @@
1
+ import io from 'socket.io-client';
2
+ import AccessManager from '../Access';
3
+ import baseURL from '../../baseUrl';
4
+ export default class AgentRealtime extends AccessManager {
5
+ constructor(access) {
6
+ super(access, 'API');
7
+ // Socket.io is served by the same de.arch API server
8
+ const { API_SERVER_BASEURL } = baseURL(access.devHostname);
9
+ this.iosHost = API_SERVER_BASEURL[access.env || 'dev'];
10
+ }
11
+ connect(agentId) {
12
+ return new Promise((resolve, reject) => {
13
+ const auth = {
14
+ utype: 'agent',
15
+ id: agentId,
16
+ remoteOrigin: this.remoteOrigin,
17
+ accessToken: this.accessToken
18
+ };
19
+ this.agentId = agentId;
20
+ this.nsp = io(this.iosHost, { auth });
21
+ this.nsp.on('connect', resolve);
22
+ this.nsp.on('connect_error', reject);
23
+ });
24
+ }
25
+ disconnect() {
26
+ var _a;
27
+ (_a = this.nsp) === null || _a === void 0 ? void 0 : _a.disconnect();
28
+ return true;
29
+ }
30
+ /**
31
+ * Join an order tracking room with a Join Room Token issued by
32
+ * GET /v1/tracking/:reference (role must match this socket's utype)
33
+ */
34
+ join(jrtoken) {
35
+ return new Promise((resolve, reject) => {
36
+ var _a;
37
+ (_a = this.nsp) === null || _a === void 0 ? void 0 : _a.emit('JOIN', jrtoken, (errmess) => {
38
+ errmess ? reject(new Error(errmess)) : resolve(true);
39
+ });
40
+ });
41
+ }
42
+ // ── Order room streams (after join) ─────────────────────────────────────
43
+ sendLocation(location) {
44
+ var _a;
45
+ (_a = this.nsp) === null || _a === void 0 ? void 0 : _a.emit('LOCATION-CHANGE', location);
46
+ return this;
47
+ }
48
+ sendMessage(message) {
49
+ var _a;
50
+ (_a = this.nsp) === null || _a === void 0 ? void 0 : _a.emit('MESSAGE', message);
51
+ return this;
52
+ }
53
+ onOrderUpdate(fn) {
54
+ var _a;
55
+ (_a = this.nsp) === null || _a === void 0 ? void 0 : _a.on('ORDER_UPDATE', fn);
56
+ return this;
57
+ }
58
+ onMessage(fn) {
59
+ var _a;
60
+ (_a = this.nsp) === null || _a === void 0 ? void 0 : _a.on('MESSAGE', fn);
61
+ return this;
62
+ }
63
+ onConnected(fn) {
64
+ var _a;
65
+ (_a = this.nsp) === null || _a === void 0 ? void 0 : _a.on('CONNECTED', fn);
66
+ return this;
67
+ }
68
+ onDisconnected(fn) {
69
+ var _a;
70
+ (_a = this.nsp) === null || _a === void 0 ? void 0 : _a.on('DISCONNECTED', fn);
71
+ return this;
72
+ }
73
+ // ── Proactive consolidation channel (socket-only responses) ─────────────
74
+ ackConsolidation(context, offerId) {
75
+ var _a;
76
+ if (!this.agentId)
77
+ throw new Error('Not connected');
78
+ (_a = this.nsp) === null || _a === void 0 ? void 0 : _a.emit('CONSOLIDATION_ACK', { context, offerId, agentId: this.agentId });
79
+ return this;
80
+ }
81
+ nackConsolidation(context, offerId, nackReason) {
82
+ var _a;
83
+ if (!this.agentId)
84
+ throw new Error('Not connected');
85
+ (_a = this.nsp) === null || _a === void 0 ? void 0 : _a.emit('CONSOLIDATION_NACK', { context, offerId, agentId: this.agentId, nackReason });
86
+ return this;
87
+ }
88
+ /**
89
+ * Stream the rider's position into the proactive consolidation engine —
90
+ * feeds trajectory tracking (ARRIVED / DIVERGING / STATIONARY) for
91
+ * committed handoffs. Distinct from order-room sendLocation().
92
+ */
93
+ positionUpdate(context, location, status) {
94
+ var _a;
95
+ if (!this.agentId)
96
+ throw new Error('Not connected');
97
+ (_a = this.nsp) === null || _a === void 0 ? void 0 : _a.emit('CONSOLIDATION_POSITION', { context, agentId: this.agentId, location, status });
98
+ return this;
99
+ }
100
+ }
101
+ //# sourceMappingURL=realtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime.js","sourceRoot":"","sources":["../../../src/allend/Agent/realtime.ts"],"names":[],"mappings":"AAKA,OAAO,EAAc,MAAM,kBAAkB,CAAA;AAC7C,OAAO,aAAa,MAAM,WAAW,CAAA;AACrC,OAAO,OAAO,MAAM,eAAe,CAAA;AAyBnC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,aAAa;IAKtD,YAAa,MAAqB;QAChC,KAAK,CAAE,MAAM,EAAE,KAAK,CAAE,CAAA;QAEtB,qDAAqD;QACrD,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAE,MAAM,CAAC,WAAW,CAAE,CAAA;QAC5D,IAAI,CAAC,OAAO,GAAG,kBAAkB,CAAE,MAAM,CAAC,GAAG,IAAI,KAAK,CAAY,CAAA;IACpE,CAAC;IAED,OAAO,CAAE,OAAe;QACtB,OAAO,IAAI,OAAO,CAAE,CAAE,OAAO,EAAE,MAAM,EAAG,EAAE;YACxC,MAAM,IAAI,GAA0B;gBAClC,KAAK,EAAE,OAAO;gBACd,EAAE,EAAE,OAAO;gBACX,YAAY,EAAE,IAAI,CAAC,YAAsB;gBACzC,WAAW,EAAE,IAAI,CAAC,WAAqB;aACxC,CAAA;YAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;YACtB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAE,CAAA;YACvC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAE,CAAA;YAChC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,CAAE,CAAA;QACvC,CAAC,CAAE,CAAA;IACL,CAAC;IAED,UAAU;;QACR,MAAA,IAAI,CAAC,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0CAAE,EAAE,CAAC,cAAc,EAAE,EAAE,CAAE,CAAA;QACjC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,2EAA2E;IAE3E,gBAAgB,CAAE,OAA6B,EAAE,OAAe;;QAC9D,IAAI,CAAC,IAAI,CAAC,OAAO;YAAG,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;QACpD,MAAA,IAAI,CAAC,GAAG,0CAAE,IAAI,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAE,CAAA;QACjF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,iBAAiB,CAAE,OAA6B,EAAE,OAAe,EAAE,UAAmB;;QACpF,IAAI,CAAC,IAAI,CAAC,OAAO;YAAG,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;QACpD,MAAA,IAAI,CAAC,GAAG,0CAAE,IAAI,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,CAAE,CAAA;QAC9F,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAE,OAA6B,EAAE,QAAoB,EAAE,MAAe;;QAClF,IAAI,CAAC,IAAI,CAAC,OAAO;YAAG,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;QACpD,MAAA,IAAI,CAAC,GAAG,0CAAE,IAAI,CAAC,wBAAwB,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAE,CAAA;QAC/F,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import type { AgentRideListValidation, AgentRideGetValidation, AgentRideAcceptValidation, AgentRideStartValidation, AgentRideCompleteValidation, AgentRideCancelValidation } from '@de./types';
2
+ import { type Http } from '../../utils';
3
+ export default class AgentRides {
4
+ private http;
5
+ constructor(http: Http);
6
+ list(querystring?: AgentRideListValidation['querystring']): Promise<AgentRideListValidation['response']>;
7
+ get(reference: string): Promise<AgentRideGetValidation['response']>;
8
+ accept(reference: string, body: AgentRideAcceptValidation['body']): Promise<AgentRideAcceptValidation['response']>;
9
+ start(reference: string, body: AgentRideStartValidation['body']): Promise<AgentRideStartValidation['response']>;
10
+ complete(reference: string, body: AgentRideCompleteValidation['body']): Promise<AgentRideCompleteValidation['response']>;
11
+ cancel(reference: string, body: AgentRideCancelValidation['body']): Promise<AgentRideCancelValidation['response']>;
12
+ }
13
+ //# sourceMappingURL=rides.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rides.d.ts","sourceRoot":"","sources":["../../../src/allend/Agent/rides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAM,KAAK,IAAI,EAAY,MAAM,aAAa,CAAA;AAIrD,MAAM,CAAC,OAAO,OAAO,UAAU;IACjB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI;IAEzB,IAAI,CAAE,WAAW,CAAC,EAAE,uBAAuB,CAAC,aAAa,CAAC,GAAI,OAAO,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAS1G,GAAG,CAAE,SAAS,EAAE,MAAM,GAAI,OAAO,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;IASrE,MAAM,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;IAUpH,KAAK,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;IAUjH,QAAQ,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;IAU1H,MAAM,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,CAAC,MAAM,CAAC,GAAI,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;CAS1H"}