@compassdigital/sdk.typescript 4.528.0 → 4.528.1-alpha.3

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 (50) hide show
  1. package/lib/index.d.ts +361 -7
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +434 -3
  4. package/lib/index.js.map +1 -1
  5. package/lib/interface/centricos.d.ts +9 -3
  6. package/lib/interface/centricos.d.ts.map +1 -1
  7. package/lib/interface/consumer.d.ts +36 -1
  8. package/lib/interface/consumer.d.ts.map +1 -1
  9. package/lib/interface/location.d.ts +0 -1
  10. package/lib/interface/location.d.ts.map +1 -1
  11. package/lib/interface/loyalty.d.ts +833 -0
  12. package/lib/interface/loyalty.d.ts.map +1 -0
  13. package/lib/interface/loyalty.js +5 -0
  14. package/lib/interface/loyalty.js.map +1 -0
  15. package/lib/interface/menu.d.ts +8 -0
  16. package/lib/interface/menu.d.ts.map +1 -1
  17. package/lib/interface/user.d.ts +20 -0
  18. package/lib/interface/user.d.ts.map +1 -1
  19. package/lib/messages/events/AuditEvent.d.ts +39 -0
  20. package/lib/messages/events/AuditEvent.d.ts.map +1 -0
  21. package/lib/messages/events/AuditEvent.js +4 -0
  22. package/lib/messages/events/AuditEvent.js.map +1 -0
  23. package/lib/messages/events/DiscountCreatedEvent.d.ts +1 -0
  24. package/lib/messages/events/DiscountCreatedEvent.d.ts.map +1 -1
  25. package/lib/messages/events/DiscountPublishedEvent.d.ts +1 -0
  26. package/lib/messages/events/DiscountPublishedEvent.d.ts.map +1 -1
  27. package/lib/messages/events/DiscountUpdatedEvent.d.ts +1 -0
  28. package/lib/messages/events/DiscountUpdatedEvent.d.ts.map +1 -1
  29. package/lib/messages/events/FrictionlessOrderFailureEvent.d.ts +23 -0
  30. package/lib/messages/events/FrictionlessOrderFailureEvent.d.ts.map +1 -0
  31. package/lib/messages/events/FrictionlessOrderFailureEvent.js +4 -0
  32. package/lib/messages/events/FrictionlessOrderFailureEvent.js.map +1 -0
  33. package/lib/messages/events/index.d.ts +2 -0
  34. package/lib/messages/events/index.d.ts.map +1 -1
  35. package/manifest.json +7 -0
  36. package/package.json +1 -1
  37. package/src/index.ts +1051 -7
  38. package/src/interface/centricos.ts +16 -6
  39. package/src/interface/consumer.ts +59 -1
  40. package/src/interface/location.ts +0 -1
  41. package/src/interface/loyalty.ts +1158 -0
  42. package/src/interface/menu.ts +8 -0
  43. package/src/interface/user.ts +27 -0
  44. package/src/messages/events/AuditEvent.ts +52 -0
  45. package/src/messages/events/DiscountCreatedEvent.ts +1 -0
  46. package/src/messages/events/DiscountPublishedEvent.ts +1 -0
  47. package/src/messages/events/DiscountUpdatedEvent.ts +1 -0
  48. package/src/messages/events/FrictionlessOrderFailureEvent.ts +34 -0
  49. package/src/messages/events/index.ts +4 -0
  50. package/test/client.test.ts +23 -0
@@ -719,6 +719,7 @@ export interface LocalMenuGroupDTO {
719
719
  show_v4?: boolean;
720
720
  menuworks_unit_ids?: string[];
721
721
  append_ingredients_nutrition_to_description?: boolean;
722
+ visibility?: Record<string, any>;
722
723
  id: string;
723
724
  created_at?: string;
724
725
  updated_at?: string;
@@ -2738,6 +2739,7 @@ export interface PostMenuV3LocalMenuGroupBody {
2738
2739
  show_v4?: boolean;
2739
2740
  menuworks_unit_ids?: string[];
2740
2741
  append_ingredients_nutrition_to_description?: boolean;
2742
+ visibility?: Record<string, any>;
2741
2743
  vendor_metadata?: VendorMetadataDTO[];
2742
2744
  permissions?: Record<string, any>;
2743
2745
  [index: string]: any;
@@ -2753,6 +2755,7 @@ export interface PostMenuV3LocalMenuGroupResponse {
2753
2755
  show_v4?: boolean;
2754
2756
  menuworks_unit_ids?: string[];
2755
2757
  append_ingredients_nutrition_to_description?: boolean;
2758
+ visibility?: Record<string, any>;
2756
2759
  id: string;
2757
2760
  created_at?: string;
2758
2761
  updated_at?: string;
@@ -2794,6 +2797,7 @@ export interface GetMenuV3LocalMenuGroupResponse {
2794
2797
  show_v4?: boolean;
2795
2798
  menuworks_unit_ids?: string[];
2796
2799
  append_ingredients_nutrition_to_description?: boolean;
2800
+ visibility?: Record<string, any>;
2797
2801
  id: string;
2798
2802
  created_at?: string;
2799
2803
  updated_at?: string;
@@ -2825,6 +2829,7 @@ export interface PatchMenuV3LocalMenuGroupBody {
2825
2829
  show_v4?: boolean;
2826
2830
  menuworks_unit_ids?: string[];
2827
2831
  append_ingredients_nutrition_to_description?: boolean;
2832
+ visibility?: Record<string, any>;
2828
2833
  id?: string;
2829
2834
  version?: number;
2830
2835
  vendor_metadata?: VendorMetadataDTO[];
@@ -2842,6 +2847,7 @@ export interface PatchMenuV3LocalMenuGroupResponse {
2842
2847
  show_v4?: boolean;
2843
2848
  menuworks_unit_ids?: string[];
2844
2849
  append_ingredients_nutrition_to_description?: boolean;
2850
+ visibility?: Record<string, any>;
2845
2851
  id: string;
2846
2852
  created_at?: string;
2847
2853
  updated_at?: string;
@@ -2879,6 +2885,7 @@ export interface DeleteMenuV3LocalMenuGroupResponse {
2879
2885
  show_v4?: boolean;
2880
2886
  menuworks_unit_ids?: string[];
2881
2887
  append_ingredients_nutrition_to_description?: boolean;
2888
+ visibility?: Record<string, any>;
2882
2889
  id: string;
2883
2890
  created_at?: string;
2884
2891
  updated_at?: string;
@@ -2935,6 +2942,7 @@ export type PostMenuV3LocalMenuGroupsBody = {
2935
2942
  show_v4?: boolean;
2936
2943
  menuworks_unit_ids?: string[];
2937
2944
  append_ingredients_nutrition_to_description?: boolean;
2945
+ visibility?: Record<string, any>;
2938
2946
  vendor_metadata?: VendorMetadataDTO[];
2939
2947
  permissions?: Record<string, any>;
2940
2948
  [index: string]: any;
@@ -316,6 +316,27 @@ export interface PingResponse {
316
316
  service?: string;
317
317
  }
318
318
 
319
+ export interface HealthResponse {
320
+ status: 'healthy' | 'unhealthy';
321
+ timestamp: string;
322
+ version: string;
323
+ dependencies: HealthDependency[];
324
+ metadata: HealthMetadata;
325
+ }
326
+
327
+ export interface HealthDependency {
328
+ name: string;
329
+ status: 'healthy' | 'unhealthy';
330
+ responseTimeMs: number;
331
+ // Error or status details when unhealthy, null when healthy
332
+ details?: string;
333
+ }
334
+
335
+ export interface HealthMetadata {
336
+ region: string;
337
+ service: string;
338
+ }
339
+
319
340
  // GET /user/auth - Gets the JWT token for a user
320
341
 
321
342
  export interface GetUserAuthQuery {
@@ -808,3 +829,9 @@ export interface GetUserProfileRequest extends BaseRequest, RequestQuery<GetUser
808
829
  export type GetUserPingResponse = PingResponse;
809
830
 
810
831
  export interface GetUserPingRequest extends BaseRequest {}
832
+
833
+ // GET /user/health - User Service health check with dependency validation
834
+
835
+ export type GetUserHealthResponse = HealthResponse;
836
+
837
+ export interface GetUserHealthRequest extends BaseRequest {}
@@ -0,0 +1,52 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY
2
+
3
+ export interface AuditActor {
4
+ id: string;
5
+ display_name: string;
6
+ type: 'human' | 'service' | 'system';
7
+ }
8
+
9
+ export interface AuditEntityRef {
10
+ type: string;
11
+ id: string;
12
+ }
13
+
14
+ export interface AuditResource {
15
+ type: string;
16
+ id: string;
17
+ name: string;
18
+ }
19
+
20
+ export interface AuditChanges {
21
+ // Sparse — only changed fields. For removed items, key present only here.
22
+ old?: Record<string, any>;
23
+ // Sparse — only changed fields. For added items, key present only here.
24
+ new?: Record<string, any>;
25
+ }
26
+
27
+ export interface AuditEvent {
28
+ // UUID, producer-assigned. Stable across EventBridge retries — used for deduplication.
29
+ id: string;
30
+ type: 'AuditEvent';
31
+ version: '0.0.1';
32
+ // ISO 8601 — when the action occurred, not when emitted
33
+ timestamp: string;
34
+ traceContext: {
35
+ traceId: string;
36
+ };
37
+ payload: {
38
+ // e.g. calendar_created, calendar_updated, calendar_deleted
39
+ action: string;
40
+ actor: AuditActor;
41
+ outcome: 'success' | 'failure';
42
+ // Present when outcome is failure
43
+ error_message?: string;
44
+ // Primary entity plus known ancestors (e.g. calendar, brand, location)
45
+ entity_refs: AuditEntityRef[];
46
+ resource: AuditResource;
47
+ changes?: AuditChanges;
48
+ correlation_id?: string;
49
+ };
50
+ // Producer service name (e.g. calendar-service)
51
+ source: string;
52
+ }
@@ -102,6 +102,7 @@ export interface ItemLevelConfig {
102
102
  globalMenuGroupId?: string;
103
103
  globalMenuGroupName?: string;
104
104
  sectorName?: string;
105
+ bundlePriority?: number;
105
106
  details: ItemLevelConfigDetails[];
106
107
  }
107
108
 
@@ -102,6 +102,7 @@ export interface ItemLevelConfig {
102
102
  globalMenuGroupId?: string;
103
103
  globalMenuGroupName?: string;
104
104
  sectorName?: string;
105
+ bundlePriority?: number;
105
106
  details: ItemLevelConfigDetails[];
106
107
  }
107
108
 
@@ -102,6 +102,7 @@ export interface ItemLevelConfig {
102
102
  globalMenuGroupId?: string;
103
103
  globalMenuGroupName?: string;
104
104
  sectorName?: string;
105
+ bundlePriority?: number;
105
106
  details: ItemLevelConfigDetails[];
106
107
  }
107
108
 
@@ -0,0 +1,34 @@
1
+ // THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY
2
+
3
+ export interface FrictionlessOrderFailureEvent {
4
+ id: string;
5
+ type: 'FrictionlessOrderFailureEvent';
6
+ version: '0.0.1';
7
+ timestamp: string;
8
+ traceContext: {
9
+ traceId?: string;
10
+ };
11
+ payload: {
12
+ // The frictionless checkin identifier
13
+ checkinID: string;
14
+ // Shopping cart ID of the failed transaction
15
+ shoppingCartID: string;
16
+ // Order ID when available
17
+ orderID?: string;
18
+ // User ID of the failed transaction
19
+ userID: string;
20
+ // User email
21
+ userEmail: string;
22
+ // Meal plan ID when payment was mealplan
23
+ mealPlanID?: string;
24
+ // Site ID of the transaction
25
+ siteID: string;
26
+ // Brand ID of the transaction
27
+ brandID: string;
28
+ // Human-readable failure reason e.g. INSUFFICIENT_BALANCE, PAYMENT_DID_NOT_GO_THROUGH, PROCESSING_FAILED
29
+ failReason: string;
30
+ // Unpaid balance amount for insufficient balance failures
31
+ unpaidAmount: number;
32
+ };
33
+ source: string;
34
+ }
@@ -1,5 +1,7 @@
1
1
  // THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY
2
2
 
3
+ export { AuditEvent } from './AuditEvent';
4
+
3
5
  export { DiscountCreatedEvent } from './DiscountCreatedEvent';
4
6
 
5
7
  export { DiscountDeactivatedEvent } from './DiscountDeactivatedEvent';
@@ -16,6 +18,8 @@ export { ExternalRewardRedeemedEvent } from './ExternalRewardRedeemedEvent';
16
18
 
17
19
  export { FakeEvent } from './FakeEvent';
18
20
 
21
+ export { FrictionlessOrderFailureEvent } from './FrictionlessOrderFailureEvent';
22
+
19
23
  export { LocationBrandCreatedEvent } from './LocationBrandCreatedEvent';
20
24
 
21
25
  export { LocationBrandUpdatedEvent } from './LocationBrandUpdatedEvent';
@@ -84,6 +84,29 @@ describe('ServiceClient', () => {
84
84
  });
85
85
  });
86
86
 
87
+ test('loyalty client methods use path-style names', async () => {
88
+ const intercept = jest.fn(interceptor(200, { data: [] }));
89
+ const api = new ServiceClient({ stage: 'dev', intercept });
90
+
91
+ await api.get_loyalty_rewards({
92
+ query: {
93
+ realm: 'boost',
94
+ status: 'active',
95
+ },
96
+ } as any);
97
+
98
+ const req = intercept.mock.calls[0][0];
99
+ expect(req).toEqual({
100
+ route: '/loyalty/rewards',
101
+ service: 'loyalty',
102
+ url: 'https://dev.api.compassdigital.org/loyalty/rewards?realm=boost&status=active',
103
+ method: 'GET',
104
+ headers: {
105
+ 'user-agent': 'CDL/ServiceClient',
106
+ },
107
+ });
108
+ });
109
+
87
110
  test('user specified headers take priority', async () => {
88
111
  const intercept = jest.fn(interceptor(200));
89
112
  const api = new ServiceClient({