@compassdigital/sdk.typescript 4.527.0 → 4.528.1-alpha.2
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/lib/index.d.ts +378 -8
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +452 -3
- package/lib/index.js.map +1 -1
- package/lib/interface/centricos.d.ts +9 -3
- package/lib/interface/centricos.d.ts.map +1 -1
- package/lib/interface/consumer.d.ts +36 -1
- package/lib/interface/consumer.d.ts.map +1 -1
- package/lib/interface/location.d.ts +0 -1
- package/lib/interface/location.d.ts.map +1 -1
- package/lib/interface/loyalty.d.ts +830 -0
- package/lib/interface/loyalty.d.ts.map +1 -0
- package/lib/interface/loyalty.js +5 -0
- package/lib/interface/loyalty.js.map +1 -0
- package/lib/interface/menu.d.ts +59 -0
- package/lib/interface/menu.d.ts.map +1 -1
- package/lib/interface/user.d.ts +20 -0
- package/lib/interface/user.d.ts.map +1 -1
- package/lib/messages/events/AuditEvent.d.ts +39 -0
- package/lib/messages/events/AuditEvent.d.ts.map +1 -0
- package/lib/messages/events/AuditEvent.js +4 -0
- package/lib/messages/events/AuditEvent.js.map +1 -0
- package/lib/messages/events/DiscountCreatedEvent.d.ts +1 -0
- package/lib/messages/events/DiscountCreatedEvent.d.ts.map +1 -1
- package/lib/messages/events/DiscountPublishedEvent.d.ts +1 -0
- package/lib/messages/events/DiscountPublishedEvent.d.ts.map +1 -1
- package/lib/messages/events/DiscountUpdatedEvent.d.ts +1 -0
- package/lib/messages/events/DiscountUpdatedEvent.d.ts.map +1 -1
- package/lib/messages/events/FrictionlessOrderFailureEvent.d.ts +23 -0
- package/lib/messages/events/FrictionlessOrderFailureEvent.d.ts.map +1 -0
- package/lib/messages/events/FrictionlessOrderFailureEvent.js +4 -0
- package/lib/messages/events/FrictionlessOrderFailureEvent.js.map +1 -0
- package/lib/messages/events/index.d.ts +2 -0
- package/lib/messages/events/index.d.ts.map +1 -1
- package/manifest.json +7 -0
- package/package.json +1 -1
- package/src/index.ts +1096 -7
- package/src/interface/centricos.ts +16 -6
- package/src/interface/consumer.ts +59 -1
- package/src/interface/location.ts +0 -1
- package/src/interface/loyalty.ts +1155 -0
- package/src/interface/menu.ts +81 -0
- package/src/interface/user.ts +27 -0
- package/src/messages/events/AuditEvent.ts +52 -0
- package/src/messages/events/DiscountCreatedEvent.ts +1 -0
- package/src/messages/events/DiscountPublishedEvent.ts +1 -0
- package/src/messages/events/DiscountUpdatedEvent.ts +1 -0
- package/src/messages/events/FrictionlessOrderFailureEvent.ts +34 -0
- package/src/messages/events/index.ts +4 -0
- package/test/client.test.ts +23 -0
package/src/interface/menu.ts
CHANGED
|
@@ -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;
|
|
@@ -1937,6 +1938,31 @@ export interface BusinessUnitDTO {
|
|
|
1937
1938
|
[index: string]: any;
|
|
1938
1939
|
}
|
|
1939
1940
|
|
|
1941
|
+
export interface MenuWorksProductDTO {
|
|
1942
|
+
mrn: string;
|
|
1943
|
+
product_type?: string;
|
|
1944
|
+
name?: string;
|
|
1945
|
+
short_name?: string;
|
|
1946
|
+
[index: string]: any;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
export interface ProductsSyncStatusResponseDTO {
|
|
1950
|
+
status: string;
|
|
1951
|
+
items_ingested_count: number;
|
|
1952
|
+
total_available?: number;
|
|
1953
|
+
last_success_at?: string | string;
|
|
1954
|
+
last_failure_at?: string | string;
|
|
1955
|
+
started_at?: string | string;
|
|
1956
|
+
message?: string;
|
|
1957
|
+
[index: string]: any;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
export interface ConflictErrorDTO {
|
|
1961
|
+
number: number;
|
|
1962
|
+
message: string;
|
|
1963
|
+
[index: string]: any;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1940
1966
|
export interface UniversalItemWithoutIdDTO {
|
|
1941
1967
|
barcode: string;
|
|
1942
1968
|
name: string;
|
|
@@ -2713,6 +2739,7 @@ export interface PostMenuV3LocalMenuGroupBody {
|
|
|
2713
2739
|
show_v4?: boolean;
|
|
2714
2740
|
menuworks_unit_ids?: string[];
|
|
2715
2741
|
append_ingredients_nutrition_to_description?: boolean;
|
|
2742
|
+
visibility?: Record<string, any>;
|
|
2716
2743
|
vendor_metadata?: VendorMetadataDTO[];
|
|
2717
2744
|
permissions?: Record<string, any>;
|
|
2718
2745
|
[index: string]: any;
|
|
@@ -2728,6 +2755,7 @@ export interface PostMenuV3LocalMenuGroupResponse {
|
|
|
2728
2755
|
show_v4?: boolean;
|
|
2729
2756
|
menuworks_unit_ids?: string[];
|
|
2730
2757
|
append_ingredients_nutrition_to_description?: boolean;
|
|
2758
|
+
visibility?: Record<string, any>;
|
|
2731
2759
|
id: string;
|
|
2732
2760
|
created_at?: string;
|
|
2733
2761
|
updated_at?: string;
|
|
@@ -2769,6 +2797,7 @@ export interface GetMenuV3LocalMenuGroupResponse {
|
|
|
2769
2797
|
show_v4?: boolean;
|
|
2770
2798
|
menuworks_unit_ids?: string[];
|
|
2771
2799
|
append_ingredients_nutrition_to_description?: boolean;
|
|
2800
|
+
visibility?: Record<string, any>;
|
|
2772
2801
|
id: string;
|
|
2773
2802
|
created_at?: string;
|
|
2774
2803
|
updated_at?: string;
|
|
@@ -2800,6 +2829,7 @@ export interface PatchMenuV3LocalMenuGroupBody {
|
|
|
2800
2829
|
show_v4?: boolean;
|
|
2801
2830
|
menuworks_unit_ids?: string[];
|
|
2802
2831
|
append_ingredients_nutrition_to_description?: boolean;
|
|
2832
|
+
visibility?: Record<string, any>;
|
|
2803
2833
|
id?: string;
|
|
2804
2834
|
version?: number;
|
|
2805
2835
|
vendor_metadata?: VendorMetadataDTO[];
|
|
@@ -2817,6 +2847,7 @@ export interface PatchMenuV3LocalMenuGroupResponse {
|
|
|
2817
2847
|
show_v4?: boolean;
|
|
2818
2848
|
menuworks_unit_ids?: string[];
|
|
2819
2849
|
append_ingredients_nutrition_to_description?: boolean;
|
|
2850
|
+
visibility?: Record<string, any>;
|
|
2820
2851
|
id: string;
|
|
2821
2852
|
created_at?: string;
|
|
2822
2853
|
updated_at?: string;
|
|
@@ -2854,6 +2885,7 @@ export interface DeleteMenuV3LocalMenuGroupResponse {
|
|
|
2854
2885
|
show_v4?: boolean;
|
|
2855
2886
|
menuworks_unit_ids?: string[];
|
|
2856
2887
|
append_ingredients_nutrition_to_description?: boolean;
|
|
2888
|
+
visibility?: Record<string, any>;
|
|
2857
2889
|
id: string;
|
|
2858
2890
|
created_at?: string;
|
|
2859
2891
|
updated_at?: string;
|
|
@@ -2910,6 +2942,7 @@ export type PostMenuV3LocalMenuGroupsBody = {
|
|
|
2910
2942
|
show_v4?: boolean;
|
|
2911
2943
|
menuworks_unit_ids?: string[];
|
|
2912
2944
|
append_ingredients_nutrition_to_description?: boolean;
|
|
2945
|
+
visibility?: Record<string, any>;
|
|
2913
2946
|
vendor_metadata?: VendorMetadataDTO[];
|
|
2914
2947
|
permissions?: Record<string, any>;
|
|
2915
2948
|
[index: string]: any;
|
|
@@ -7790,6 +7823,54 @@ export interface GetMenuV3MenuworksBusinessUnitsResponse {
|
|
|
7790
7823
|
|
|
7791
7824
|
export interface GetMenuV3MenuworksBusinessUnitsRequest extends BaseRequest {}
|
|
7792
7825
|
|
|
7826
|
+
// GET /menu/v3/menuworks/business_units/{unit_id}/products
|
|
7827
|
+
|
|
7828
|
+
export interface GetMenuV3MenuworksBusinessUnitsProductsPath {
|
|
7829
|
+
unit_id: string;
|
|
7830
|
+
}
|
|
7831
|
+
|
|
7832
|
+
export interface GetMenuV3MenuworksBusinessUnitsProductsQuery {
|
|
7833
|
+
q?: string;
|
|
7834
|
+
// Number of records to load per page
|
|
7835
|
+
limit?: number;
|
|
7836
|
+
page?: number;
|
|
7837
|
+
// If specified, only the selected fields will be returned
|
|
7838
|
+
select?: string[];
|
|
7839
|
+
// List of relationships to load alongside this entity. Can load nested relationships using the pattern 'children.grand_children.foo'
|
|
7840
|
+
relationships?: string[];
|
|
7841
|
+
// A field to sort the results based on
|
|
7842
|
+
sort_by?: string;
|
|
7843
|
+
sort_order?: 'DESC' | 'ASC';
|
|
7844
|
+
// How soft deleted records should be shown in the list
|
|
7845
|
+
soft_deleted?: 'include' | 'exclude' | 'only';
|
|
7846
|
+
}
|
|
7847
|
+
|
|
7848
|
+
export interface GetMenuV3MenuworksBusinessUnitsProductsResponse {
|
|
7849
|
+
results: MenuWorksProductDTO[];
|
|
7850
|
+
sync_status?: ProductsSyncStatusResponseDTO;
|
|
7851
|
+
meta?: ListResponseMetadataDTO;
|
|
7852
|
+
[index: string]: any;
|
|
7853
|
+
}
|
|
7854
|
+
|
|
7855
|
+
export interface GetMenuV3MenuworksBusinessUnitsProductsRequest
|
|
7856
|
+
extends BaseRequest,
|
|
7857
|
+
RequestQuery<GetMenuV3MenuworksBusinessUnitsProductsQuery>,
|
|
7858
|
+
GetMenuV3MenuworksBusinessUnitsProductsPath {}
|
|
7859
|
+
|
|
7860
|
+
// POST /menu/v3/menuworks/business_units/{unit_id}/products/sync
|
|
7861
|
+
|
|
7862
|
+
export interface PostMenuV3MenuworksBusinessUnitsProductsSyncPath {
|
|
7863
|
+
unit_id: string;
|
|
7864
|
+
}
|
|
7865
|
+
|
|
7866
|
+
export interface PostMenuV3MenuworksBusinessUnitsProductsSyncResponse {
|
|
7867
|
+
triggered?: boolean;
|
|
7868
|
+
}
|
|
7869
|
+
|
|
7870
|
+
export interface PostMenuV3MenuworksBusinessUnitsProductsSyncRequest
|
|
7871
|
+
extends BaseRequest,
|
|
7872
|
+
PostMenuV3MenuworksBusinessUnitsProductsSyncPath {}
|
|
7873
|
+
|
|
7793
7874
|
// GET /menu/v3/universal-items
|
|
7794
7875
|
|
|
7795
7876
|
export interface GetMenuV3UniversalItemsQuery {
|
package/src/interface/user.ts
CHANGED
|
@@ -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
|
+
}
|
|
@@ -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';
|
package/test/client.test.ts
CHANGED
|
@@ -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({
|