@chanaka_nakandala/integration-agent 1.1.0 → 2.0.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.
- package/README.md +369 -60
- package/dist/index.js +22 -486
- package/dist/index.js.map +1 -1
- package/dist/{cli/init-command.d.ts → init-command.d.ts} +2 -2
- package/dist/init-command.d.ts.map +1 -0
- package/dist/{cli/init-command.js → init-command.js} +72 -46
- package/dist/init-command.js.map +1 -0
- package/package.json +5 -11
- package/agent-personas/ba-agent.yaml +0 -682
- package/agent-personas/developer-agent.yaml +0 -585
- package/dist/cache/file-cache.d.ts +0 -10
- package/dist/cache/file-cache.d.ts.map +0 -1
- package/dist/cache/file-cache.js +0 -79
- package/dist/cache/file-cache.js.map +0 -1
- package/dist/cli/init-command.d.ts.map +0 -1
- package/dist/cli/init-command.js.map +0 -1
- package/dist/scrapers/docs-scraper.d.ts +0 -28
- package/dist/scrapers/docs-scraper.d.ts.map +0 -1
- package/dist/scrapers/docs-scraper.js +0 -200
- package/dist/scrapers/docs-scraper.js.map +0 -1
- package/dist/search/keyword-search.d.ts +0 -39
- package/dist/search/keyword-search.d.ts.map +0 -1
- package/dist/search/keyword-search.js +0 -127
- package/dist/search/keyword-search.js.map +0 -1
- package/dist/tools/code-generation-tool.d.ts +0 -33
- package/dist/tools/code-generation-tool.d.ts.map +0 -1
- package/dist/tools/code-generation-tool.js +0 -62
- package/dist/tools/code-generation-tool.js.map +0 -1
- package/dist/tools/search-result-formatter.d.ts +0 -27
- package/dist/tools/search-result-formatter.d.ts.map +0 -1
- package/dist/tools/search-result-formatter.js +0 -89
- package/dist/tools/search-result-formatter.js.map +0 -1
- package/dist/tools/search-tool.d.ts +0 -9
- package/dist/tools/search-tool.d.ts.map +0 -1
- package/dist/tools/search-tool.js +0 -32
- package/dist/tools/search-tool.js.map +0 -1
- package/dist/tools/template-loader.d.ts +0 -54
- package/dist/tools/template-loader.d.ts.map +0 -1
- package/dist/tools/template-loader.js +0 -148
- package/dist/tools/template-loader.js.map +0 -1
- package/dist/types/search.d.ts +0 -21
- package/dist/types/search.d.ts.map +0 -1
- package/dist/types/search.js +0 -2
- package/dist/types/search.js.map +0 -1
- package/templates/README.md +0 -98
- package/templates/authenticate/curl.template +0 -97
- package/templates/authenticate/java.template +0 -155
- package/templates/authenticate/python.template +0 -111
- package/templates/authenticate/typescript.template +0 -98
- package/templates/create_menu/curl.template +0 -145
- package/templates/create_menu/java.template +0 -285
- package/templates/create_menu/python.template +0 -159
- package/templates/create_menu/typescript.template +0 -184
- package/templates/receive_order/curl.template +0 -138
- package/templates/receive_order/java.template +0 -263
- package/templates/receive_order/python.template +0 -157
- package/templates/receive_order/typescript.template +0 -194
- package/templates/update_item_availability/curl.template +0 -143
- package/templates/update_item_availability/java.template +0 -279
- package/templates/update_item_availability/python.template +0 -203
- package/templates/update_item_availability/typescript.template +0 -194
- package/templates/update_order_status/curl.template +0 -138
- package/templates/update_order_status/java.template +0 -202
- package/templates/update_order_status/python.template +0 -142
- package/templates/update_order_status/typescript.template +0 -139
@@ -1,139 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Grubtech Order Status Update - TypeScript
|
3
|
-
*
|
4
|
-
* This example demonstrates how to update order status in Grubtech.
|
5
|
-
*
|
6
|
-
* Prerequisites:
|
7
|
-
* - Node.js 18+ with fetch API
|
8
|
-
* - Valid access token from authentication
|
9
|
-
*
|
10
|
-
* Replace the following placeholders:
|
11
|
-
* - {{AUTH_TOKEN}}: Access token from authentication step
|
12
|
-
* - {{ORDER_ID}}: The Grubtech order ID to update
|
13
|
-
* - {{NEW_STATUS}}: The new status value
|
14
|
-
*/
|
15
|
-
|
16
|
-
const AUTH_TOKEN = '{{AUTH_TOKEN}}';
|
17
|
-
const BASE_URL = 'https://api.grubtech.io';
|
18
|
-
|
19
|
-
enum OrderStatus {
|
20
|
-
ACCEPTED = 'accepted',
|
21
|
-
PREPARING = 'preparing',
|
22
|
-
READY = 'ready',
|
23
|
-
DELIVERED = 'delivered',
|
24
|
-
CANCELLED = 'cancelled',
|
25
|
-
}
|
26
|
-
|
27
|
-
interface StatusUpdatePayload {
|
28
|
-
orderId: string;
|
29
|
-
status: OrderStatus;
|
30
|
-
timestamp: string;
|
31
|
-
notes?: string;
|
32
|
-
}
|
33
|
-
|
34
|
-
interface StatusUpdateResponse {
|
35
|
-
success: boolean;
|
36
|
-
orderId: string;
|
37
|
-
status: string;
|
38
|
-
updatedAt: string;
|
39
|
-
message?: string;
|
40
|
-
}
|
41
|
-
|
42
|
-
/**
|
43
|
-
* Update order status in Grubtech
|
44
|
-
*/
|
45
|
-
async function updateOrderStatus(
|
46
|
-
orderId: string,
|
47
|
-
newStatus: OrderStatus,
|
48
|
-
notes?: string
|
49
|
-
): Promise<StatusUpdateResponse> {
|
50
|
-
try {
|
51
|
-
// Validate status value
|
52
|
-
if (!Object.values(OrderStatus).includes(newStatus)) {
|
53
|
-
throw new Error(`Invalid status: ${newStatus}`);
|
54
|
-
}
|
55
|
-
|
56
|
-
// Construct status update payload
|
57
|
-
const payload: StatusUpdatePayload = {
|
58
|
-
orderId,
|
59
|
-
status: newStatus,
|
60
|
-
timestamp: new Date().toISOString(),
|
61
|
-
notes,
|
62
|
-
};
|
63
|
-
|
64
|
-
console.log(`Updating order ${orderId} to status: ${newStatus}`);
|
65
|
-
|
66
|
-
// Make status update request
|
67
|
-
const response = await fetch(`${BASE_URL}/v1/orders/${orderId}/status`, {
|
68
|
-
method: 'PUT',
|
69
|
-
headers: {
|
70
|
-
'Authorization': `Bearer ${AUTH_TOKEN}`,
|
71
|
-
'Content-Type': 'application/json',
|
72
|
-
},
|
73
|
-
body: JSON.stringify(payload),
|
74
|
-
});
|
75
|
-
|
76
|
-
// Check for errors
|
77
|
-
if (!response.ok) {
|
78
|
-
const errorBody = await response.text();
|
79
|
-
throw new Error(
|
80
|
-
`Status update failed: ${response.status} - ${errorBody}`
|
81
|
-
);
|
82
|
-
}
|
83
|
-
|
84
|
-
// Parse response
|
85
|
-
const data: StatusUpdateResponse = await response.json();
|
86
|
-
|
87
|
-
console.log('✅ Order status updated successfully!');
|
88
|
-
console.log(`Order ID: ${data.orderId}`);
|
89
|
-
console.log(`New Status: ${data.status}`);
|
90
|
-
console.log(`Updated At: ${data.updatedAt}`);
|
91
|
-
|
92
|
-
return data;
|
93
|
-
} catch (error) {
|
94
|
-
console.error('❌ Status update error:', error);
|
95
|
-
throw error;
|
96
|
-
}
|
97
|
-
}
|
98
|
-
|
99
|
-
/**
|
100
|
-
* Example: Update order through typical workflow
|
101
|
-
*/
|
102
|
-
async function orderWorkflowExample(orderId: string) {
|
103
|
-
try {
|
104
|
-
// Step 1: Accept the order
|
105
|
-
await updateOrderStatus(orderId, OrderStatus.ACCEPTED, 'Order confirmed');
|
106
|
-
|
107
|
-
// Step 2: Start preparing
|
108
|
-
await updateOrderStatus(orderId, OrderStatus.PREPARING, 'Chef started cooking');
|
109
|
-
|
110
|
-
// Step 3: Mark as ready
|
111
|
-
await updateOrderStatus(orderId, OrderStatus.READY, 'Order ready for pickup');
|
112
|
-
|
113
|
-
// Step 4: Mark as delivered (or picked up)
|
114
|
-
await updateOrderStatus(orderId, OrderStatus.DELIVERED, 'Order delivered to customer');
|
115
|
-
|
116
|
-
console.log('✅ Order workflow completed!');
|
117
|
-
} catch (error) {
|
118
|
-
console.error('❌ Workflow error:', error);
|
119
|
-
|
120
|
-
// If something goes wrong, cancel the order
|
121
|
-
await updateOrderStatus(orderId, OrderStatus.CANCELLED, 'Unable to fulfill order');
|
122
|
-
}
|
123
|
-
}
|
124
|
-
|
125
|
-
// Main execution
|
126
|
-
(async () => {
|
127
|
-
try {
|
128
|
-
const orderId = '{{ORDER_ID}}';
|
129
|
-
const newStatus = OrderStatus.PREPARING; // Change this to {{NEW_STATUS}}
|
130
|
-
|
131
|
-
// Single status update
|
132
|
-
await updateOrderStatus(orderId, newStatus, 'Status update from POS');
|
133
|
-
|
134
|
-
// Or run through full workflow
|
135
|
-
// await orderWorkflowExample(orderId);
|
136
|
-
} catch (error) {
|
137
|
-
process.exit(1);
|
138
|
-
}
|
139
|
-
})();
|